diff --git a/pkgs/applications/science/logic/lean/default.nix b/pkgs/applications/science/logic/lean/default.nix index aa7fe5ab914..214f4e218fd 100644 --- a/pkgs/applications/science/logic/lean/default.nix +++ b/pkgs/applications/science/logic/lean/default.nix @@ -7,7 +7,11 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "leanprover-community"; repo = "lean"; - rev = "v${version}"; + # lean's version string contains the commit sha1 it was built + # from. this is then used to check whether an olean file should be + # rebuilt. don't use a tag as rev because this will get replaced into + # src/githash.h.in in preConfigure. + rev = "a5822ea47ebc52eec6323d8f1b60f6ec025daf99"; sha256 = "sha256-gJhbkl19iilNyfCt2TfPmghYA3yCjg6kS+yk/x/k14Y="; }; @@ -20,6 +24,13 @@ stdenv.mkDerivation rec { # library. doCheck = true; + preConfigure = assert builtins.stringLength src.rev == 40; '' + substituteInPlace src/githash.h.in \ + --subst-var-by GIT_SHA1 "${src.rev}" + substituteInPlace library/init/version.lean.in \ + --subst-var-by GIT_SHA1 "${src.rev}" + ''; + postPatch = "patchShebangs ."; postInstall = lib.optionalString stdenv.isDarwin ''