about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--home/modules/programs/nixpkgs/default.nix35
-rw-r--r--home/profiles/base/default.nix2
-rw-r--r--home/profiles/communication/default.nix2
-rw-r--r--home/profiles/creative/default.nix2
-rw-r--r--home/profiles/gaming/default.nix2
-rw-r--r--home/profiles/multimedia/default.nix2
-rw-r--r--home/profiles/research/default.nix2
-rw-r--r--lib/mk_system.nix2
-rw-r--r--modules/nix.nix17
-rw-r--r--modules/nixpkgs.nix34
-rw-r--r--nixos/alpha/configuration.nix2
-rw-r--r--nixos/haruka/configuration.nix2
12 files changed, 48 insertions, 56 deletions
diff --git a/home/modules/programs/nixpkgs/default.nix b/home/modules/programs/nixpkgs/default.nix
deleted file mode 100644
index 3220844..0000000
--- a/home/modules/programs/nixpkgs/default.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ config, lib, ... }:
-
-let
-  allowedUnf = config.nixpkgs.allowedUnfree;
-  allowedIns = config.nixpkgs.allowedInsecure;
-in
-
-{
-  options.nixpkgs.allowedUnfree = lib.mkOption {
-    type = lib.types.listOf lib.types.str;
-    default = [ ];
-    description = ''
-      Allows for unfree packages by their name.
-    '';
-  };
-
-  options.nixpkgs.allowedInsecure = lib.mkOption {
-    type = lib.types.listOf lib.types.str;
-    default = [ ];
-    description = ''
-      Allows for insercure packages by their name.
-    '';
-  };
-
-
-  config.nixpkgs.config.allowUnfreePredicate =
-    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) allowedIns);
-}
diff --git a/home/profiles/base/default.nix b/home/profiles/base/default.nix
index f654bd4..7405aac 100644
--- a/home/profiles/base/default.nix
+++ b/home/profiles/base/default.nix
@@ -6,7 +6,7 @@ let
 in
 {
   imports = [
-    ../../modules/programs/nixpkgs
+    ../../../modules/nixpkgs.nix
     ../../modules/programs/zshell
     #../../modules/programs/zellij
   ];
diff --git a/home/profiles/communication/default.nix b/home/profiles/communication/default.nix
index 32dbb72..d257c8d 100644
--- a/home/profiles/communication/default.nix
+++ b/home/profiles/communication/default.nix
@@ -17,7 +17,7 @@ let
   fixSopsPrefix = x: y: builtins.replaceStrings [ "%r" ] [ "/run/user/${toString x}" ] y;
 in
 {
-  imports = [ ../../modules/programs/nixpkgs ];
+  imports = [ ../../../modules/nixpkgs.nix ];
 
   options.profiles.communication = {
     enable = lib.mkEnableOption
diff --git a/home/profiles/creative/default.nix b/home/profiles/creative/default.nix
index 60c8ce2..a119a8f 100644
--- a/home/profiles/creative/default.nix
+++ b/home/profiles/creative/default.nix
@@ -3,7 +3,7 @@ let cfg = config.profiles.creative;
 in
 {
   imports = [
-    ../../modules/programs/nixpkgs
+    ../../../modules/nixpkgs.nix
   ];
 
   options.profiles.creative = {
diff --git a/home/profiles/gaming/default.nix b/home/profiles/gaming/default.nix
index 403f0dd..9885fac 100644
--- a/home/profiles/gaming/default.nix
+++ b/home/profiles/gaming/default.nix
@@ -3,7 +3,7 @@ let
   cfg = config.profiles.gaming;
 in
 {
-  imports = [ ../../modules/programs/nixpkgs ];
+  imports = [ ../../../modules/nixpkgs.nix ];
 
   options.profiles.gaming = {
     enable = lib.mkEnableOption
diff --git a/home/profiles/multimedia/default.nix b/home/profiles/multimedia/default.nix
index 2159eb2..b6c645f 100644
--- a/home/profiles/multimedia/default.nix
+++ b/home/profiles/multimedia/default.nix
@@ -3,7 +3,7 @@ let cfg = config.profiles.multimedia;
 in
 {
   imports = [
-    ../../modules/programs/nixpkgs
+    ../../../modules/nixpkgs.nix
   ];
 
   options.profiles.multimedia = {
diff --git a/home/profiles/research/default.nix b/home/profiles/research/default.nix
index 06fb14f..12afc0b 100644
--- a/home/profiles/research/default.nix
+++ b/home/profiles/research/default.nix
@@ -3,7 +3,7 @@ let
   cfg = config.profiles.research;
 in
 {
-  imports = [ ../../modules/programs/nixpkgs ];
+  imports = [ ../../../modules/nixpkgs.nix ];
 
   options.profiles.research = {
     enable = lib.mkEnableOption
diff --git a/lib/mk_system.nix b/lib/mk_system.nix
index a1a4eab..54dddbe 100644
--- a/lib/mk_system.nix
+++ b/lib/mk_system.nix
@@ -21,8 +21,10 @@ nixpkgs.lib.nixosSystem (
       }
       entryPoint
       hardware
+      # TODO: import all modules (use mapModules?)
       ../modules/flakes.nix
       ../modules/nix.nix
+      ../modules/nixpkgs.nix
     ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; }
     ++ nixpkgs.lib.optionals (extraModules != null) extraModules;
   }
diff --git a/modules/nix.nix b/modules/nix.nix
index 8396739..37c9fe5 100644
--- a/modules/nix.nix
+++ b/modules/nix.nix
@@ -1,8 +1,5 @@
 { config, lib, ... }:
 
-let
-  allowed = config.nix.allowedUnfree;
-in
 {
   options.nix = {
     experimentalFeatures = lib.mkOption {
@@ -12,19 +9,13 @@ in
         Enables experimental features
       '';
     };
-
-    allowedUnfree = lib.mkOption {
-      type = lib.types.listOf lib.types.str;
-      default = [ ];
-      description = ''
-        Allows for  unfree packages by their name.
-      '';
-    };
   };
 
   config = lib.mkMerge [
-    (lib.mkIf (config.nix.experimentalFeatures != "") { nix.extraOptions = "experimental-features = ${config.nix.experimentalFeatures}"; })
-    (lib.mkIf (allowed != [ ]) { nixpkgs.config.allowUnfreePredicate = (pkg: __elem (lib.getName pkg) allowed); })
+    (lib.mkIf
+      (config.nix.experimentalFeatures != "")
+      { nix.extraOptions = "experimental-features = ${config.nix.experimentalFeatures}"; })
+
     { nix.settings.auto-optimise-store = lib.mkDefault true; }
     {
       nix.gc.automatic = lib.mkDefault true;
diff --git a/modules/nixpkgs.nix b/modules/nixpkgs.nix
new file mode 100644
index 0000000..1e55876
--- /dev/null
+++ b/modules/nixpkgs.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+let
+  allowedUnf = config.nixpkgs.allowedUnfree;
+  allowedIns = config.nixpkgs.allowedInsecure;
+in
+{
+  options.nixpkgs = {
+    allowedUnfree = lib.mkOption {
+      type = lib.types.listOf lib.types.str;
+      default = [ ];
+      description = ''
+        Allows for unfree packages by their name.
+      '';
+    };
+
+    allowedInsecure = lib.mkOption {
+      type = lib.types.listOf lib.types.str;
+      default = [ ];
+      description = ''
+        Allows for insecure packages by their name.
+      '';
+    };
+  };
+
+  config = lib.mkMerge [
+    (lib.mkIf
+      (allowedUnf != [ ])
+      { nixpkgs.config.allowUnfreePredicate = (pkg: __elem (lib.getName pkg) allowedUnf); })
+    (lib.mkIf
+      (allowedIns != [ ])
+      { nixpkgs.config.allowInsecurePredicate = (pkg: __elem (lib.getName pkg) allowedIns); })
+  ];
+}
diff --git a/nixos/alpha/configuration.nix b/nixos/alpha/configuration.nix
index e825636..4129f8d 100644
--- a/nixos/alpha/configuration.nix
+++ b/nixos/alpha/configuration.nix
@@ -306,7 +306,7 @@
     remotePlay.openFirewall = true;
     dedicatedServer.openFirewall = true;
   };
-  nix.allowedUnfree = [ "steam" "steam-original" "steam-run" ];
+  nixpkgs.allowedUnfree = [ "steam" "steam-original" "steam-run" ];
 
   environment.sessionVariables = {
     WLR_NO_HARDWARE_CURSORS = "1"; # Prevent cursors disappearing on nouveau
diff --git a/nixos/haruka/configuration.nix b/nixos/haruka/configuration.nix
index 4182f2d..af27356 100644
--- a/nixos/haruka/configuration.nix
+++ b/nixos/haruka/configuration.nix
@@ -21,7 +21,7 @@
   # TODO: broken >=6.6
   services.xserver.videoDrivers = [ "intel" /* "displaylink" */];
 
-  nix.allowedUnfree = [ "displaylink" ];
+  nixpkgs.allowedUnfree = [ "displaylink" ];
 
   boot.initrd.supportedFilesystems = [ "zfs" ];
   boot.supportedFilesystems = [ "zfs" ];