diff --git a/pkgs/by-name/cr/crun/package.nix b/pkgs/by-name/cr/crun/package.nix index e815a5e40b5a..6c2fa30a251b 100644 --- a/pkgs/by-name/cr/crun/package.nix +++ b/pkgs/by-name/cr/crun/package.nix @@ -49,6 +49,12 @@ stdenv.mkDerivation (finalAttrs: { tag = finalAttrs.version; hash = "sha256-WBAwyDODMrUDlgonRbxaNQ+aN8K6YicY2JVArXDJem8="; fetchSubmodules = true; + leaveDotGit = true; + postFetch = '' + cd $out + git rev-parse HEAD > COMMIT + rm -rf .git + ''; }; nativeBuildInputs = [ @@ -77,10 +83,10 @@ stdenv.mkDerivation (finalAttrs: { # config.h with the correct values postPatch = '' echo ${finalAttrs.version} > .tarball-version - echo '#define GIT_VERSION "${finalAttrs.src.tag}"' > git-version.h + echo "#define GIT_VERSION \"$(cat COMMIT)\"" > git-version.h ${lib.concatMapStringsSep "\n" ( - e: "substituteInPlace Makefile.am --replace 'tests/${e}' ''" + e: "substituteInPlace Makefile.am --replace-fail 'tests/${e}' ''" ) disabledTests} '';