mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-22 07:23:11 +01:00
Use submoduleWith instead of submodule
This results in not enabling shorthandOnlyDefinesConfig, allowing imports to be set in submodules. This can, for example, allow a devShell to import another devShell's config to extend it.
This commit is contained in:
parent
5fe9313894
commit
fe5916eb40
@ -8,16 +8,18 @@ let
|
|||||||
inherit (lib) defaultFunctor fix isFunction last mapAttrs mergeDefinitions
|
inherit (lib) defaultFunctor fix isFunction last mapAttrs mergeDefinitions
|
||||||
mkIf mkMerge mkOption mkOptionType;
|
mkIf mkMerge mkOption mkOptionType;
|
||||||
inherit (lib.types) coercedTo enum lazyAttrsOf
|
inherit (lib.types) coercedTo enum lazyAttrsOf
|
||||||
optionDescriptionPhrase pathInStore submodule;
|
optionDescriptionPhrase pathInStore submoduleWith;
|
||||||
inherit (flakelight.types) nullable optFunctionTo stringLike;
|
inherit (flakelight.types) nullable optFunctionTo stringLike;
|
||||||
|
|
||||||
isStorePath = s: match "${storeDir}/[^.][^ \n]*" s != null;
|
isStorePath = s: match "${storeDir}/[^.][^ \n]*" s != null;
|
||||||
|
|
||||||
app = submodule {
|
app = submoduleWith {
|
||||||
|
modules = [{
|
||||||
options = {
|
options = {
|
||||||
type = mkOption { type = enum [ "app" ]; default = "app"; };
|
type = mkOption { type = enum [ "app" ]; default = "app"; };
|
||||||
program = mkOption { type = pathInStore // { check = isStorePath; }; };
|
program = mkOption { type = pathInStore // { check = isStorePath; }; };
|
||||||
};
|
};
|
||||||
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
mkApp = name: pkgs: s:
|
mkApp = name: pkgs: s:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) filterAttrs functionArgs mapAttrs mkIf mkMerge mkOption;
|
inherit (lib) filterAttrs functionArgs mapAttrs mkIf mkMerge mkOption;
|
||||||
inherit (lib.types) coercedTo lazyAttrsOf lines listOf
|
inherit (lib.types) coercedTo lazyAttrsOf lines listOf
|
||||||
package str submodule;
|
package str submoduleWith;
|
||||||
inherit (flakelight) supportedSystem;
|
inherit (flakelight) supportedSystem;
|
||||||
inherit (flakelight.types) function nullable optCallWith optFunctionTo;
|
inherit (flakelight.types) function nullable optCallWith optFunctionTo;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ let
|
|||||||
|
|
||||||
devShellType = coercedTo function wrapFn
|
devShellType = coercedTo function wrapFn
|
||||||
(optFunctionTo (coercedTo package packageOverride
|
(optFunctionTo (coercedTo package packageOverride
|
||||||
(submodule devShellModule)));
|
(submoduleWith { modules = [ devShellModule ]; })));
|
||||||
|
|
||||||
genDevShell = pkgs: cfg:
|
genDevShell = pkgs: cfg:
|
||||||
if cfg.overrideShell != null then cfg.overrideShell
|
if cfg.overrideShell != null then cfg.overrideShell
|
||||||
|
@ -400,6 +400,14 @@ in
|
|||||||
})
|
})
|
||||||
(f: f ? devShells.x86_64-linux.default);
|
(f: f ? devShells.x86_64-linux.default);
|
||||||
|
|
||||||
|
devShells-import = test
|
||||||
|
(flakelight ./empty ({ config, ... }: {
|
||||||
|
devShell.inputsFrom = pkgs: [ pkgs.emacs ];
|
||||||
|
devShells.shell1 = pkgs: { imports = [ (config.devShell pkgs) ]; };
|
||||||
|
}))
|
||||||
|
(f: (lib.isDerivation f.devShells.x86_64-linux.default)
|
||||||
|
&& (lib.isDerivation f.devShells.x86_64-linux.shell1));
|
||||||
|
|
||||||
overlay = test
|
overlay = test
|
||||||
(flakelight ./empty {
|
(flakelight ./empty {
|
||||||
overlay = final: prev: { testValue = "hello"; };
|
overlay = final: prev: { testValue = "hello"; };
|
||||||
|
Loading…
Reference in New Issue
Block a user