forked from extern/flakelight
Allow using optFunctionTo on types with submodules
This commit is contained in:
parent
3304eb3746
commit
41ec64361f
@ -5,7 +5,7 @@
|
||||
{ config, lib, flakelight, genSystems, moduleArgs, ... }:
|
||||
let
|
||||
inherit (lib) filterAttrs functionArgs mapAttrs mkIf mkMerge mkOption;
|
||||
inherit (lib.types) attrs coercedTo functionTo lazyAttrsOf lines listOf
|
||||
inherit (lib.types) coercedTo lazyAttrsOf lines listOf
|
||||
package str submodule;
|
||||
inherit (flakelight) supportedSystem;
|
||||
inherit (flakelight.types) function nullable optCallWith optFunctionTo;
|
||||
@ -50,8 +50,7 @@ let
|
||||
else { overrideShell = val; };
|
||||
|
||||
devShellType = coercedTo function wrapFn
|
||||
(coercedTo attrs (x: _: x)
|
||||
(functionTo (submodule devShellModule)));
|
||||
(optFunctionTo (submodule devShellModule));
|
||||
|
||||
genDevShell = pkgs: cfg:
|
||||
if cfg.overrideShell != null then cfg.overrideShell
|
||||
|
12
default.nix
12
default.nix
@ -91,7 +91,17 @@ let
|
||||
|
||||
optListOf = elemType: coercedTo elemType singleton (listOf elemType);
|
||||
|
||||
optFunctionTo = elemType: coercedTo elemType (x: _: x)
|
||||
optFunctionTo =
|
||||
let
|
||||
nonFunction = mkOptionType {
|
||||
name = "nonFunction";
|
||||
description = "non-function";
|
||||
descriptionClass = "noun";
|
||||
check = x: ! isFunction x;
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
in
|
||||
elemType: coercedTo nonFunction (x: _: x)
|
||||
(functionTo elemType);
|
||||
|
||||
optCallWith = args: elemType: coercedTo function (x: x args) elemType;
|
||||
|
Loading…
Reference in New Issue
Block a user