diff --git a/flake.lock b/flake.lock index 56dd1d86..c9efb4ee 100644 --- a/flake.lock +++ b/flake.lock @@ -42,11 +42,11 @@ "crane": { "flake": false, "locked": { - "lastModified": 1661875961, - "narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=", + "lastModified": 1670284777, + "narHash": "sha256-JF0pc0s4z/X+Iy+lNHOwUQ8I5bz+q7uX4HrKTNIEj24=", "owner": "ipetkov", "repo": "crane", - "rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24", + "rev": "2243fb9c872de25cb564a02d324ea6a5b9853052", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0edbf802..9406229d 100644 --- a/flake.nix +++ b/flake.nix @@ -114,12 +114,12 @@ "lib/mkCargoDerivation.nix" "lib/mkDummySrc.nix" "lib/writeTOML.nix" - "pkgs/cargoHelperFunctions.sh" - "pkgs/configureCargoCommonVarsHook.sh" - "pkgs/configureCargoVendoredDepsHook.sh" - "pkgs/installFromCargoBuildLogHook.sh" - "pkgs/inheritCargoArtifactsHook.sh" - "pkgs/installCargoArtifactsHook.sh" + "lib/setupHooks/cargoHelperFunctionsHook.sh" + "lib/setupHooks/configureCargoCommonVarsHook.sh" + "lib/setupHooks/configureCargoVendoredDepsHook.sh" + "lib/setupHooks/installFromCargoBuildLogHook.sh" + "lib/setupHooks/inheritCargoArtifactsHook.sh" + "lib/setupHooks/installCargoArtifactsHook.sh" "LICENSE" ]; devshell = [ diff --git a/src/modules/externals/implementation.nix b/src/modules/externals/implementation.nix index fc31cf05..639010cd 100644 --- a/src/modules/externals/implementation.nix +++ b/src/modules/externals/implementation.nix @@ -14,7 +14,7 @@ in { makeHook = attrs: name: pkgs.makeSetupHook ({inherit name;} // attrs) - "${externalSources.crane}/pkgs/${name}.sh"; + "${externalSources.crane}/lib/setupHooks/${name}.sh"; genHooks = names: attrs: l.genAttrs names (makeHook attrs); in { @@ -23,9 +23,10 @@ in { }: rec { otherHooks = genHooks [ - "cargoHelperFunctions" + "cargoHelperFunctionsHook" "configureCargoCommonVarsHook" "configureCargoVendoredDepsHook" + "removeReferencesToVendoredSourcesHook" ] {}; installHooks = @@ -63,7 +64,7 @@ in { mkCargoDerivation = importLibFile "mkCargoDerivation" { cargo = cargoHostTarget; - inherit (pkgs) stdenv lib; + inherit (pkgs) stdenv zstd; inherit (installHooks) inheritCargoArtifactsHook @@ -73,8 +74,9 @@ in { (otherHooks) configureCargoCommonVarsHook configureCargoVendoredDepsHook + cargoHelperFunctionsHook ; - cargoHelperFunctionsHook = otherHooks.cargoHelperFunctions; + inherit crateNameFromCargoToml vendorCargoDeps; }; buildDepsOnly = importLibFile "buildDepsOnly" { inherit @@ -84,18 +86,16 @@ in { mkDummySrc ; }; - cargoBuild = importLibFile "cargoBuild" { + buildPackage = importLibFile "buildPackage" { + inherit (pkgs) lib jq; + inherit (installLogHook) installFromCargoBuildLogHook; inherit - mkCargoDerivation buildDepsOnly crateNameFromCargoToml vendorCargoDeps + mkCargoDerivation ; - }; - buildPackage = importLibFile "buildPackage" { - inherit (pkgs) removeReferencesTo lib; - inherit (installLogHook) installFromCargoBuildLogHook; - inherit cargoBuild; + inherit (otherHooks) removeReferencesToVendoredSourcesHook; }; }; }; diff --git a/src/subsystems/rust/builders/crane/default.nix b/src/subsystems/rust/builders/crane/default.nix index e6d040fd..289be9ac 100644 --- a/src/subsystems/rust/builders/crane/default.nix +++ b/src/subsystems/rust/builders/crane/default.nix @@ -57,9 +57,6 @@ src = utils.getRootSource pname version; cargoVendorDir = "./nix-vendor"; - # this is needed because remove-references-to doesn't work on non nix-store paths - doNotRemoveReferencesToVendorDir = true; - postUnpack = '' export CARGO_HOME=$(pwd)/.cargo_home '';