refactor(modules/lib): move more options to it
This should keep all my custom options in the same place.
This commit is contained in:
parent
e71ab67615
commit
bb1b491abc
3 changed files with 27 additions and 28 deletions
|
@ -1,7 +1,8 @@
|
|||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
osConfig = attrs.osConfig or null;
|
||||
inherit (lib) types;
|
||||
inherit (import ../lib.nix { inherit lib; }) mkExtraPackagesOption;
|
||||
osConfig = attrs.osConfig or null;
|
||||
fromOs =
|
||||
let
|
||||
get =
|
||||
|
@ -11,22 +12,6 @@ let
|
|||
path: default: if osConfig == null then default else get path osConfig;
|
||||
fromConfig = path: default: fromOs ([ "jconfig" ] ++ path) default;
|
||||
|
||||
mkExtraPackagesOption =
|
||||
name: defaultPkgsPath:
|
||||
let
|
||||
text = lib.strings.concatMapStringsSep " " (
|
||||
pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)
|
||||
) defaultPkgsPath;
|
||||
defaultText = lib.literalExpression "[ ${text} ]";
|
||||
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
|
||||
in
|
||||
lib.mkOption {
|
||||
description = "Extra ${name} Packages.";
|
||||
type = types.listOf types.package;
|
||||
inherit default defaultText;
|
||||
example = [ ];
|
||||
};
|
||||
|
||||
identity.options = {
|
||||
email = lib.mkOption {
|
||||
description = "Primary email address";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue