nix-config/modules2/unfree-packages.nix
Oliver Davies 99484c6194
All checks were successful
/ check (push) Successful in 1m53s
refactor: explicitly allow unfree packages
2025-07-29 01:14:01 +01:00

26 lines
653 B
Nix

{ config, lib, ... }:
{
options.nixpkgs.allowedUnfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
config.flake = {
modules =
let
predicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfreePackages;
in
{
nixos.workstation.nixpkgs.config.allowUnfreePredicate = predicate;
homeManager.base = args: {
nixpkgs.config = lib.mkIf (!(args.hasGlobalPkgs or false)) {
allowUnfreePredicate = predicate;
};
};
};
meta.nixpkgs.allowedUnfreePackages = config.nixpkgs.allowedUnfreePackages;
};
}