From 5c57ab39aa564035888c79607110bb91b3a2e6aa Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Tue, 24 Sep 2024 20:27:17 -0700 Subject: [PATCH] docs: document how to override mkShell/stdenv for devShell (#709) --- docs/API.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/API.md b/docs/API.md index f7e2501e..707df739 100644 --- a/docs/API.md +++ b/docs/API.md @@ -917,6 +917,25 @@ craneLib.devShell { } ``` +Note that it is possible to override the underlying `mkShell` (for example to +customize the build environment further) like so: + +```nix +let + moldDevShell = craneLib.devShell.override { + # For example, use the mold linker + mkShell = pkgs.mkShell.override { + stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv; + }; + }; +in +moldDevShell { + packages = [ + # etc... + ]; +} +``` + ### `craneLib.downloadCargoPackage` `downloadCargoPackage :: set -> drv`