mirror of
https://github.com/nix-community/flakelight.git
synced 2024-11-21 23:13:09 +01:00
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
|
||||
|
14
default.nix
14
default.nix
@ -91,8 +91,18 @@ let
|
||||
|
||||
optListOf = elemType: coercedTo elemType singleton (listOf elemType);
|
||||
|
||||
optFunctionTo = elemType: coercedTo elemType (x: _: x)
|
||||
(functionTo elemType);
|
||||
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