From ce54f06fd001cb5fb7ff556f44f616b7a315c041 Mon Sep 17 00:00:00 2001
From: clerie <git@clerie.de>
Date: Sun, 29 Jun 2025 17:28:38 +0200
Subject: [PATCH] flake/nixosConfigurations.nix: Handle host specific nixpkgs
 input again

---
 flake/nixosConfigurations.nix | 2 ++
 lib/nixosSystem.nix           | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/flake/nixosConfigurations.nix b/flake/nixosConfigurations.nix
index 8f5f80d..bfcb483 100644
--- a/flake/nixosConfigurations.nix
+++ b/flake/nixosConfigurations.nix
@@ -10,8 +10,10 @@ let
     group ? null,
     modules ? [],
   }: let
+    localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs;
   in self.lib.nixosSystem {
     system = system;
+    nixpkgs = localNixpkgs;
     modules = modules ++ [
       ({ config, lib, ... }: {
         # Set hostname
diff --git a/lib/nixosSystem.nix b/lib/nixosSystem.nix
index ea1e4d3..89ff0ec 100644
--- a/lib/nixosSystem.nix
+++ b/lib/nixosSystem.nix
@@ -12,14 +12,17 @@
 */
 {
   system ? null,
+  nixpkgs ? inputs.nixpkgs,
   pkgs ? null,
   modules ? [],
   ...
 }@args:
 
-inputs.nixpkgs.lib.nixosSystem ({
+nixpkgs.lib.nixosSystem ({
   system = system;
-  pkgs = if pkgs != null then pkgs else self.nixpkgs.${system};
+  pkgs = if pkgs != null then pkgs else (self.lib.mkNixpkgs {
+    inherit system nixpkgs;
+  });
   modules = [
     self.nixosModules.nixfilesInputs
     self.nixosModules.clerie
@@ -36,4 +39,4 @@ inputs.nixpkgs.lib.nixosSystem ({
       };
     })
   ] ++ modules;
-} // builtins.removeAttrs args [ "system" "pkgs" "modules" ] )
+} // builtins.removeAttrs args [ "system" "nixpkgs" "pkgs" "modules" ] )