about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 18:24:03 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-23 18:24:03 +0200
commit96bf5aa00bbf2499c47c887b2217570657d0011d (patch)
tree9f337470fc0d59de834c407e14c1eadf0c059d78
parentrefactor(modules/home/pkgs): Readd whilst using the new `pkgs` (diff)
downloadnixos-config-96bf5aa00bbf2499c47c887b2217570657d0011d.tar.gz
nixos-config-96bf5aa00bbf2499c47c887b2217570657d0011d.zip
refactor(nixpkgs): Configure nixpkgs via the module system
-rw-r--r--flake.nix19
-rw-r--r--modules/system/default.nix1
-rw-r--r--modules/system/nixpkgs/default.nix40
3 files changed, 50 insertions, 10 deletions
diff --git a/flake.nix b/flake.nix
index 03da41a6..572b4e07 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,5 @@
 {
-  description = "NixOS system config";
+  description = "A NixOS System Configuration";
 
   inputs = {
     # base
@@ -265,17 +265,14 @@
     yambar_cpu,
     ...
   }: let
-    sysLib = shell_library.lib.${system};
     system = "x86_64-linux";
-    pkgs = import nixpkgs (import ./sys/nixpkgs {
-      inherit (nixpkgs) lib;
-      inherit system sysLib;
-      # FIXME: Don't unconditionally use tiamat here <2024-02-24>
-      config = self.nixosConfigurations.tiamat.config.home-manager.users.soispha;
-      overlays = [];
-    });
+    sysLib = shell_library.lib.${system};
+
+    pkgs = nixpkgs.legacyPackages.${system};
+    myPkgs = import ./pkgs {
+      inherit sysLib pkgs;
+    };
 
-    # FIXME: this `nixpkgs` misses the configs applied to the other one
     nixpkgs_as_input = nixpkgs;
     nixpkgs_open_prs = {
       inherit
@@ -283,11 +280,13 @@
         nixpkgs-onlykey
         ;
     };
+
     outputs = import ./flake {
       inherit
         # core
         self
         pkgs
+        myPkgs
         system
         sysLib
         nixpkgs_as_input
diff --git a/modules/system/default.nix b/modules/system/default.nix
index 0eef0b7f..6a1fe03a 100644
--- a/modules/system/default.nix
+++ b/modules/system/default.nix
@@ -11,6 +11,7 @@ in {
     ./impermanence
     ./locale
     ./networking
+    ./nixpkgs
     ./polkit
     ./power
     ./secrets
diff --git a/modules/system/nixpkgs/default.nix b/modules/system/nixpkgs/default.nix
new file mode 100644
index 00000000..ca28c7bd
--- /dev/null
+++ b/modules/system/nixpkgs/default.nix
@@ -0,0 +1,40 @@
+{
+  lib,
+  config,
+  myPkgs,
+  pkgs,
+  ...
+}: let
+  cfg = config.soispha.nixpkgs;
+
+  myPkgsOverlay = self: super: myPkgs;
+in {
+  options.soispha.nixpkgs = {
+    enable = lib.mkEnableOption "Nixpkgs config";
+    systemName = lib.mkOption {
+      description = "The name of the system.";
+      example = "x86_64-linux";
+      type = lib.types.str;
+    };
+  };
+  config = {
+    nixpkgs = lib.mkIf cfg.enable {
+      hostPlatform = cfg.systemName;
+      config = {
+        hostSystem = cfg.systemName;
+        overlays = [
+          myPkgsOverlay
+        ];
+        config = {
+          # TODO: this fails because of the root tempsize, which should be increased
+          # contentAddressedByDefault = true;
+
+          allowUnfreePredicate = pkg:
+            builtins.elem (lib.getName pkg) [
+              "pypemicro" # required by pynitrokey
+            ];
+        };
+      };
+    };
+  };
+}