global/programming: refactor into options
This commit is contained in:
parent
60707813d7
commit
e2c9ed9d25
3 changed files with 156 additions and 105 deletions
|
@ -1,8 +1,8 @@
|
|||
{ lib }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (lib) mkOption types flatten;
|
||||
in
|
||||
{
|
||||
rec {
|
||||
mkOpt = type: default:
|
||||
mkOption { inherit type default; };
|
||||
|
||||
|
@ -20,4 +20,12 @@ in
|
|||
type = types.bool;
|
||||
example = true;
|
||||
};
|
||||
|
||||
coercedPackageList = with types;
|
||||
let
|
||||
packageListType = listOf (either package packageListType);
|
||||
in
|
||||
coercedTo packageListType flatten (listOf package);
|
||||
|
||||
packageListOpt = mkOpt coercedPackageList [ ];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue