diff --git a/nix/package.nix b/nix/package.nix index af5d192c3..7e31864b7 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -19,9 +19,16 @@ stdenv.mkDerivation rec { ++ lib.optional (!bootstrap) [ idris2Bootstrap ]; buildInputs = [ chez gmp support ]; + # For bootstrap builds the Makefile will try to + # rebuild the support library if we don't patch + # bootstrap-install. prePatch = '' patchShebangs --build tests - sed 's/$(GIT_SHA1)/${srcRev}/' -i Makefile + substituteInPlace Makefile \ + --replace-fail '$(GIT_SHA1)' '${srcRev}' + '' + lib.optionalString bootstrap '' + substituteInPlace Makefile \ + --replace-fail 'bootstrap-install: install-idris2 install-support' 'bootstrap-install: install-idris2' ''; makeFlags = [ "IDRIS2_SUPPORT_DIR=${supportLibrariesPath}" ] diff --git a/nix/support.nix b/nix/support.nix index 5e20b6ed0..333537332 100644 --- a/nix/support.nix +++ b/nix/support.nix @@ -1,5 +1,8 @@ -{ stdenv, lib, gmp, idris2Version }: -stdenv.mkDerivation rec { +{ stdenv, lib, overrideSDK, gmp, idris2Version }: +let + stdenv' = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv; +in +stdenv'.mkDerivation rec { pname = "libidris2_support"; version = idris2Version; @@ -10,7 +13,7 @@ stdenv.mkDerivation rec { makeFlags = [ "PREFIX=$(out)" - ] ++ lib.optional stdenv.isDarwin "OS="; + ] ++ lib.optional stdenv'.isDarwin "OS="; buildFlags = [ "support" ];