summaryrefslogtreecommitdiffstats
path: root/default.nix
diff options
context:
space:
mode:
authorDaniel Poelzleithner <git@poelzi.org>2019-06-05 19:13:57 +0200
committerDaniel Poelzleithner <git@poelzi.org>2019-06-05 19:13:57 +0200
commitee32efcfece2d319ec2304f7a277941292add7d8 (patch)
tree759dda09e3a4f8fda03b7c552c632f6474263588 /default.nix
parent0b1137a1ba914e6acb7217e800585b4230bd45f1 (diff)
Move version into own file and use version file in default.nix
Due the nature of nix, using "git describe" will always waste a copy of the source folder and is quite slow. Since nix string functions are very limited and extracting the version is difficult, the best compromise was to move the version into a small file as a single source of truth.
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/default.nix b/default.nix
index 371b54858b..b72e69c795 100644
--- a/default.nix
+++ b/default.nix
@@ -1,5 +1,5 @@
{ nixroot ? (import <nixpkgs> {}) }:
-let inherit (nixroot) stdenv pkgs
+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
@@ -7,8 +7,11 @@ let inherit (nixroot) stdenv pkgs
in stdenv.mkDerivation rec {
name = "mixxx-${version}";
- # read the version tag from git describe
- version = builtins.readFile (pkgs.runCommand "mixxversion" { } "${git}/bin/git -C ${./.} describe --dirty | tr -d '\n' > $out").out;
+ # 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"