forked from extern/flakelight
Allow devShells to be directly set to derivations
This commit is contained in:
parent
610cc3b0c4
commit
360fd2099d
@ -439,7 +439,7 @@ To use the first example, but manually specify the package name:
|
||||
|
||||
```
|
||||
Type:
|
||||
devShell: Cfg | (Pkgs -> Cfg) | PackageDef
|
||||
devShell: Cfg | (Pkgs -> Cfg) | PackageDef | Derivation | (Pkgs -> Derivation)
|
||||
Cfg.packages: [Derivation] | (Pkgs -> [Derivation])
|
||||
Cfg.inputsFrom: [Derivation] | (Pkgs -> [Derivation])
|
||||
Cfg.shellHook: Str | (Pkgs -> Str)
|
||||
@ -451,11 +451,11 @@ The devshell options allow you to configure `devShells.${system}.default`. It is
|
||||
split up into options in order to enable multiple modules to contribute to its
|
||||
configuration.
|
||||
|
||||
`devShell` can alternatively be set to a package definition, which is then used
|
||||
as the default shell, overriding other options.
|
||||
`devShell` can alternatively be set to a package definition or derivation, which
|
||||
is then used as the default shell, overriding other options.
|
||||
|
||||
`devShell` can also be set to a function that takes the package set and returns
|
||||
an attrSet of the devShell configuration options.
|
||||
an attrSet of the devShell configuration options or a derivation.
|
||||
|
||||
The options available are as follows:
|
||||
|
||||
|
@ -47,10 +47,13 @@ let
|
||||
let val = pkgs.callPackage fn { }; in
|
||||
if (functionArgs fn == { }) || !(package.check val)
|
||||
then fn pkgs
|
||||
else { overrideShell = val; };
|
||||
else val;
|
||||
|
||||
packageOverride = p: { overrideShell = p; };
|
||||
|
||||
devShellType = coercedTo function wrapFn
|
||||
(optFunctionTo (submodule devShellModule));
|
||||
(optFunctionTo (coercedTo package packageOverride
|
||||
(submodule devShellModule)));
|
||||
|
||||
genDevShell = pkgs: cfg:
|
||||
if cfg.overrideShell != null then cfg.overrideShell
|
||||
|
@ -324,13 +324,13 @@ in
|
||||
})
|
||||
(f: lib.isDerivation f.devShells.x86_64-linux.default);
|
||||
|
||||
devShell-override = test
|
||||
devShell-pkgDef = test
|
||||
(flakelight ./empty {
|
||||
devShell = { mkShell }: mkShell { };
|
||||
})
|
||||
(f: lib.isDerivation f.devShells.x86_64-linux.default);
|
||||
|
||||
devShell-override-empty = test
|
||||
devShell-pkgDef-empty = test
|
||||
(flakelight ./empty {
|
||||
disabledModules = [ "builtinFormatters.nix" ];
|
||||
devShell = { mkShell }: mkShell { };
|
||||
@ -365,6 +365,19 @@ in
|
||||
})
|
||||
(f: lib.isDerivation f.devShells.x86_64-linux.default);
|
||||
|
||||
devShell-pkg = test
|
||||
(flakelight ./empty ({ inputs, ... }: {
|
||||
systems = [ "x86_64-linux" ];
|
||||
devShell = inputs.nixpkgs.legacyPackages.x86_64-linux.hello;
|
||||
}))
|
||||
(f: lib.isDerivation f.devShells.x86_64-linux.default);
|
||||
|
||||
devShell-pkg-fn = test
|
||||
(flakelight ./empty {
|
||||
devShell = pkgs: pkgs.hello;
|
||||
})
|
||||
(f: lib.isDerivation f.devShells.x86_64-linux.default);
|
||||
|
||||
devShells = test
|
||||
(flakelight ./empty {
|
||||
devShell.inputsFrom = pkgs: [ pkgs.emacs ];
|
||||
|
Loading…
Reference in New Issue
Block a user