Rename nixos hosts to x86 and fix up flake hosts creation

This commit is contained in:
Chris Toph 2025-06-12 15:38:27 -04:00
parent e7a22d3a2e
commit 534b18b9c5
48 changed files with 26 additions and 24 deletions

View file

@ -92,54 +92,55 @@
## Host Config ##
mkHost = host: isARM: {
${host} =
let
func = if isARM then ARM else X86;
systemFunc = func;
in
lib.nixosSystem {
# read host-dirs under e.g. hosts/x86 or hosts/arm
readHosts = arch: lib.attrNames (builtins.readDir ./hosts/${arch});
# build one host, choosing folder + system by isARM flag
mkHost =
host: isARM:
let
folder = if isARM then "arm" else "x86";
system = if isARM then ARM else X86;
in
{
"${host}" = lib.nixosSystem {
specialArgs = {
inherit
inputs
outputs
isARM
system
;
system = systemFunc;
# INFO: Extend lib with lib.custom; This approach allows lib.custom to propagate into hm
lib = nixpkgs.lib.extend (self: super: { custom = import ./lib { inherit (nixpkgs) lib; }; });
lib = nixpkgs.lib.extend (
# INFO: Extend lib with lib.custom; This approach allows lib.custom to propagate into hm
self: super: {
custom = import ./lib { inherit (nixpkgs) lib; };
}
);
};
modules = [
{
#INFO: Overlay application for custom packages
nixpkgs.overlays = [
self.overlays.default
];
}
{ nixpkgs.overlays = [ self.overlays.default ]; }
# Import secrets
./modules/global/secret-spec.nix
./secrets.nix
# Host-specific configuration
./hosts/nixos/${host}
./hosts/${folder}/${host}
];
};
};
};
# Invoke mkHost for each host config that is declared for either X86 or ARM
mkHostConfigs =
hosts: isARM: lib.foldl (acc: set: acc // set) { } (lib.map (host: mkHost host isARM) hosts);
readHosts = folder: lib.attrNames (builtins.readDir ./hosts/${folder});
in
{
overlays = import ./overlays { inherit inputs; };
# now point at x86 *and* arm directories explicitly
nixosConfigurations =
# Generate X86 configurations
(mkHostConfigs (readHosts "nixos") false)
//
# Generate ARM configurations
(mkHostConfigs (readHosts "arm") true);
(mkHostConfigs (readHosts "x86") false) // (mkHostConfigs (readHosts "arm") true);
packages = forAllSystems (
system:

View file

@ -41,6 +41,7 @@ in
"hosts/global/common/nvtop.nix" # GPU monitor (not available in home-manager)
"hosts/global/common/plymouth.nix" # fancy boot screen
"hosts/global/common/solaar.nix" # Logitech Unifying Receiver support
"hosts/global/common/warp.nix" # Cloudflare WARP VPN
])
];