refactor(modules/lib): move more options to it
Some checks failed
/ check (push) Failing after 4s
/ check-renovaterc (push) Successful in 3s
/ build-packages (push) Has been skipped
/ build-vm (push) Has been skipped
/ report-size (push) Has been skipped

This should keep all my custom options in the same place.
This commit is contained in:
Jalil David Salamé Messina 2025-04-21 23:10:27 +02:00
parent e71ab67615
commit bb1b491abc
Signed by: jalil
GPG key ID: F016B9E770737A0B
3 changed files with 27 additions and 28 deletions

View file

@ -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";