global/programming: refactor into options

This commit is contained in:
Infinidoge 2024-12-03 14:39:26 -05:00
parent 60707813d7
commit e2c9ed9d25
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A
3 changed files with 156 additions and 105 deletions

View file

@ -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 [ ];
}