From a95582684d462d510db1408db1a7c4383f5034df Mon Sep 17 00:00:00 2001 From: sefidel Date: Wed, 21 Sep 2022 22:29:54 +0900 Subject: feat(home/modules): add allowInsecure option --- home/modules/programs/nixpkgs/default.nix | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'home/modules/programs/nixpkgs') diff --git a/home/modules/programs/nixpkgs/default.nix b/home/modules/programs/nixpkgs/default.nix index 92653a1..e20923f 100644 --- a/home/modules/programs/nixpkgs/default.nix +++ b/home/modules/programs/nixpkgs/default.nix @@ -1,7 +1,8 @@ { config, lib, ... }: let - allowed = config.nixpkgs.allowedUnfree; + allowedUnf = config.nixpkgs.allowedUnfree; + allowedIns = config.nixpkgs.allowedInsecure; in { @@ -9,12 +10,26 @@ in type = lib.types.listOf lib.types.string; default = [ ]; description = '' - Allows for unfree packages by their name. + Allows for unfree packages by their name. ''; }; + options.nixpkgs.allowedInsecure = lib.mkOption { + type = lib.types.listOf lib.types.string; + default = [ ]; + description = '' + Allows for insercure packages by their name. + ''; + }; + + config.nixpkgs.config.allowUnfreePredicate = - if (allowed == [ ]) + if (allowedUnf == [ ]) + then (_: false) + else (pkg: __elem (lib.getName pkg) allowedUnf); + + config.nixpkgs.config.allowInsecurePredicate = + if (allowedIns == [ ]) then (_: false) - else (pkg: __elem (lib.getName pkg) allowed); + else (pkg: __elem (lib.getName pkg) allowedIns); } -- cgit 1.4.1