Archived
Centralize shared values into variables.nix
One file (variables.nix) holding every value that was previously hardcoded and repeated across modules: LAN domain/CIDR, home/tailnet domains, cross-host references (nix-cache substituter hostname, NFS server hostname, remote-builder user), PXE/PBS IPs, timezone, and the primary username. Wired in via flake.nix's specialArgs (and home-manager's extraSpecialArgs for the two home.nix files), so any module picks it up by just adding `vars` to its function arguments — no explicit import needed. Two hosts (nix-cache, server) now derive their own networking.hostName from the same variable other hosts use to reach them, so there's exactly one place to change either identifier. Purely mechanical: every substituted value matches what was already there, confirmed by identical toplevel .drv paths for all 17 targets before and after. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
inherit (nixpkgs) lib;
|
||||
vars = import ./variables.nix;
|
||||
|
||||
# Generates a nixosConfiguration from a platform (what it runs on) and
|
||||
# a build type (what it's for), plus the per-identity host.nix that
|
||||
@@ -46,6 +47,7 @@
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit vars; };
|
||||
users.nixos = import homeFile;
|
||||
};
|
||||
}
|
||||
@@ -53,7 +55,7 @@
|
||||
./modules/nix-cache/client.nix
|
||||
./modules/remote-builder-client.nix
|
||||
];
|
||||
specialArgs = { inherit inputs; };
|
||||
specialArgs = { inherit inputs vars; };
|
||||
};
|
||||
|
||||
# Generated platform x build-type matrix. pxe-boot has no linode
|
||||
|
||||
Reference in New Issue
Block a user