about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-09-21 22:29:54 +0900
committersefidel <contact@sefidel.net>2022-09-21 22:37:53 +0900
commita95582684d462d510db1408db1a7c4383f5034df (patch)
tree45dc9d9b7a90766f48231d80c204215e6b3c57df
parent4afda11dfe3897cd452a3a392906837da388a796 (diff)
downloadnixrc-a95582684d462d510db1408db1a7c4383f5034df.tar.gz
nixrc-a95582684d462d510db1408db1a7c4383f5034df.zip
feat(home/modules): add allowInsecure option
-rw-r--r--home/modules/programs/nixpkgs/default.nix23
1 files changed, 19 insertions, 4 deletions
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);
 }