Archived
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m31s
- variables.nix: switch to rec {}, extract giteaDomain/giteaRepoPath,
extraAdminSshKeys, haLanNfsFqdn, tailscaleResolverIp, ports.dhcp,
ports.dns; ipaServer now derives from homeDomain ref; section headers
- modules: use new vars throughout (pxe-boot, ts-dns-forwarder,
cluster-config, configuration.nix, mount-pxe-images) — eval unchanged
- docs: delete ephemeral planning docs (AUDIT_REPORT, ha-network-audit,
network-cutover); add docs/ha.md; drop migration reference table from
ip-addressing.md; remove stale server example from beszel.md
- CLAUDE.md/README.md/AGENTS.md: fix build types (tailscale-router,
ha-server, drop server); document scripts/ha/, scripts/ipa/, and
all previously undocumented top-level and lib scripts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
122 lines
3.6 KiB
Nix
122 lines
3.6 KiB
Nix
{ config, lib, pkgs, vars, ... }:
|
|
|
|
let
|
|
switchCmd = ''
|
|
sudo nixos-rebuild switch \
|
|
--no-write-lock-file \
|
|
--refresh \
|
|
--flake git+https://${vars.giteaDomain}/${vars.giteaRepoPath}.git#$(cat /etc/flake-target)
|
|
'';
|
|
testCmd = ''
|
|
sudo nixos-rebuild test \
|
|
--no-write-lock-file \
|
|
--refresh \
|
|
--flake git+https://${vars.giteaDomain}/${vars.giteaRepoPath}.git#$(cat /etc/flake-target)
|
|
'';
|
|
buildImageFn = ''
|
|
buildImage() {
|
|
if [ -z "$1" ]; then
|
|
echo "usage: buildImage <flake-target> (e.g. lxc-docker)" >&2
|
|
return 1
|
|
fi
|
|
NIXOS_HOST_KEYS_DIR="$(pwd)/host-keys" nix build --impure \
|
|
".#nixosConfigurations.$1.config.system.build.tarball"
|
|
}
|
|
'';
|
|
in
|
|
{
|
|
imports = [
|
|
./set-locale.nix
|
|
../ipa/client.nix
|
|
];
|
|
|
|
# System-wide shell config so all users (including IPA accounts) get the
|
|
# same management aliases as the local nixos user's Home Manager provides.
|
|
programs.bash = {
|
|
shellAliases = {
|
|
"Switch-nix" = switchCmd;
|
|
"Test-nix" = testCmd;
|
|
};
|
|
interactiveShellInit = buildImageFn;
|
|
};
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
# Recommended over the true default (bypasses ZFS's own import safeguards)
|
|
# per the option's own docs; matches hosts/docker/host.nix and
|
|
# modules/services/zfs/enable-service.nix. Harmless no-op on hosts without ZFS.
|
|
boot.zfs.forceImportRoot = false;
|
|
|
|
time.timeZone = vars.timeZone;
|
|
|
|
services.qemuGuest.enable = true;
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
vim
|
|
btop
|
|
git
|
|
gcr
|
|
jq
|
|
];
|
|
|
|
# Secrets shared by every host, decrypted at activation via each host's
|
|
# SSH host key (sops-nix derives the age key from
|
|
# /etc/ssh/ssh_host_ed25519_key automatically). hashedPassword secrets need
|
|
# neededForUsers so they're available before the normal secret-activation
|
|
# step — user creation happens very early in boot.
|
|
sops = {
|
|
defaultSopsFile = ../../secrets/common.yaml;
|
|
|
|
secrets = {
|
|
"root-hashedPassword".neededForUsers = true;
|
|
"nixos-hashedPassword".neededForUsers = true;
|
|
"nix-github-token" = { };
|
|
};
|
|
|
|
# nix.conf has no *File-style option for access-tokens, so the token is
|
|
# rendered into a runtime-only file (never touches the Nix store) and
|
|
# pulled in via nix.conf's native !include directive.
|
|
templates."nix-github-token.conf".content = ''
|
|
access-tokens = github.com=${config.sops.placeholder."nix-github-token"}
|
|
'';
|
|
};
|
|
|
|
nix.extraOptions = ''
|
|
!include ${config.sops.templates."nix-github-token.conf".path}
|
|
'';
|
|
|
|
users = {
|
|
# mutableUsers = false makes update-users-groups.pl enforce hashedPasswordFile
|
|
# on every activation, not just on newly-created accounts. Without this, a
|
|
# freshly-built proxmox disk image (activation runs without a usable sops key,
|
|
# so both accounts land in shadow with '!') will never have its passwords fixed
|
|
# by subsequent boots.
|
|
mutableUsers = false;
|
|
|
|
users.root = {
|
|
hashedPasswordFile = config.sops.secrets."root-hashedPassword".path;
|
|
};
|
|
|
|
users.${vars.primaryUser} = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" ];
|
|
packages = with pkgs; [ tree ];
|
|
hashedPasswordFile = config.sops.secrets."nixos-hashedPassword".path;
|
|
openssh.authorizedKeys.keys = [ vars.adminSshKey ] ++ vars.extraAdminSshKeys;
|
|
};
|
|
};
|
|
|
|
services.openssh.enable = true;
|
|
|
|
nix.settings = {
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
auto-optimise-store = true;
|
|
};
|
|
|
|
programs.git = {
|
|
enable = true;
|
|
package = pkgs.git;
|
|
config.credential.helper = "store";
|
|
};
|
|
}
|