nix-config/modules/unfree-packages.nix

27 lines
646 B
Nix
Raw Permalink Normal View History

{ 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
{
2025-08-31 21:47:12 +01:00
nixos.base.nixpkgs.config.allowUnfreePredicate = predicate;
homeManager.base = args: {
nixpkgs.config = lib.mkIf (!(args.hasGlobalPkgs or false)) {
allowUnfreePredicate = predicate;
};
};
};
meta.nixpkgs.allowedUnfreePackages = config.nixpkgs.allowedUnfreePackages;
};
}