wrapper-manager-fds/modules: add package installation option for common integration module

This commit is contained in:
Gabriel Arazas 2024-11-21 13:16:18 +08:00
parent 1542702317
commit 628952542e
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
3 changed files with 31 additions and 2 deletions

View File

@ -21,6 +21,17 @@ let
config._module.args.pkgs = lib.mkDefault pkgs;
}
)
(
{ lib, ... }: {
options.enableInstall = lib.mkOption {
type = lib.types.bool;
default = cfg.enableInstall;
description = "Install the package to the wider-scoped environment.";
example = false;
};
}
)
] ++ cfg.sharedModules;
};
in
@ -33,6 +44,17 @@ in
];
options.wrapper-manager = {
enableInstall = lib.mkOption {
type = lib.types.bool;
description = ''
Enable installing the package to the wider-scoped environment list
of packages. This is to be set as the default value of
{option}`enableInstall` in the wrapper-manager package environment.
'';
default = true;
example = false;
};
sharedModules = lib.mkOption {
type = with lib.types; listOf deferredModule;
default = [ ];

View File

@ -35,7 +35,11 @@ in
})
(lib.mkIf (cfg.packages != { }) {
home.packages = lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
home.packages =
let
validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages;
in
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages;
})
];
}

View File

@ -34,7 +34,10 @@ in
(lib.mkIf (cfg.packages != { }) {
environment.systemPackages =
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
let
validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages;
in
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages;
})
];
}