Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nix config #2144

Merged
merged 3 commits into from
Jun 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/mixxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ def __init__(self, target, machine, build, toolchain, available_features):

# Now that environment variables have been read, we can detect the compiler.
import subprocess
process = subprocess.Popen([self.env['CC'], '--version'], stdout=subprocess.PIPE)
process = subprocess.Popen("%s %s" %(self.env['CC'], '--version'), stdout=subprocess.PIPE, shell=True) # nosec
uklotzde marked this conversation as resolved.
Show resolved Hide resolved
(stdout, stderr) = process.communicate()
self.compiler_is_gcc = 'gcc' in stdout.lower()
self.compiler_is_clang = 'clang' in stdout.lower()

# Determine the major compiler version (only GCC)
if self.compiler_is_gcc:
self.gcc_major_version = None
process = subprocess.Popen([self.env['CC'], '-dumpversion'], stdout=subprocess.PIPE)
process = subprocess.Popen("%s %s" %(self.env['CC'], '-dumpversion'), stdout=subprocess.PIPE, shell=True) # nosec
(stdout, stderr) = process.communicate()
gcc_version = stdout
# If match is None we don't know the version.
Expand Down
2 changes: 1 addition & 1 deletion build/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_build_dir(platformString, bitwidth):
def get_mixxx_version():
"""Get Mixxx version number from defs_version.h"""
# have to handle out-of-tree building, that's why the '#' :(
defs = Script.File('#src/defs_version.h')
defs = Script.File('#src/_version.h')
version = ""

for line in open(str(defs)).readlines():
Expand Down
73 changes: 73 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{ nixroot ? (import <nixpkgs> {}) }:
let inherit (nixroot) stdenv pkgs lib
chromaprint fftw flac libid3tag libmad libopus libshout libsndfile lilv
libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5 glib
rubberband scons sqlite taglib soundtouch vamp opusfile hidapi upower ccache git
libGLU x11 lame lv2 makeWrapper;

in stdenv.mkDerivation rec {
name = "mixxx-${version}";
# reading the version from git output is very hard to do without wasting lots of diskspace and runtime
# reading version file is easy
version = lib.strings.removeSuffix "\"\n" (
lib.strings.removePrefix "#define MIXXX_VERSION \"" (
builtins.readFile ./src/_version.h ));

shellHook = ''
export CC="ccache gcc"
export CXX="ccache g++"

build() {
scons $sconsFlags prefix=~/mixxx $@
}

run() {
BUILDDIR=$(ls -1 -d -t lin64_build lin_build | head -1)
$BUILDDIR/mixxx --settingsPath ./devsettings/ --resourcePath ./res $@
}

echo -e "mixxx development shell. available commands:\n"
echo " build - compiles mixxx"
echo " run - runs mixxx with development settings"
'';

src = builtins.filterSource
(path: type: ! builtins.any (x: x == baseNameOf path) [ ".git" "cache" "lin64_build" "lin_build" "debian" ])
./.;

buildInputs = [
chromaprint fftw flac libid3tag libmad libopus libshout libsndfile
libusb1 libvorbis libebur128 pkgconfig portaudio portmidi protobuf qt5.full
rubberband scons sqlite taglib soundtouch vamp.vampSDK opusfile upower hidapi
ccache git glib x11 libGLU lilv lame lv2 makeWrapper qt5.qtbase
];

sconsFlags = [
"build=debug"
"qtdir=${qt5.full}"
];

buildPhase = ''
runHook preBuild;
mkdir -p "$out";
scons \
-j$NIX_BUILD_CORES \
$sconsFlags "prefix=$out";
runHook postBuild
'';

installPhase = ''
runHook preInstall
scons $sconsFlags "prefix=$out" install
wrapProgram $out/bin/mixxx --suffix QT_PLUGIN_PATH : ${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} --set QTDIR ${qt5.full}
runHook postInstall
'';

meta = with nixroot.stdenv.lib; {
homepage = https://mixxx.org;
description = "Digital DJ mixing software";
license = licenses.gpl2Plus;
maintainers = [ maintainers.aszlig maintainers.goibhniu ];
platforms = platforms.linux;
};
}
1 change: 1 addition & 0 deletions src/_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define MIXXX_VERSION "2.3.0-alpha-pre"
5 changes: 3 additions & 2 deletions src/defs_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
// In that case, this value is used

// READ ABOVE CAREFULLY BEFORE CHANGING!
// USE 3 DIGITS VERSION ONLY /!\ _
#define MIXXX_VERSION "2.3.0-alpha-pre"
// USE 3 DIGITS VERSION ONLY !
uklotzde marked this conversation as resolved.
Show resolved Hide resolved
// CHANGE IN ACTUAL VERSION FILE
#include "_version.h"
uklotzde marked this conversation as resolved.
Show resolved Hide resolved
#endif