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
This commit is contained in:
UGA Innovation Factory
2026-01-06 18:31:58 -05:00
parent 77cea838a1
commit c3bbf6f8be
3 changed files with 29 additions and 46 deletions

View File

@@ -69,10 +69,10 @@
... ...
}: }:
let let
hosts = import ./hosts { inherit inputs; }; fleet = import ./glue/fleet.nix { inherit inputs; };
linuxSystem = "x86_64-linux"; linuxSystem = "x86_64-linux";
artifacts = import ./installer/artifacts.nix { artifacts = import ./installer/artifacts.nix {
inherit inputs hosts self; inherit inputs fleet self;
system = linuxSystem; system = linuxSystem;
}; };
forAllSystems = nixpkgs.lib.genAttrs [ forAllSystems = nixpkgs.lib.genAttrs [
@@ -86,13 +86,13 @@
# Formatter for 'nix fmt' # Formatter for 'nix fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
# Generate NixOS configurations from hosts/default.nix # Generate NixOS configurations from fleet generator
nixosConfigurations = hosts.nixosConfigurations; nixosConfigurations = fleet.nixosConfigurations;
# Expose artifacts to all systems, but they are always built for x86_64-linux # Expose artifacts to all systems, but they are always built for x86_64-linux
packages = forAllSystems (_: artifacts); 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; }; nixosModules = import ./installer/modules.nix { inherit inputs; };
# Templates for external configurations # Templates for external configurations

View File

@@ -1,6 +1,6 @@
{ {
inputs, inputs,
hosts, fleet,
self, self,
system, system,
}: }:
@@ -45,7 +45,7 @@ let
nixos-generators.nixosGenerate { nixos-generators.nixosGenerate {
inherit system; inherit system;
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = hosts.modules.${hostName} ++ [ modules = fleet.modules.${hostName} ++ [
{ {
disko.enableConfig = lib.mkForce false; disko.enableConfig = lib.mkForce false;
services.upower.enable = lib.mkForce false; services.upower.enable = lib.mkForce false;
@@ -61,7 +61,7 @@ let
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = hosts.modules.${hostName} ++ [ modules = fleet.modules.${hostName} ++ [
"${nixpkgs}/nixos/modules/installer/netboot/netboot.nix" "${nixpkgs}/nixos/modules/installer/netboot/netboot.nix"
{ {
disko.enableConfig = lib.mkForce false; 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 # Generate installer ISOs for hosts that have "installer-iso" in their buildMethods
installerPackages = lib.listToAttrs ( installerPackages = lib.listToAttrs (
lib.concatMap ( lib.concatMap (
name: name:
let let
cfg = hosts.nixosConfigurations.${name}; cfg = fleet.nixosConfigurations.${name};
in in
if lib.elem "installer-iso" cfg.config.athenix.host.buildMethods then if lib.elem "installer-iso" cfg.config.athenix.host.buildMethods then
[ [
@@ -96,7 +96,7 @@ let
lib.concatMap ( lib.concatMap (
name: name:
let let
cfg = hosts.nixosConfigurations.${name}; cfg = fleet.nixosConfigurations.${name};
in in
if lib.elem "iso" cfg.config.athenix.host.buildMethods then if lib.elem "iso" cfg.config.athenix.host.buildMethods then
[ [
@@ -115,7 +115,7 @@ let
lib.concatMap ( lib.concatMap (
name: name:
let let
cfg = hosts.nixosConfigurations.${name}; cfg = fleet.nixosConfigurations.${name};
in in
if lib.elem "ipxe" cfg.config.athenix.host.buildMethods then if lib.elem "ipxe" cfg.config.athenix.host.buildMethods then
[ [
@@ -145,7 +145,7 @@ let
lib.concatMap ( lib.concatMap (
name: name:
let let
cfg = hosts.nixosConfigurations.${name}; cfg = fleet.nixosConfigurations.${name};
in in
if lib.elem "lxc" cfg.config.athenix.host.buildMethods then if lib.elem "lxc" cfg.config.athenix.host.buildMethods then
[ [
@@ -164,7 +164,7 @@ let
lib.concatMap ( lib.concatMap (
name: name:
let let
cfg = hosts.nixosConfigurations.${name}; cfg = fleet.nixosConfigurations.${name};
in in
if lib.elem "proxmox" cfg.config.athenix.host.buildMethods then if lib.elem "proxmox" cfg.config.athenix.host.buildMethods then
[ [

View File

@@ -6,40 +6,23 @@
# #
# Usage in another flake: # Usage in another flake:
# # Full host type configurations (includes hardware + software + system config) # # Full host type configurations (includes hardware + software + system config)
# inputs.nixos-systems.nixosModules.nix-desktop # inputs.athenix.nixosModules.nix-desktop
# inputs.nixos-systems.nixosModules.nix-laptop # inputs.athenix.nixosModules.nix-laptop
# #
# # Software-only configurations (for custom hardware setups) # # Software-only configuration (for custom hardware setups)
# # Note: These include theme.nix in home-manager.sharedModules automatically # inputs.athenix.nixosModules.sw
# 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;
# })
# ];
{ inputs }: { inputs }:
{ # Automatically import all variant modules from variants/ directory
# ========== Full Host Type Modules ========== # This returns an attribute set like: { nix-desktop = ...; nix-laptop = ...; nix-lxc = ...; sw = ...; }
# Complete system configurations including hardware, boot, and software (import ../variants { inherit inputs; })
nix-desktop = import ../hosts/types/nix-desktop.nix { inherit inputs; }; # Desktop workstations // {
nix-laptop = import ../hosts/types/nix-laptop.nix { inherit inputs; }; # Laptop systems # Software configuration module - main module with all athenix.sw options
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
# Use athenix.sw.type to select profile: "desktop", "tablet-kiosk", "headless", "stateless-kiosk" # Use athenix.sw.type to select profile: "desktop", "tablet-kiosk", "headless", "stateless-kiosk"
# Use athenix.sw.extraPackages to add additional packages sw =
# Use athenix.sw.kioskUrl to set kiosk mode URL {
sw = { inputs, ... }@args: (import ../sw/default.nix (args // { inherit inputs; })); inputs,
...
}@args:
(import ../sw/default.nix (args // { inherit inputs; }));
} }