diff --git a/modules/env/common.nix b/modules/env/common.nix index 8f25343..5b263ab 100644 --- a/modules/env/common.nix +++ b/modules/env/common.nix @@ -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 = [ ]; diff --git a/modules/env/home-manager/default.nix b/modules/env/home-manager/default.nix index daa409f..e7cab63 100644 --- a/modules/env/home-manager/default.nix +++ b/modules/env/home-manager/default.nix @@ -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; }) ]; } diff --git a/modules/env/nixos/default.nix b/modules/env/nixos/default.nix index cb618d2..8d8572c 100644 --- a/modules/env/nixos/default.nix +++ b/modules/env/nixos/default.nix @@ -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; }) ]; }