Fix how revision is embedded so that AppImage isn't always recompiled

This commit is contained in:
Brian Picciano 2023-08-30 18:24:09 +02:00
parent e66f67da4a
commit 2876b56afb
3 changed files with 6 additions and 8 deletions

View File

@ -4,7 +4,7 @@
hostSystem ? buildSystem, hostSystem ? buildSystem,
pkgsNix ? (import ./nix/pkgs.nix), pkgsNix ? (import ./nix/pkgs.nix),
revision ? "", revision ? "dev",
releaseName ? "dev", releaseName ? "dev",
bootstrap ? null, bootstrap ? null,
@ -28,7 +28,6 @@ in rec {
name = "isle-version"; name = "isle-version";
inherit buildSystem hostSystem revision releaseName; inherit buildSystem hostSystem revision releaseName;
repoSrc = ./.;
nativeBuildInputs = [ pkgsNative.git ]; nativeBuildInputs = [ pkgsNative.git ];
@ -41,11 +40,6 @@ in rec {
versionFile=version versionFile=version
if [ "$revision" = "" ]; then
cp -r "$repoSrc" repoSrcCp
revision="$(cd repoSrcCp && git rev-parse HEAD)"
fi
echo "Release: $releaseName" >> "$versionFile" echo "Release: $releaseName" >> "$versionFile"
echo "Platform: $hostSystem" >> "$versionFile" echo "Platform: $hostSystem" >> "$versionFile"
echo "Git Revision: $revision" >> "$versionFile" echo "Git Revision: $revision" >> "$versionFile"

View File

@ -1,5 +1,6 @@
{ {
releaseName, releaseName,
revision,
buildSystem ? builtins.currentSystem, buildSystem ? builtins.currentSystem,
pkgsNix ? (import ./nix/pkgs.nix), pkgsNix ? (import ./nix/pkgs.nix),
@ -12,7 +13,7 @@
mkRelease = hostSystem: let mkRelease = hostSystem: let
appImage = ((import ./default.nix) { appImage = ((import ./default.nix) {
inherit buildSystem hostSystem releaseName; inherit buildSystem hostSystem releaseName revision;
}).appImage; }).appImage;
in pkgs.stdenv.mkDerivation { in pkgs.stdenv.mkDerivation {

View File

@ -19,7 +19,10 @@ if [ -e "$out" ]; then
exit 1 exit 1
fi fi
revision=$(git rev-parse HEAD)
result=$(nix-build \ result=$(nix-build \
--argstr revision "$revision" \
--argstr releaseName "$releaseName" \ --argstr releaseName "$releaseName" \
--no-out-link \ --no-out-link \
release.nix \ release.nix \