diff --git a/fleet/common.nix b/fleet/common.nix index 8bcbb4d..5bc95bf 100644 --- a/fleet/common.nix +++ b/fleet/common.nix @@ -36,12 +36,12 @@ }; }; - config = lib.mkMerge [ + config = lib.mkMerge [ (lib.mkIf (config.athenix.forUser != null) { athenix.users.${config.athenix.forUser}.enable = true; - }) - { - system.stateVersion = "25.11"; + }) + { + system.stateVersion = "25.11"; nix.settings.experimental-features = [ "nix-command" "flakes" diff --git a/fleet/default.nix b/fleet/default.nix index 16e1b7b..e870fbd 100644 --- a/fleet/default.nix +++ b/fleet/default.nix @@ -22,7 +22,11 @@ let inventoryModule = lib.evalModules { modules = [ (import ./fleet-option.nix { inherit inputs; }) - { _module.args = { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; } + { + _module.args = { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + }; + } (lib.mkIf (fleet != null) { athenix.fleet = lib.mkForce fleet; }) (lib.mkIf (hwTypes != null) { athenix.hwTypes = lib.mkForce hwTypes; }) ]; diff --git a/fleet/fleet-option.nix b/fleet/fleet-option.nix index b56a99f..e781ba6 100644 --- a/fleet/fleet-option.nix +++ b/fleet/fleet-option.nix @@ -8,48 +8,57 @@ let fleetDefinition = lib.mkOption { description = "Hardware types definitions for the fleet."; - type = lib.types.attrsOf (lib.types.submodule ({ name, ...}: { - options = { - type = lib.mkOption { - type = lib.types.oneOf [ - lib.types.str - lib.types.listOf lib.types.str - ]; - default = name; - description = "Type(s) of system configuration for this device."; - }; - system = lib.mkOption { - type = lib.types.str; - default = "x86_64-linux"; - description = "NixOS system architecture for this hardware type."; - }; - devices = lib.mkOption { - type = lib.types.oneOf [ - lib.types.int - (lib.types.attrsOf - (lib.types.submodule ({ name, ... }: { - freeformType = lib.types.attrs; - }) - )) - ]; - }; - count = lib.mkOption { - type = lib.types.int; - default = 0; - description = "Number of devices of this type to create."; - }; - defaultCount = lib.mkOption { - type = lib.types.int; - default = 0; - description = "Default number of devices to create with default configurations and numbered hostnames."; - }; - overrides = lib.mkOption { - type = lib.types.attrs; - default = { }; - description = "Overrides to apply to all devices of this type."; - }; - }; - })); + type = lib.types.attrsOf ( + lib.types.submodule ( + { name, ... }: + { + options = { + type = lib.mkOption { + type = lib.types.oneOf [ + lib.types.str + lib.types.listOf + lib.types.str + ]; + default = name; + description = "Type(s) of system configuration for this device."; + }; + system = lib.mkOption { + type = lib.types.str; + default = "x86_64-linux"; + description = "NixOS system architecture for this hardware type."; + }; + devices = lib.mkOption { + type = lib.types.oneOf [ + lib.types.int + (lib.types.attrsOf ( + lib.types.submodule ( + { name, ... }: + { + freeformType = lib.types.attrs; + } + ) + )) + ]; + }; + count = lib.mkOption { + type = lib.types.int; + default = 0; + description = "Number of devices of this type to create."; + }; + defaultCount = lib.mkOption { + type = lib.types.int; + default = 0; + description = "Default number of devices to create with default configurations and numbered hostnames."; + }; + overrides = lib.mkOption { + type = lib.types.attrs; + default = { }; + description = "Overrides to apply to all devices of this type."; + }; + }; + } + ) + ); }; in { diff --git a/hw/default.nix b/hw/default.nix index 0b95ad2..5172bee 100644 --- a/hw/default.nix +++ b/hw/default.nix @@ -14,15 +14,10 @@ let # Keep only regular *.nix files except default.nix nixFiles = filterAttrs ( - name: type: - type == "regular" - && lib.hasSuffix ".nix" name - && name != "default.nix" + name: type: type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix" ) files; moduleNames = map (name: removeSuffix ".nix" name) (attrNames nixFiles); in # Export: { name = ; } -genAttrs moduleNames (name: - import (./. + ("/" + name + ".nix")) -) \ No newline at end of file +genAttrs moduleNames (name: import (./. + ("/" + name + ".nix"))) diff --git a/inventory.nix b/inventory.nix index 32dd57d..0338d8f 100644 --- a/inventory.nix +++ b/inventory.nix @@ -151,4 +151,4 @@ # ========== Ephemeral/Netboot System ========== # Creates: nix-ephemeral1 nix-ephemeral.devices = 1; -} \ No newline at end of file +} diff --git a/lib/default.nix b/lib/default.nix index fe2fff2..372377f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,4 @@ { inputs }: { mkFleet = import ./mkFleet.nix; -} \ No newline at end of file +} diff --git a/lib/mkFleet.nix b/lib/mkFleet.nix index 4de4d49..94a034c 100644 --- a/lib/mkFleet.nix +++ b/lib/mkFleet.nix @@ -5,7 +5,7 @@ fleet ? null, hwTypes ? null, }: - import ../fleet/default.nix { - inherit inputs; - inherit fleet hwTypes; - } \ No newline at end of file +import ../fleet/default.nix { + inherit inputs; + inherit fleet hwTypes; +} diff --git a/sw/gc.nix b/sw/gc.nix index 78658cf..e679c02 100644 --- a/sw/gc.nix +++ b/sw/gc.nix @@ -55,4 +55,4 @@ # Optimize storage nix.optimise.automatic = config.athenix.system.gc.optimise; }; -} \ No newline at end of file +}