Archived
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>
30 lines
876 B
Nix
30 lines
876 B
Nix
{ config, pkgs, lib, vars, ... }:
|
|
|
|
let
|
|
# Flake attribute names are now <platform>-<buildtype> (e.g. proxmox-docker)
|
|
# and no longer match networking.hostName, since a host's hostname stays
|
|
# fixed while the platform backing it can change. Each nixosConfiguration
|
|
# stamps its own active target name into /etc/flake-target at build time.
|
|
mySwitchCmd = ''
|
|
sudo nixos-rebuild switch \
|
|
--no-write-lock-file \
|
|
--refresh \
|
|
--flake git+https://${vars.lanDomain}/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
|
'';
|
|
myTestCmd = ''
|
|
sudo nixos-rebuild test \
|
|
--no-write-lock-file \
|
|
--refresh \
|
|
--flake git+https://${vars.lanDomain}/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
|
'';
|
|
in
|
|
{
|
|
programs.bash = {
|
|
enable = true;
|
|
shellAliases = {
|
|
"Switch-nix" = mySwitchCmd;
|
|
"Test-nix" = myTestCmd;
|
|
};
|
|
};
|
|
}
|