mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 11:20:10 +00:00
mkShell: Control devShell and override prompt
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
stdenv,
|
||||
buildEnv,
|
||||
devShellTools,
|
||||
}:
|
||||
|
||||
# A special kind of derivation that is only meant to be consumed by the
|
||||
@@ -16,6 +17,7 @@
|
||||
nativeBuildInputs ? [ ],
|
||||
propagatedBuildInputs ? [ ],
|
||||
propagatedNativeBuildInputs ? [ ],
|
||||
passthru ? { },
|
||||
...
|
||||
}@attrs:
|
||||
let
|
||||
@@ -42,6 +44,7 @@ let
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (
|
||||
finalAttrs:
|
||||
{
|
||||
inherit name;
|
||||
|
||||
@@ -68,6 +71,33 @@ stdenv.mkDerivation (
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
passthru = {
|
||||
devShell =
|
||||
let
|
||||
inherit (finalAttrs.finalPackage) drvAttrs;
|
||||
in
|
||||
devShellTools.buildShellEnv {
|
||||
inherit drvAttrs;
|
||||
|
||||
# The default prefix is "build shell", but this shell is not derived
|
||||
# directly from a derivation, so we set a more generic title.
|
||||
promptPrefix = "nix";
|
||||
|
||||
# Change the default name
|
||||
promptName =
|
||||
if
|
||||
# name was passed originally
|
||||
attrs ? name
|
||||
# or with overrideAttrs
|
||||
|| drvAttrs.name != "nix-shell"
|
||||
then
|
||||
null
|
||||
else
|
||||
"mkShell";
|
||||
};
|
||||
}
|
||||
// passthru;
|
||||
}
|
||||
// rest
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user