Skip to content

How can I use nixpkgs.stdenvAdapters.useMoldLinker with craneLib.devShell? #703

Answered by ipetkov
muni-corn asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @muni-corn! Two insights which might be helpful here:

  1. craneLib.devShell is basically a shortcut for including rustc/cargo/clippy/rustfmt from the toolchain declaration but it isn't strictly required; you can always use pkgs.mkShell directly (and pull in the toolchain override [if any] in there)
  2. craneLib.devShell takes a mkShell input, so in theory you could override it like so:
devShells.default = (craneLib.devShell.override {
  mkShell = pkgs.mkShell.override {
    stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
  };
}) {
  packages = [ /* ... */ ];
};

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@muni-corn
Comment options

@ipetkov
Comment options

Answer selected by muni-corn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants