feat: add support for specialArgs to mkSystem

This commit is contained in:
Jay Looney 2025-11-10 13:45:45 -06:00
parent dbe24af09c
commit 8821aafbba

View file

@ -1,19 +1,32 @@
{ nixpkgs, home-manager, inputs, ... }: { 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 # 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. # 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. # 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 = { mkSystem = {
hostname, hostname,
system ? "x86_64-linux", system ? "x86_64-linux",
users ? [], users ? [],
extraModules ? [] extraModules ? [],
extraSpecialArgs ? {}
}: }:
let 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: userModules = map (name:
import ../users/${name} { import ../users/${name} {
pkgs = nixpkgs.legacyPackages.${system}; pkgs = pkgs_with_overlays;
lib = nixpkgs.lib; lib = nixpkgs.lib;
} }
) users; ) users;
@ -26,13 +39,18 @@
name = name; name = name;
value = import ../users/${name}/home.nix { value = import ../users/${name}/home.nix {
username = name; username = name;
pkgs = nixpkgs.legacyPackages.${system}; pkgs = pkgs_with_overlays;
lib = nixpkgs.lib; lib = nixpkgs.lib;
}; };
}) homeUserNames); }) homeUserNames);
in in
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
# pkgs = import inputs.nixpkgs {
# inherit system;
# overlays = allOverlays;
# config = { allowUnfree = true; nvidia.acceptLicense = true; };
# };
modules = [ hostModule ] modules = [ hostModule ]
++ userModules ++ userModules
++ extraModules ++ extraModules
@ -43,5 +61,8 @@
home-manager.users = homeUsers; home-manager.users = homeUsers;
} }
] else []); ] else []);
specialArgs = {
inherit inputs hostname;
} // extraSpecialArgs;
}; };
} }