Archived
Generates all nixosConfigurations from mkTarget(platform, buildType, hostPath) instead of hand-written per-host blocks, so adding a new platform or build type is a one-line addition. Per-machine identity (hostname, hostId, secrets, stateVersion) moves into hosts/<name>/host.nix; platform-specific config (hardware, boot, networking) into modules/platforms/*.nix; build-type config (minimal/server/docker/gui/ nix-cache/pxe-boot) into modules/build-types/*.nix. Old flat targets (nixos, docker, server, nix-cache, nix-minimal, pxe-boot) are replaced by the 17-target <platform>-<buildtype> matrix; each new target was verified to evaluate before its old counterpart was removed. CI workflows and docs/aliases now discover hosts dynamically via nixosConfigurations attrNames and /etc/flake-target instead of hardcoded lists, so they can't drift from flake.nix again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
880 B
Nix
30 lines
880 B
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
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://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
|
'';
|
|
myTestCmd = ''
|
|
sudo nixos-rebuild test \
|
|
--no-write-lock-file \
|
|
--refresh \
|
|
--flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
|
'';
|
|
in
|
|
{
|
|
programs.bash = {
|
|
enable = true;
|
|
shellAliases = {
|
|
"Switch-nix" = mySwitchCmd;
|
|
"Test-nix" = myTestCmd;
|
|
};
|
|
};
|
|
}
|