Automatically include 'git describe' output in version text
This commit is contained in:
parent
40b2db580e
commit
2bb7537602
34
default.nix
34
default.nix
@ -3,7 +3,7 @@
|
||||
hostSystem ? buildSystem,
|
||||
pkgsNix ? (import ./nix/pkgs.nix),
|
||||
|
||||
revision ? "dev",
|
||||
revision ? null,
|
||||
releaseName ? "dev",
|
||||
}: let
|
||||
|
||||
@ -20,12 +20,22 @@
|
||||
|
||||
in rec {
|
||||
|
||||
version = pkgs.stdenv.mkDerivation {
|
||||
version = let
|
||||
revisionFile = if builtins.isNull revision
|
||||
then pkgsNative.stdenv.mkDerivation {
|
||||
name = "revision.txt";
|
||||
nativeBuildInputs = [ pkgsNative.git ];
|
||||
src = ./.git;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
git -c safe.directory='*' -C $src describe --tags > $out
|
||||
'';
|
||||
}
|
||||
else pkgsNative.writeText "revision.txt" revision;
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "isle-version";
|
||||
|
||||
inherit buildSystem hostSystem revision releaseName;
|
||||
|
||||
nativeBuildInputs = [ pkgsNative.git ];
|
||||
inherit buildSystem hostSystem revisionFile releaseName;
|
||||
|
||||
goVersion = pkgs.go.version;
|
||||
garageVersion = garageNix.version;
|
||||
@ -36,13 +46,13 @@ in rec {
|
||||
|
||||
versionFile=version
|
||||
|
||||
echo "Release: $releaseName" >> "$versionFile"
|
||||
echo "Platform: $hostSystem" >> "$versionFile"
|
||||
echo "Git Revision: $revision" >> "$versionFile"
|
||||
echo "Go Version: $goVersion" >> "$versionFile"
|
||||
echo "Garage Version: $garageVersion" >> "$versionFile"
|
||||
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
||||
echo "Build Platform: $buildSystem" >> "$versionFile"
|
||||
echo "Release: $releaseName" >> "$versionFile"
|
||||
echo "Platform: $hostSystem" >> "$versionFile"
|
||||
echo "Git Revision: $(cat $revisionFile)" >> "$versionFile"
|
||||
echo "Go Version: $goVersion" >> "$versionFile"
|
||||
echo "Garage Version: $garageVersion" >> "$versionFile"
|
||||
echo "NixPkgs Version: $nixpkgsVersion" >> "$versionFile"
|
||||
echo "Build Platform: $buildSystem" >> "$versionFile"
|
||||
|
||||
mkdir -p "$out"/share
|
||||
cp "$versionFile" "$out"/share
|
||||
|
Loading…
Reference in New Issue
Block a user