treewide: add and use option nixowos.allowAddingPackages

This commit is contained in:
Elec3137 2026-03-23 21:17:09 -07:00
commit b91af8f6f7
5 changed files with 20 additions and 11 deletions

View file

@ -1,4 +1,5 @@
{
lib,
...
}:
@ -7,4 +8,8 @@
./defaults
./nvidia.nix
];
options.nixowos = {
allowAddingPackages = lib.mkEnableOption "adding to `environment.systemPackages`";
};
}

View file

@ -25,9 +25,11 @@ in
# source: https://nix.dev/manual/nix/2.26/command-ref/new-cli/nix3-store-optimise
nix.settings.auto-optimise-store = true;
environment.systemPackages = with pkgs; [
nixd
nixfmt
];
environment.systemPackages =
with pkgs;
lib.mkIf config.nixowos.allowAddingPackages [
nixd
nixfmt
];
};
}

View file

@ -26,11 +26,13 @@ in
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
kdePackages.plasma-keyboard
kdePackages.qtvirtualkeyboard
wl-clipboard
];
environment.systemPackages =
with pkgs;
lib.mkIf config.nixowos.allowAddingPackages [
kdePackages.plasma-keyboard
kdePackages.qtvirtualkeyboard
wl-clipboard
];
environment.interactiveShellInit =
lib.mkIf cfg.startOnFirstTTY

View file

@ -61,7 +61,7 @@ in
nixos-rebuild = /* sh */ "nixos-rebuild --ask-sudo-password";
};
environment.systemPackages = cfg.extraPackages;
environment.systemPackages = lib.mkIf config.nixowos.allowAddingPackages cfg.extraPackages;
# enter dev env on cd
programs.direnv = lib.mkDefault {

View file

@ -23,7 +23,7 @@ in
config = lib.mkIf cfg.enable {
environment.systemPackages = cfg.extraPackages;
environment.systemPackages = lib.mkIf config.nixowos.allowAddingPackages cfg.extraPackages;
boot.loader.grub = lib.mkDefault {
# modern installation