feat: add lazy evaluation for external modules in inventory
- External modules now use 'external' field for lazy evaluation - Only fetched when building specific host (not during flake check) - Improves rebuild performance for unrelated hosts - Update examples and documentation in inventory.nix header
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
{
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Fleet Inventory
|
# Fleet Inventory
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -44,8 +43,12 @@
|
|||||||
# athenix.forUser = "username"; # Automatically enables user (sets athenix.users.username.enable = true)
|
# athenix.forUser = "username"; # Automatically enables user (sets athenix.users.username.enable = true)
|
||||||
#
|
#
|
||||||
# External modules (instead of config):
|
# External modules (instead of config):
|
||||||
# Device values can be either a config attrset OR a fetchGit/fetchurl call
|
# Device values can be a config attrset with an optional 'external' field:
|
||||||
# that points to an external Nix module. The module will be imported and evaluated.
|
# devices."hostname" = {
|
||||||
|
# external = builtins.fetchGit { ... }; # Lazy: only fetched when building this host
|
||||||
|
# # ... additional config options
|
||||||
|
# };
|
||||||
|
# The external module will be imported and evaluated only when this specific host is built.
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# "lab" = { devices = 3; }; # Quick: lab1, lab2, lab3
|
# "lab" = { devices = 3; }; # Quick: lab1, lab2, lab3
|
||||||
@@ -62,11 +65,14 @@
|
|||||||
# devices."alice".athenix.forUser = "alice123"; # Sets up for user alice123
|
# devices."alice".athenix.forUser = "alice123"; # Sets up for user alice123
|
||||||
# };
|
# };
|
||||||
# "external" = {
|
# "external" = {
|
||||||
# devices."remote" = builtins.fetchGit { # External module via Git
|
# devices."remote".external = builtins.fetchGit { # External module via Git (lazy)
|
||||||
# url = "https://github.com/example/config";
|
# url = "https://github.com/example/config";
|
||||||
# rev = "e1ccd7cc3e709afe4f50b0627e1c4bde49165014";
|
# rev = "e1ccd7cc3e709afe4f50b0627e1c4bde49165014";
|
||||||
# };
|
# };
|
||||||
# }; # ========== Lab Laptops ==========
|
# };
|
||||||
|
|
||||||
|
{
|
||||||
|
# ========== Lab Laptops ==========
|
||||||
# Creates: nix-laptop1, nix-laptop2
|
# Creates: nix-laptop1, nix-laptop2
|
||||||
# Both get hdh20267 user via overrides
|
# Both get hdh20267 user via overrides
|
||||||
nix-laptop = {
|
nix-laptop = {
|
||||||
@@ -120,7 +126,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"usda-dash" = builtins.fetchGit {
|
"usda-dash".external = builtins.fetchGit {
|
||||||
url = "https://git.factory.uga.edu/MODEL/usda-dash-config.git";
|
url = "https://git.factory.uga.edu/MODEL/usda-dash-config.git";
|
||||||
rev = "dab32f5884895cead0fae28cb7d88d17951d0c12";
|
rev = "dab32f5884895cead0fae28cb7d88d17951d0c12";
|
||||||
submodules = true;
|
submodules = true;
|
||||||
@@ -146,34 +152,4 @@
|
|||||||
# ========== Ephemeral/Netboot System ==========
|
# ========== Ephemeral/Netboot System ==========
|
||||||
# Creates: nix-ephemeral1
|
# Creates: nix-ephemeral1
|
||||||
nix-ephemeral.devices = 1;
|
nix-ephemeral.devices = 1;
|
||||||
|
|
||||||
# ========== Example: External Module Configurations ==========
|
|
||||||
# Uncomment to use external modules from Git repositories:
|
|
||||||
#
|
|
||||||
# external-systems = {
|
|
||||||
# devices = {
|
|
||||||
# # Option 1: fetchGit with specific revision (recommended for reproducibility)
|
|
||||||
# "prod-server" = builtins.fetchGit {
|
|
||||||
# url = "https://github.com/example/server-config";
|
|
||||||
# rev = "e1ccd7cc3e709afe4f50b0627e1c4bde49165014"; # Full commit hash
|
|
||||||
# ref = "main"; # Optional: branch/tag name
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# # Option 2: fetchGit with latest from branch (less reproducible)
|
|
||||||
# "dev-server" = builtins.fetchGit {
|
|
||||||
# url = "https://github.com/example/server-config";
|
|
||||||
# ref = "develop";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# # Option 3: fetchTarball for specific release
|
|
||||||
# "test-server" = builtins.fetchTarball {
|
|
||||||
# url = "https://github.com/example/server-config/archive/v1.0.0.tar.gz";
|
|
||||||
# sha256 = "sha256:0000000000000000000000000000000000000000000000000000";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# # Option 4: Mix external module with local overrides
|
|
||||||
# # Note: The external module's default.nix should export a NixOS module
|
|
||||||
# # that accepts { inputs, ... } as parameters
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user