forked from extern/flakelight
Allow overriding of default devShell
This sets the default devShell using mkDefault, letting user set default shells override it. Previously, to set a different default shell, one would have to not set any of the devShell.* options and then define devShells.default, or use mkForce.
This commit is contained in:
parent
fad306c589
commit
e401f68030
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
{ config, lib, flakelight, ... }:
|
{ config, lib, flakelight, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) any attrValues filterAttrs mapAttrs mkIf mkMerge mkOption
|
inherit (lib) any attrValues filterAttrs mapAttrs mkDefault mkIf mkMerge
|
||||||
optionalAttrs;
|
mkOption optionalAttrs;
|
||||||
inherit (lib.types) lazyAttrsOf functionTo lines listOf nullOr package str;
|
inherit (lib.types) lazyAttrsOf functionTo lines listOf nullOr package str;
|
||||||
inherit (flakelight) supportedSystem;
|
inherit (flakelight) supportedSystem;
|
||||||
inherit (flakelight.types) optFunctionTo packageDef;
|
inherit (flakelight.types) optFunctionTo packageDef;
|
||||||
@ -45,7 +45,7 @@ in
|
|||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
(mkIf (any (x: x != null) (attrValues config.devShell)) {
|
(mkIf (any (x: x != null) (attrValues config.devShell)) {
|
||||||
devShells.default = { pkgs, mkShell }: mkShell (
|
devShells.default = mkDefault ({ pkgs, mkShell }: mkShell (
|
||||||
optionalAttrs (config.devShell.env != null)
|
optionalAttrs (config.devShell.env != null)
|
||||||
(config.devShell.env pkgs)
|
(config.devShell.env pkgs)
|
||||||
// optionalAttrs (config.devShell.inputsFrom != null) {
|
// optionalAttrs (config.devShell.inputsFrom != null) {
|
||||||
@ -57,7 +57,7 @@ in
|
|||||||
// optionalAttrs (config.devShell.shellHook != null) {
|
// optionalAttrs (config.devShell.shellHook != null) {
|
||||||
shellHook = config.devShell.shellHook pkgs;
|
shellHook = config.devShell.shellHook pkgs;
|
||||||
}
|
}
|
||||||
);
|
));
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (config.devShells != { }) {
|
(mkIf (config.devShells != { }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user