2019-04-24 15:05:29 +08:00
|
|
|
{ stdenv, git, fetchgit }:
|
|
|
|
let
|
|
|
|
artiq-version = stdenv.mkDerivation {
|
|
|
|
name = "artiq-version";
|
|
|
|
src = import ./artiq-src.nix { inherit fetchgit; };
|
|
|
|
buildPhase = ''
|
|
|
|
REV=`${git}/bin/git rev-parse HEAD`
|
2019-06-13 14:05:30 +08:00
|
|
|
MAJOR_VERSION=`cat MAJOR_VERSION`
|
2019-11-14 16:56:36 +08:00
|
|
|
if [ -e BETA ]; then
|
|
|
|
SUFFIX=".beta"
|
|
|
|
else
|
|
|
|
SUFFIX=""
|
|
|
|
fi
|
2019-06-13 14:05:30 +08:00
|
|
|
COMMIT_COUNT=`${git}/bin/git rev-list --count HEAD`
|
2019-04-24 15:05:29 +08:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
2019-11-14 16:56:36 +08:00
|
|
|
echo -n $MAJOR_VERSION.$COMMIT_COUNT.`cut -c1-8 <<< $REV`$SUFFIX > $out
|
2019-04-24 15:05:29 +08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
builtins.readFile artiq-version
|