From 8821aafbbad1209f4b07d9276d7b5a3cebed1f54 Mon Sep 17 00:00:00 2001 From: Jay Looney Date: Mon, 10 Nov 2025 13:45:45 -0600 Subject: [PATCH] feat: add support for specialArgs to mkSystem --- lib/default.nix | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 3926ed9..65ee05a 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,19 +1,32 @@ { nixpkgs, home-manager, inputs, ... }: +let + allOverlays = import (../overlays) { inherit nixpkgs; }; +in { # It's not really that I care about whether a system is a desktop system or # a server system, but moreso that I care about whether a system is headless or not. # I also care about things like if it's darwin, or wsl. + # TODO: Expand this to actually make use of extraSpecialArgs and pass special + # args to the relevant places. mkSystem = { hostname, system ? "x86_64-linux", users ? [], - extraModules ? [] + extraModules ? [], + extraSpecialArgs ? {} }: let - hostModule = import ../hosts/${hostname} { inherit inputs; }; + pkgs_with_overlays = import nixpkgs { + inherit system; + overlays = allOverlays; + }; + hostModule = import ../hosts/${hostname} { + inherit inputs; + pkgs = pkgs_with_overlays; + }; userModules = map (name: import ../users/${name} { - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = pkgs_with_overlays; lib = nixpkgs.lib; } ) users; @@ -26,13 +39,18 @@ name = name; value = import ../users/${name}/home.nix { username = name; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = pkgs_with_overlays; lib = nixpkgs.lib; }; }) homeUserNames); in nixpkgs.lib.nixosSystem { inherit system; + # pkgs = import inputs.nixpkgs { + # inherit system; + # overlays = allOverlays; + # config = { allowUnfree = true; nvidia.acceptLicense = true; }; + # }; modules = [ hostModule ] ++ userModules ++ extraModules @@ -43,5 +61,8 @@ home-manager.users = homeUsers; } ] else []); + specialArgs = { + inherit inputs hostname; + } // extraSpecialArgs; }; }