refactor: centralize unfree package allowlists

Move all allowUnfreePredicate declarations to global configs to prevent
the "last definition wins" merging issue. Unfree packages are now managed
in two central locations:
- NixOS system packages: nixos/common/global/default.nix
- Home Manager packages: home-manager/sajenim/global/default.nix
This commit is contained in:
♥ Minnie ♥ 2025-10-01 10:23:20 +08:00
parent 34b4705d46
commit 591346600f
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
5 changed files with 27 additions and 21 deletions

View file

@ -37,14 +37,6 @@
])
]); # https://github.com/theCapypara/nix-jetbrains-plugins
# Allow unfree packages for proprietary software
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"claude-code"
"idea-ultimate"
"idea-ultimate-with-plugins"
];
# Copy our configuration files to home directory
home.file = {
".ideavimrc".source = ./ideavimrc;

View file

@ -1,4 +1,4 @@
{outputs, ...}: {
{outputs, lib, ...}: {
imports = [
./zsh.nix
];
@ -11,6 +11,19 @@
];
config = {
allowUnfree = false;
# Centralized unfree package allowlist.
# Note: nixpkgs.config.allowUnfreePredicate doesn't merge across modules - only the
# last definition wins. To maintain explicit control over unfree packages, we list
# all allowed packages here rather than scattering predicates across feature modules.
allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Editors
"claude-code"
"idea-ultimate"
"idea-ultimate-with-plugins"
# Desktop
"discord"
];
};
};

View file

@ -1,4 +1,4 @@
{outputs, ...}: {
{outputs, lib, ...}: {
imports = [
./age.nix
./env.nix
@ -15,6 +15,18 @@
];
config = {
allowUnfree = false;
# Centralized unfree package allowlist for NixOS system configuration.
# Note: nixpkgs.config.allowUnfreePredicate doesn't merge across modules - only the
# last definition wins. To maintain explicit control over unfree packages, we list
# all allowed packages here rather than scattering predicates across system modules.
allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
# Gaming
"steam"
"steam-unwrapped"
# Services
"minecraft-server"
];
};
};

View file

@ -27,10 +27,4 @@
"d /home/sajenim/.local 0755 sajenim users -"
"d /home/sajenim/.local/share 0755 sajenim users -"
];
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"steam"
"steam-unwrapped"
];
}

View file

@ -116,9 +116,4 @@ in {
}
];
};
# Allow unfree packages.
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"minecraft-server"
];
}