From be8bb660dc473630db25d5b5ef2fcc1caac36796 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Tue, 26 Nov 2024 22:47:32 +0000 Subject: [PATCH] modules/autoUnfree: allow to configure additional allowed names --- nix/nixos-modules/autoUnfree.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/nix/nixos-modules/autoUnfree.nix b/nix/nixos-modules/autoUnfree.nix index ab193df..ffdaf7d 100644 --- a/nix/nixos-modules/autoUnfree.nix +++ b/nix/nixos-modules/autoUnfree.nix @@ -32,6 +32,21 @@ in by using the option{x-banananetwork.autoUnfree.packages} option. ''; + names = lib.mkOption { + description = '' + Lists all package names which should be allowed to be installed + despite of them being unfree. + Only works when option{x-banananetwork.autoUnfree.enable} is set to true. + + This option is mainly intended to be used by other module developers + to add support for this on their own. + + Users may also use this additionally allow packages on their own. + ''; + type = lib.types.listOf lib.types.str; + default = [ ]; + }; + packages = lib.mkOption { description = '' Lists all packages which should be allowed to be installed @@ -63,7 +78,11 @@ in nixpkgs.config = { - allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) (map lib.getName cfg.packages); + allowUnfreePredicate = + let + names = cfg.names ++ (map lib.getName cfg.packages); + in + pkg: builtins.elem (lib.getName pkg) names; };