From c3bbf6f8be3ff96680cb277bf6377304f1ab5adf Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Tue, 6 Jan 2026 18:31:58 -0500 Subject: [PATCH] refactor: update imports to use glue/ and variants/ - flake.nix: import glue/fleet.nix instead of hosts/ - installer/artifacts.nix: use 'fleet' parameter instead of 'hosts' - installer/modules.nix: auto-import from variants/ directory --- flake.nix | 10 ++++----- installer/artifacts.nix | 18 ++++++++-------- installer/modules.nix | 47 +++++++++++++---------------------------- 3 files changed, 29 insertions(+), 46 deletions(-) diff --git a/flake.nix b/flake.nix index 1bc6f2b..74acc6a 100644 --- a/flake.nix +++ b/flake.nix @@ -69,10 +69,10 @@ ... }: let - hosts = import ./hosts { inherit inputs; }; + fleet = import ./glue/fleet.nix { inherit inputs; }; linuxSystem = "x86_64-linux"; artifacts = import ./installer/artifacts.nix { - inherit inputs hosts self; + inherit inputs fleet self; system = linuxSystem; }; forAllSystems = nixpkgs.lib.genAttrs [ @@ -86,13 +86,13 @@ # Formatter for 'nix fmt' formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); - # Generate NixOS configurations from hosts/default.nix - nixosConfigurations = hosts.nixosConfigurations; + # Generate NixOS configurations from fleet generator + nixosConfigurations = fleet.nixosConfigurations; # Expose artifacts to all systems, but they are always built for x86_64-linux packages = forAllSystems (_: artifacts); - # Expose modules for external use + # Expose host type modules and installer modules for external use nixosModules = import ./installer/modules.nix { inherit inputs; }; # Templates for external configurations diff --git a/installer/artifacts.nix b/installer/artifacts.nix index 3e835b6..877721a 100644 --- a/installer/artifacts.nix +++ b/installer/artifacts.nix @@ -1,6 +1,6 @@ { inputs, - hosts, + fleet, self, system, }: @@ -45,7 +45,7 @@ let nixos-generators.nixosGenerate { inherit system; specialArgs = { inherit inputs; }; - modules = hosts.modules.${hostName} ++ [ + modules = fleet.modules.${hostName} ++ [ { disko.enableConfig = lib.mkForce false; services.upower.enable = lib.mkForce false; @@ -61,7 +61,7 @@ let nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; }; - modules = hosts.modules.${hostName} ++ [ + modules = fleet.modules.${hostName} ++ [ "${nixpkgs}/nixos/modules/installer/netboot/netboot.nix" { disko.enableConfig = lib.mkForce false; @@ -70,14 +70,14 @@ let ]; }; - hostNames = builtins.attrNames hosts.nixosConfigurations; + hostNames = builtins.attrNames fleet.nixosConfigurations; # Generate installer ISOs for hosts that have "installer-iso" in their buildMethods installerPackages = lib.listToAttrs ( lib.concatMap ( name: let - cfg = hosts.nixosConfigurations.${name}; + cfg = fleet.nixosConfigurations.${name}; in if lib.elem "installer-iso" cfg.config.athenix.host.buildMethods then [ @@ -96,7 +96,7 @@ let lib.concatMap ( name: let - cfg = hosts.nixosConfigurations.${name}; + cfg = fleet.nixosConfigurations.${name}; in if lib.elem "iso" cfg.config.athenix.host.buildMethods then [ @@ -115,7 +115,7 @@ let lib.concatMap ( name: let - cfg = hosts.nixosConfigurations.${name}; + cfg = fleet.nixosConfigurations.${name}; in if lib.elem "ipxe" cfg.config.athenix.host.buildMethods then [ @@ -145,7 +145,7 @@ let lib.concatMap ( name: let - cfg = hosts.nixosConfigurations.${name}; + cfg = fleet.nixosConfigurations.${name}; in if lib.elem "lxc" cfg.config.athenix.host.buildMethods then [ @@ -164,7 +164,7 @@ let lib.concatMap ( name: let - cfg = hosts.nixosConfigurations.${name}; + cfg = fleet.nixosConfigurations.${name}; in if lib.elem "proxmox" cfg.config.athenix.host.buildMethods then [ diff --git a/installer/modules.nix b/installer/modules.nix index fae1d78..d69a837 100644 --- a/installer/modules.nix +++ b/installer/modules.nix @@ -6,40 +6,23 @@ # # Usage in another flake: # # Full host type configurations (includes hardware + software + system config) -# inputs.nixos-systems.nixosModules.nix-desktop -# inputs.nixos-systems.nixosModules.nix-laptop +# inputs.athenix.nixosModules.nix-desktop +# inputs.athenix.nixosModules.nix-laptop # -# # Software-only configurations (for custom hardware setups) -# # Note: These include theme.nix in home-manager.sharedModules automatically -# inputs.nixos-systems.nixosModules.sw-desktop -# inputs.nixos-systems.nixosModules.sw-headless -# -# # Home Manager modules (user-level configuration) -# # Theme module (no parameters): -# home-manager.users.myuser.imports = [ inputs.nixos-systems.homeManagerModules.theme ]; -# -# # Neovim module (requires user parameter): -# home-manager.users.myuser.imports = [ -# (inputs.nixos-systems.homeManagerModules.nvim { -# user = config.athenix.users.accounts.myuser; -# }) -# ]; +# # Software-only configuration (for custom hardware setups) +# inputs.athenix.nixosModules.sw { inputs }: -{ - # ========== Full Host Type Modules ========== - # Complete system configurations including hardware, boot, and software - nix-desktop = import ../hosts/types/nix-desktop.nix { inherit inputs; }; # Desktop workstations - nix-laptop = import ../hosts/types/nix-laptop.nix { inherit inputs; }; # Laptop systems - nix-surface = import ../hosts/types/nix-surface.nix { inherit inputs; }; # Surface tablets - nix-lxc = import ../hosts/types/nix-lxc.nix { inherit inputs; }; # Proxmox containers - nix-wsl = import ../hosts/types/nix-wsl.nix { inherit inputs; }; # WSL2 systems - nix-ephemeral = import ../hosts/types/nix-ephemeral.nix { inherit inputs; }; # Diskless/RAM-only - - # ========== Software Configuration Module ========== - # Main software module with all athenix.sw options +# Automatically import all variant modules from variants/ directory +# This returns an attribute set like: { nix-desktop = ...; nix-laptop = ...; nix-lxc = ...; sw = ...; } +(import ../variants { inherit inputs; }) +// { + # Software configuration module - main module with all athenix.sw options # Use athenix.sw.type to select profile: "desktop", "tablet-kiosk", "headless", "stateless-kiosk" - # Use athenix.sw.extraPackages to add additional packages - # Use athenix.sw.kioskUrl to set kiosk mode URL - sw = { inputs, ... }@args: (import ../sw/default.nix (args // { inherit inputs; })); + sw = + { + inputs, + ... + }@args: + (import ../sw/default.nix (args // { inherit inputs; })); }