Skip to content

Commit

Permalink
Merge pull request rustshop#91 from dpc/fix-shell-hook
Browse files Browse the repository at this point in the history
 fix: mkDevShell to preserve args.shellHook
  • Loading branch information
dpc committed Oct 17, 2023
2 parents cc6b667 + 0652369 commit 8f6d990
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/crane/enhance.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
let lib = pkgs.lib; in craneLib:
craneLib.overrideScope' (self: prev: {
cargoProfile = "release";
toolchainName = null;

args = {
# https://github.com/ipetkov/crane/issues/76#issuecomment-1296025495
installCargoArtifactsMode = "use-zstd";
Expand Down Expand Up @@ -133,9 +135,10 @@ craneLib.overrideScope' (self: prev: {
overrideArgsDepsOnly' = f: self.overrideScope' (self: prev: { argsDepsOnly = prev.argsDepsOnly // f prev.argsDepsOnly; });
overrideArgsDepsOnly'' = f: self.overrideScope' (self: prev: { argsDepsOnly = prev.argsDepsOnly // f self prev.argsDepsOnly; });
overrideProfile = cargoProfile: self.overrideScope' (self: prev: { inherit cargoProfile; });
overrideToolchainName = toolchainName: self.overrideScope' (self: prev: { inherit toolchainName; });
mapWithProfiles = f: profiles: builtins.listToAttrs (builtins.map (cargoProfile: { name = cargoProfile; value = f (self.overrideProfile cargoProfile); }) profiles);
mapWithToolchains = f: toolchains: builtins.mapAttrs
(toolchainName: toolchain: f (self.overrideArgs ({ inherit toolchainName; } // toolchain.args)))
(toolchainName: toolchain: f ((self.overrideToolchainName toolchainName).overrideArgs toolchain.args))
toolchains;
mapWithToolchains' = f: toolchains: builtins.mapAttrs
(toolchainName: toolchain: f toolchainName (self.overrideArgs ({ inherit toolchainName; } // toolchain.args)))
Expand Down
2 changes: 2 additions & 0 deletions lib/mkDevShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ let
fi
flakebox init
${cleanedArgs.shellHook or ""}
'';
};
in
Expand Down

0 comments on commit 8f6d990

Please sign in to comment.