Archived
Compare commits
312
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04de84d03b | ||
|
|
7bfe8cb0b2 | ||
|
|
8460eff2de | ||
|
|
bcfeb08b11 | ||
|
|
783bda00c1 | ||
|
|
e3ac63aefa | ||
|
|
4f1aff9a16 | ||
|
|
befab7f3c6 | ||
|
|
b9610dbc9d | ||
|
|
b605d19870 | ||
|
|
679dfd80c0 | ||
|
|
298f615929 | ||
|
|
5e17baba72 | ||
|
|
345b5ca657 | ||
|
|
2c4fe8af2b | ||
|
|
c128bff2bf | ||
|
|
8aff9fff29 | ||
|
|
8f468d5703 | ||
|
|
690ecb1eb0 | ||
|
|
1ed1b388f5 | ||
|
|
f338843166 | ||
|
|
1c1f65560c | ||
|
|
258ebfe1bf | ||
|
|
45cb9c38e8 | ||
|
|
b481324c7d | ||
|
|
d5467e9a5b | ||
|
|
c3c467bb41 | ||
|
|
80eff2c050 | ||
|
|
1cff38be43 | ||
|
|
960548c2ac | ||
|
|
229cd06f73 | ||
|
|
6e332a6bbd | ||
|
|
fe3041c06c | ||
|
|
591731e3b8 | ||
|
|
5da5401e91 | ||
|
|
aca46255f8 | ||
|
|
f85559bb18 | ||
|
|
07534e64fc | ||
|
|
54cefce90a | ||
|
|
fcb8f5e01e | ||
|
|
985d4e4bfa | ||
|
|
9462d80ccc | ||
|
|
14deedc12d | ||
|
|
893a7c997c | ||
|
|
d068195fbe | ||
|
|
51fba54d94 | ||
|
|
f541688973 | ||
|
|
3bb2b83370 | ||
|
|
8ff22175e5 | ||
|
|
bc719afe39 | ||
|
|
20dc28069c | ||
|
|
28ae709100 | ||
|
|
3de625309e | ||
|
|
f2744bf3a7 | ||
|
|
5b118b05da | ||
|
|
f139333980 | ||
|
|
5d5428014a | ||
|
|
529a518cd1 | ||
|
|
dc714b41c1 | ||
|
|
c470737316 | ||
|
|
8266f43980 | ||
|
|
474d243649 | ||
|
|
019afb5609 | ||
|
|
63062cdda5 | ||
|
|
8f5599a1c6 | ||
|
|
416b7196c2 | ||
|
|
0bdadcc772 | ||
|
|
aa08bf60b9 | ||
|
|
99ad7501bb | ||
|
|
6c973e2300 | ||
|
|
eb2d3e3260 | ||
|
|
f9c0f01aba | ||
|
|
83481b5291 | ||
|
|
a553958bb9 | ||
|
|
d16b22d2b5 | ||
|
|
3900d617fa | ||
|
|
c15e88de35 | ||
|
|
ff9fbc36e9 | ||
|
|
fe322c13c6 | ||
|
|
4d8b00609b | ||
|
|
6b7c011480 | ||
|
|
a488ff507e | ||
|
|
9685233553 | ||
|
|
837096ca28 | ||
|
|
bd550b9c2e | ||
|
|
5e8037d02b | ||
|
|
1af8079a8e | ||
|
|
030d344ea2 | ||
|
|
6a266449d5 | ||
|
|
895c9d7003 | ||
|
|
0edb1a431e | ||
|
|
8f32ccdd0f | ||
|
|
44e828320f | ||
|
|
b3c3760c3e | ||
|
|
b9ff8002bd | ||
|
|
ae4c3dba24 | ||
|
|
f008c16ea7 | ||
|
|
4d4a10aaae | ||
|
|
3e298b8c6e | ||
|
|
f7baaf88bb | ||
|
|
0606b93570 | ||
|
|
dd80145e4f | ||
|
|
c25c5d4fbc | ||
|
|
29b1b86286 | ||
|
|
33be42e3ca | ||
|
|
28c875e8cb | ||
|
|
09a50f8ff2 | ||
|
|
161888b037 | ||
|
|
3578e66a15 | ||
|
|
f759f98f97 | ||
|
|
36a5287b7b | ||
|
|
04692c33f2 | ||
|
|
da3f4b16c9 | ||
|
|
f00364bd14 | ||
|
|
c25eb536c7 | ||
|
|
34ff056ca9 | ||
|
|
4187e7dc79 | ||
|
|
de9549b466 | ||
|
|
140dea3993 | ||
|
|
545775fc26 | ||
|
|
514fa3068a | ||
|
|
ded8b7dd55 | ||
|
|
8444fc370e | ||
|
|
2c5fca84bd | ||
|
|
7e1768c2e8 | ||
|
|
39332d0b93 | ||
|
|
fc193d0932 | ||
|
|
0154648aa2 | ||
|
|
74b3c8cd3d | ||
|
|
e24f9314be | ||
|
|
8211ff8cb1 | ||
|
|
88dedeed43 | ||
|
|
997e384973 | ||
|
|
31371189f5 | ||
|
|
70ea6c2e7c | ||
|
|
03adfdd0de | ||
|
|
84569d13e6 | ||
|
|
519d7b8d3c | ||
|
|
5f036c8f54 | ||
|
|
83abba4e25 | ||
|
|
c718010a69 | ||
|
|
2f985536c4 | ||
|
|
bf0445ebd6 | ||
|
|
7b945ea4fe | ||
|
|
5fbc8ba5df | ||
|
|
d474f1b1b1 | ||
|
|
b36431f210 | ||
|
|
d4771720b9 | ||
|
|
2e2298d66e | ||
|
|
51a50faf69 | ||
|
|
193c10d4b7 | ||
|
|
def6be08e7 | ||
|
|
0633c60b9d | ||
|
|
7cbdcdf29e | ||
|
|
cf1a4eefda | ||
|
|
5256b661a3 | ||
|
|
bcccf523bf | ||
|
|
1a4a0c47ef | ||
|
|
286d7347a1 | ||
|
|
5a93bdeb28 | ||
|
|
770cbaf098 | ||
|
|
dec3e25472 | ||
|
|
8b919d2d5a | ||
|
|
d52e892559 | ||
|
|
df4161265b | ||
|
|
80bffb58c9 | ||
|
|
f8acce2614 | ||
|
|
daadd97f84 | ||
|
|
a3be101ce3 | ||
|
|
4bf32f23ab | ||
|
|
f14aa9755b | ||
|
|
8f5f975d83 | ||
|
|
7f7b03384f | ||
|
|
6e138c6f7f | ||
|
|
e6a72813e4 | ||
|
|
350a2d2bfb | ||
|
|
cb1ddc2109 | ||
|
|
376d53de40 | ||
|
|
fd592ba5de | ||
|
|
4b37d36212 | ||
|
|
0a10efefa6 | ||
|
|
5e559efc6f | ||
|
|
149f56ce10 | ||
|
|
c6f6441907 | ||
|
|
cc956d3038 | ||
|
|
d409b5b718 | ||
|
|
6ef87a3226 | ||
|
|
9a190a28d6 | ||
|
|
e7a215cd15 | ||
|
|
651f4e61c5 | ||
|
|
ffad8bd6b8 | ||
|
|
01aaf10e2d | ||
|
|
8db2a2db86 | ||
|
|
3389c9549a | ||
|
|
7ab8cf15ca | ||
|
|
56a25ab5d7 | ||
|
|
76649ad698 | ||
|
|
487d8bc474 | ||
|
|
529535cffd | ||
|
|
aff4cf1c16 | ||
|
|
3db1205a8d | ||
|
|
bc5be541c3 | ||
|
|
38c55c3de2 | ||
|
|
25b8ebcad7 | ||
|
|
d08951d46a | ||
|
|
9eba317de0 | ||
|
|
a9bb49a7e7 | ||
|
|
46c71eb619 | ||
|
|
8918af8d6e | ||
|
|
48447f7a47 | ||
|
|
943c5324ca | ||
|
|
a8f417b4f9 | ||
|
|
ff75079327 | ||
|
|
6f79daefc4 | ||
|
|
66b6bc0c2a | ||
|
|
b952075a1e | ||
|
|
49c72848e6 | ||
|
|
c19919a868 | ||
|
|
4c4ed6416d | ||
|
|
a457d04a0a | ||
|
|
019ab8c2cc | ||
|
|
cb0efa12ce | ||
|
|
bb454d5a97 | ||
|
|
af4021b29f | ||
|
|
a7a6951115 | ||
|
|
00bab4b69a | ||
|
|
6c304304f0 | ||
|
|
60942af93f | ||
|
|
f4dd65c66e | ||
|
|
3fbc290fd5 | ||
|
|
1b6779f89c | ||
|
|
dc933fc69b | ||
|
|
4d322a94ac | ||
|
|
17ecbc617d | ||
|
|
c892c70860 | ||
|
|
376f0b98dd | ||
|
|
728129a4b2 | ||
|
|
fe8649b09a | ||
|
|
64183b0ab9 | ||
|
|
8c7a7815a7 | ||
|
|
0dc6c5099f | ||
|
|
236385e480 | ||
|
|
ddf0133da5 | ||
|
|
f4a849bbac | ||
|
|
0c2344098b | ||
|
|
ee44a2dafd | ||
|
|
ff014f6658 | ||
|
|
c8dc59750b | ||
|
|
35f2c457dd | ||
|
|
5a60d574d8 | ||
|
|
08f6dd7347 | ||
|
|
0228bdf429 | ||
|
|
1d99b54374 | ||
|
|
dd32d23249 | ||
|
|
47927a91f1 | ||
|
|
954d89f101 | ||
|
|
5bb1b0c6a1 | ||
|
|
706e74c46d | ||
|
|
094b6c34f0 | ||
|
|
aeb2cde784 | ||
|
|
f1520fbd75 | ||
|
|
0321f764aa | ||
|
|
e0a1d1b5dc | ||
|
|
cfea52cf7d | ||
|
|
94736a53ef | ||
|
|
1960c4cd8c | ||
|
|
b66f5dd800 | ||
|
|
3d2938d896 | ||
|
|
903ac787b1 | ||
|
|
34cf3a330a | ||
|
|
c8c5d21e5a | ||
|
|
ec82189d47 | ||
|
|
ebf8173845 | ||
|
|
360d0d4f46 | ||
|
|
fb73fe70cd | ||
|
|
a0699349c7 | ||
|
|
2e6f19e597 | ||
|
|
d5f6a154ca | ||
|
|
afda3b0a5d | ||
|
|
4c4b3d47f3 | ||
|
|
7413340c75 | ||
|
|
b0dd745a03 | ||
|
|
be3012a65a | ||
|
|
55dd99e155 | ||
|
|
845ab268ce | ||
|
|
1df53af9bf | ||
|
|
427155bcb0 | ||
|
|
e8ee5981ac | ||
|
|
6d701af3c7 | ||
|
|
d6f9fe97f5 | ||
|
|
d450750818 | ||
|
|
1c5dac74ca | ||
|
|
d4f5e0b22d | ||
|
|
b0964fcb80 | ||
|
|
a285756040 | ||
|
|
20d38c571c | ||
|
|
e22dcd6d02 | ||
|
|
a2bc222fc8 | ||
|
|
198ba7a198 | ||
|
|
cc6704830e | ||
|
|
072f1690e6 | ||
|
|
5ca3254788 | ||
|
|
398dc5161a | ||
|
|
798c3c10d5 | ||
|
|
af2f4263cc | ||
|
|
fa76fb0f13 | ||
|
|
d6c1e48667 | ||
|
|
aa065f21e3 | ||
|
|
61f5059492 | ||
|
|
bd6f0ab825 | ||
|
|
0ab5a56493 | ||
|
|
c9ab34040d |
No files matched your search
@@ -20,9 +20,7 @@ jobs:
|
|||||||
- name: Evaluate all NixOS hosts
|
- name: Evaluate all NixOS hosts
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
hosts="$(nix --extra-experimental-features 'nix-command flakes' eval --json \
|
for host in nixos docker kuma server nix-cache nix-minimal pxe-boot; do
|
||||||
.#nixosConfigurations --apply builtins.attrNames | jq -r '.[]')"
|
|
||||||
for host in $hosts; do
|
|
||||||
echo "Evaluating ${host}"
|
echo "Evaluating ${host}"
|
||||||
nix --extra-experimental-features 'nix-command flakes' eval \
|
nix --extra-experimental-features 'nix-command flakes' eval \
|
||||||
".#nixosConfigurations.${host}.config.system.build.toplevel.drvPath" --raw
|
".#nixosConfigurations.${host}.config.system.build.toplevel.drvPath" --raw
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Blocks commits containing secrets. Installed via:
|
|
||||||
# git config core.hooksPath .githooks
|
|
||||||
# (scripts/codex-setup.sh does this automatically in Codex sessions.)
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if command -v gitleaks >/dev/null 2>&1; then
|
|
||||||
gitleaks protect --staged -v
|
|
||||||
else
|
|
||||||
nix-shell -p gitleaks --run "gitleaks protect --staged -v"
|
|
||||||
fi
|
|
||||||
@@ -20,9 +20,7 @@ jobs:
|
|||||||
- name: Evaluate all NixOS hosts
|
- name: Evaluate all NixOS hosts
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
hosts="$(nix --extra-experimental-features 'nix-command flakes' eval --json \
|
for host in nixos docker kuma server nix-cache nix-minimal pxe-boot; do
|
||||||
.#nixosConfigurations --apply builtins.attrNames | jq -r '.[]')"
|
|
||||||
for host in $hosts; do
|
|
||||||
echo "Evaluating ${host}"
|
echo "Evaluating ${host}"
|
||||||
nix --extra-experimental-features 'nix-command flakes' eval \
|
nix --extra-experimental-features 'nix-command flakes' eval \
|
||||||
".#nixosConfigurations.${host}.config.system.build.toplevel.drvPath" --raw
|
".#nixosConfigurations.${host}.config.system.build.toplevel.drvPath" --raw
|
||||||
|
|||||||
@@ -9,7 +9,3 @@ result-*
|
|||||||
auto-installer/flake.lock
|
auto-installer/flake.lock
|
||||||
auto-installer/result
|
auto-installer/result
|
||||||
auto-installer/nixos-auto.iso
|
auto-installer/nixos-auto.iso
|
||||||
|
|
||||||
# Temporary Milestone 1 audit checklist (remove-sensetive-info-refactor.md)
|
|
||||||
# - working notes only, never committed, deleted once every row is rotated.
|
|
||||||
secrets-inventory.md
|
|
||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
keys:
|
|
||||||
- &admin age10nd382a9klsn2mrs60emdtsxe43pht3a0m9p29phfrhy0wfyt3vsq9r667
|
|
||||||
- &docker age19gfn2yedg76dmztm4hncr7vf3r3c9j0qpt4rap7y7gersjk4m3ks2lhd0e
|
|
||||||
- &server age1ll6hj5ggruetgjwjfnplpn5xtq35uhlcdflksx3xmnjm6s3uad9sz70jkf
|
|
||||||
- &nix-cache age120le4a5l8dh3lyfgvmj3d9ksmej6ajs5mer5y7r0vfg3x9fn69dqf8xgzu
|
|
||||||
|
|
||||||
creation_rules:
|
|
||||||
# Shared across every currently-deployed host: root/nixos password hash,
|
|
||||||
# GitHub access token. Same value on every host today, so every live host's
|
|
||||||
# key can decrypt it (matches current risk profile — narrow further in
|
|
||||||
# Milestone 4 if hosts should diverge).
|
|
||||||
- path_regex: secrets/common\.yaml$
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *admin
|
|
||||||
- *docker
|
|
||||||
- *server
|
|
||||||
- *nix-cache
|
|
||||||
|
|
||||||
- path_regex: secrets/nix-cache\.yaml$
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *admin
|
|
||||||
- *nix-cache
|
|
||||||
|
|
||||||
- path_regex: secrets/server\.yaml$
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *admin
|
|
||||||
- *server
|
|
||||||
|
|
||||||
- path_regex: secrets/docker\.yaml$
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *admin
|
|
||||||
- *docker
|
|
||||||
@@ -5,13 +5,15 @@
|
|||||||
This repository contains flake-based NixOS configurations for Wayne's LAN
|
This repository contains flake-based NixOS configurations for Wayne's LAN
|
||||||
servers and workstation.
|
servers and workstation.
|
||||||
|
|
||||||
The flake exposes NixOS configurations named `<platform>-<buildtype>`
|
The flake currently exposes these NixOS configurations:
|
||||||
(platforms: `linode`, `proxmox`, `lxc`; build types: `minimal`, `nix-cache`,
|
|
||||||
`server`, `docker`, `gui`, `pxe-boot`), generated from `modules/platforms/*`
|
- `nixos`
|
||||||
and `modules/build-types/*` by the `mkTarget` function in `flake.nix`. Not
|
- `docker`
|
||||||
every combination is built — `pxe-boot` has no `linode` variant. See
|
- `kuma`
|
||||||
`README.md` for the full current target list; treat `flake.nix` as the
|
- `server`
|
||||||
source of truth since this list can drift.
|
- `nix-cache`
|
||||||
|
- `nix-minimal`
|
||||||
|
- `pxe-boot`
|
||||||
|
|
||||||
Do not deploy, switch, reboot, repartition, format disks, or run destructive
|
Do not deploy, switch, reboot, repartition, format disks, or run destructive
|
||||||
install commands from this repository unless explicitly asked.
|
install commands from this repository unless explicitly asked.
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
# CLAUDE.md
|
|
||||||
|
|
||||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
||||||
|
|
||||||
## Repo purpose
|
|
||||||
|
|
||||||
Flake-based NixOS configuration for Wayne's LAN servers and workstation. There is
|
|
||||||
no application code here — changes are Nix module edits that affect real
|
|
||||||
machines when deployed.
|
|
||||||
|
|
||||||
## Safety rules (read before touching anything)
|
|
||||||
|
|
||||||
- **Never** run `nixos-rebuild switch|boot|test`, `nixos-install`, `parted`,
|
|
||||||
`mkfs`, `mkswap`, `swapon`, `mount`, or any other destructive disk/deploy
|
|
||||||
command from an agent session, even if asked indirectly. Deployment is done
|
|
||||||
manually by the operator on the target host.
|
|
||||||
- Validation is limited to evaluation, linting, formatting checks, and
|
|
||||||
`nix build --dry-run --no-link`.
|
|
||||||
- Do not add secrets, tokens, private keys, or new password hashes to the repo.
|
|
||||||
- This repo currently contains **committed password hashes** (e.g.
|
|
||||||
`prepare.sh`, `hosts/nixos/configuration.nix`) and SSH public keys (e.g.
|
|
||||||
`modules/nix-cache/server.nix`). The hashes are known tech debt — do not use
|
|
||||||
them as a template for new hosts, and flag any *new* secret-like string you
|
|
||||||
encounter instead of committing it.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# One-time environment bootstrap (installs Nix if missing, prints hosts)
|
|
||||||
bash scripts/codex-setup.sh
|
|
||||||
|
|
||||||
# Full validation: secret grep, nixpkgs-fmt --check, statix lint, eval all hosts
|
|
||||||
bash scripts/codex-maintenance.sh
|
|
||||||
|
|
||||||
# Same, plus a dry-run build (no result symlink) of every host's toplevel
|
|
||||||
bash scripts/codex-maintenance.sh dry-run
|
|
||||||
|
|
||||||
# List the hosts the flake currently exposes
|
|
||||||
nix eval --json .#nixosConfigurations --apply builtins.attrNames | jq -r '.[]'
|
|
||||||
|
|
||||||
# Evaluate a single host without building (fast sanity check)
|
|
||||||
nix eval .#nixosConfigurations.<host>.config.system.build.toplevel.drvPath --raw
|
|
||||||
|
|
||||||
# Dry-run build a single host
|
|
||||||
nix build --dry-run --no-link .#nixosConfigurations.<host>.config.system.build.toplevel
|
|
||||||
```
|
|
||||||
|
|
||||||
Formatting/lint tools (`nixpkgs-fmt`, `statix`) are not installed locally; the
|
|
||||||
maintenance script pulls them via `nix run github:NixOS/nixpkgs/nixos-25.11#<tool>`.
|
|
||||||
There is no test suite — "correctness" here means the flake evaluates and
|
|
||||||
`nixpkgs-fmt`/`statix` are clean.
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
`flake.nix` is the single entry point. It defines one `nixosConfigurations.<host>`
|
|
||||||
attribute per machine, each built the same way:
|
|
||||||
|
|
||||||
```
|
|
||||||
nixosSystem {
|
|
||||||
modules = [
|
|
||||||
disko.nixosModules.disko
|
|
||||||
./hosts/<host>/configuration.nix # host-specific config
|
|
||||||
./modules/hardware-configuration/vm/<proxmox|linode>.nix
|
|
||||||
home-manager.nixosModules.home-manager { ... }
|
|
||||||
];
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Hosts currently defined in `flake.nix`: `nixos`, `docker`, `server`,
|
|
||||||
`nix-cache`, `nix-minimal`, `pxe-boot`, `linode-minimal`. Treat `flake.nix` as
|
|
||||||
the source of truth for which hosts exist — `README.md`, `AGENTS.md`,
|
|
||||||
`docs/flake-lock-automation.md`, and the CI eval workflows
|
|
||||||
(`.github/workflows/check-nixos.yml`, `.gitea/workflows/check-nixos.yml`) list
|
|
||||||
hosts by hand and can drift from it, so re-check them against `flake.nix` when
|
|
||||||
adding or removing a host.
|
|
||||||
|
|
||||||
### Composition pattern
|
|
||||||
|
|
||||||
Every host's real configuration lives in `hosts/<host>/configuration.nix`,
|
|
||||||
which is a thin list of `imports` pulling in reusable pieces from `modules/`:
|
|
||||||
|
|
||||||
- `modules/common/configuration.nix` — base NixOS config imported by (almost)
|
|
||||||
every host: locale, users, nix settings, git. Nearly always the first import.
|
|
||||||
- `modules/common/home.nix` / `hosts/<host>/home.nix` — Home Manager config for
|
|
||||||
the `nixos` user; the `nixos` workstation has its own, other hosts share
|
|
||||||
`modules/common/home.nix`.
|
|
||||||
- `modules/disko/proxmox.nix` — declarative disk layout (GPT: ESP + swap +
|
|
||||||
ext4 root) via disko, used by all Proxmox-VM hosts.
|
|
||||||
- `modules/boot/efi.nix` — systemd-boot + EFI vars, paired with the disko module.
|
|
||||||
- `modules/hardware-configuration/vm/{proxmox,linode}.nix` — hypervisor-specific
|
|
||||||
hardware config, wired in from `flake.nix` (not from the host file).
|
|
||||||
- `modules/nix-cache/{client,server}.nix` + `modules/remote-builder-client.nix` —
|
|
||||||
binary cache substituter + SSH remote-builder wiring; see `docs/nix-cache.md`
|
|
||||||
for the full design (per-host local stores, no shared `/nix/store`, and how
|
|
||||||
the `nixremote` signing/SSH keys fit together).
|
|
||||||
- `modules/tailscale/`, `modules/docker/`, `modules/beszel/`,
|
|
||||||
`modules/services/*` — single-purpose, single-host feature modules (e.g.
|
|
||||||
`docker/enable-service.nix`, `services/zfs/enable-service.nix`,
|
|
||||||
`beszel/enable-agent.nix` for monitoring). Grep `hosts/*/configuration.nix`
|
|
||||||
for the `imports` list to see which modules apply to a given host.
|
|
||||||
|
|
||||||
New host = new `hosts/<name>/configuration.nix` + a matching block added to
|
|
||||||
`flake.nix`'s `nixosConfigurations`, composed from existing `modules/*` pieces
|
|
||||||
rather than duplicating config.
|
|
||||||
|
|
||||||
### Other docs worth reading before touching these areas
|
|
||||||
|
|
||||||
- `docs/nix-cache.md` — nix-cache binary cache/remote-builder design and key
|
|
||||||
handling.
|
|
||||||
- `docs/pxe-boot.md` — the `pxe-boot` host's iPXE/TFTP/HTTP boot chain and
|
|
||||||
directory layout under `/srv/pxe`.
|
|
||||||
- `docs/flake-lock-automation.md` — how `flake.lock` updates flow through CI
|
|
||||||
(scheduled `nix flake update` PR + host-eval-on-PR workflow) and why hosts
|
|
||||||
should track the committed lock file rather than `nixos-rebuild --upgrade-all`.
|
|
||||||
@@ -5,35 +5,17 @@ workstation.
|
|||||||
|
|
||||||
## Hosts
|
## Hosts
|
||||||
|
|
||||||
Targets are named `<platform>-<buildtype>`, generated from two orthogonal
|
This flake currently defines:
|
||||||
pieces composed in `flake.nix`:
|
|
||||||
|
|
||||||
- **Platforms** (what it runs on): `linode`, `proxmox`, `lxc`
|
| Host | Purpose |
|
||||||
- **Build types** (what it's for): `minimal`, `nix-cache`, `server`, `docker`,
|
|
||||||
`gui`, `pxe-boot`
|
|
||||||
|
|
||||||
Not every combination exists — `pxe-boot` has no `linode` variant, since
|
|
||||||
PXE/DHCP/TFTP need LAN L2 adjacency that a Linode VPS doesn't have. The full
|
|
||||||
list:
|
|
||||||
|
|
||||||
| Target | Purpose |
|
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `linode-minimal` | Minimal NixOS host profile on a Linode VPS (real, deployed) |
|
| `nixos` | Main NixOS workstation / Cinnamon desktop |
|
||||||
| `proxmox-minimal` | Minimal NixOS host profile on Proxmox (real, deployed — previously the flat `nix-minimal` target) |
|
| `docker` | Docker host for the main container stack |
|
||||||
| `lxc-minimal` | Minimal NixOS host profile in a Proxmox LXC container |
|
| `kuma` | Docker-enabled Uptime Kuma style host |
|
||||||
| `linode-nix-cache` / `proxmox-nix-cache` / `lxc-nix-cache` | Local Nix binary cache and remote builder (`proxmox-nix-cache` is the real, deployed one — previously the flat `nix-cache` target) |
|
| `server` | Storage, NFS, backup, and monitoring exporter host |
|
||||||
| `linode-server` / `proxmox-server` / `lxc-server` | Storage, NFS, backup, and monitoring exporter host (`proxmox-server` is the real, deployed one — previously the flat `server` target) |
|
| `nix-cache` | Local Nix binary cache and remote builder |
|
||||||
| `linode-docker` / `proxmox-docker` / `lxc-docker` | Docker host for the main container stack (`proxmox-docker` is the real, deployed one — previously the flat `docker` target) |
|
| `nix-minimal` | Minimal NixOS host profile with SSHFS tooling |
|
||||||
| `linode-gui` / `proxmox-gui` / `lxc-gui` | Cinnamon desktop workstation (`proxmox-gui` is the real, deployed one — previously the flat `nixos` target) |
|
| `pxe-boot` | HTTP/iPXE boot asset host |
|
||||||
| `proxmox-pxe-boot` / `lxc-pxe-boot` | HTTP/iPXE boot asset host (`proxmox-pxe-boot` is the real, deployed one — previously the flat `pxe-boot` target) |
|
|
||||||
|
|
||||||
Each buildtype's `hosts/<name>/host.nix` carries the per-machine identity
|
|
||||||
(hostname, hostId, per-machine secrets, `system.stateVersion`) that must stay
|
|
||||||
fixed regardless of which platform it's built for — see
|
|
||||||
`flake-target-refactor-spec.md` for the full rationale. Every deployed host
|
|
||||||
stamps its own active target name into `/etc/flake-target` at build time, so
|
|
||||||
`nixos-rebuild switch --flake .#$(cat /etc/flake-target)` always picks up the
|
|
||||||
right one even after a platform migration changes the flake attribute name.
|
|
||||||
|
|
||||||
List hosts with:
|
List hosts with:
|
||||||
|
|
||||||
@@ -45,13 +27,11 @@ nix eval --json .#nixosConfigurations --apply builtins.attrNames | jq -r '.[]'
|
|||||||
|
|
||||||
| Path | Purpose |
|
| Path | Purpose |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `flake.nix` | Flake inputs, the `mkTarget` platform × build-type generator, and `nixosConfigurations` outputs |
|
| `flake.nix` | Flake inputs and `nixosConfigurations` outputs |
|
||||||
| `hosts/<name>/host.nix` | Per-machine identity: hostname, hostId, per-machine secrets, `system.stateVersion` |
|
| `hosts/<host>/configuration.nix` | Host-specific NixOS configuration |
|
||||||
| `hosts/nixos/home.nix` | Workstation-specific Home Manager config (used by the `gui` build type) |
|
| `hosts/nixos/home.nix` | Workstation-specific Home Manager config |
|
||||||
| `modules/platforms/` | Platform-specific config: virtualisation guest tools, boot method, hardware config (`linode.nix`, `proxmox.nix`, `lxc.nix`) |
|
| `common/` | Shared NixOS, Home Manager, aliases, and hardware config |
|
||||||
| `modules/build-types/` | Build-type-specific config: what makes a system minimal/server/docker/gui/pxe-boot/nix-cache |
|
| `modules/nix/` | Binary cache and remote builder client/server modules |
|
||||||
| `modules/common/` | Shared NixOS config, Home Manager, aliases imported by every host |
|
|
||||||
| `modules/nix-cache/` | Binary cache and remote builder client/server modules |
|
|
||||||
| `docs/` | Operational notes for cache, builders, lock updates, and boot services |
|
| `docs/` | Operational notes for cache, builders, lock updates, and boot services |
|
||||||
| `scripts/` | Codex setup and validation helpers |
|
| `scripts/` | Codex setup and validation helpers |
|
||||||
|
|
||||||
@@ -86,25 +66,7 @@ review sessions.
|
|||||||
|
|
||||||
## Security Notes
|
## Security Notes
|
||||||
|
|
||||||
Do not commit tokens, private keys, live credentials, or new password hashes
|
Do not commit tokens, private keys, live credentials, or new password hashes.
|
||||||
as plaintext. Secrets are managed with [sops-nix](https://github.com/Mic92/sops-nix):
|
This repository currently contains committed password hashes in shared NixOS
|
||||||
encrypted files live under `secrets/`, recipients (per-host age keys derived
|
configuration; rotate those passwords and move hashes into host-local secret
|
||||||
from each host's existing SSH host key, plus an admin key) are declared in
|
management before treating the repository as public or widely shared.
|
||||||
`.sops.yaml`. To add or edit a secret:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
nix-shell -p sops --run "sops secrets/<file>.yaml"
|
|
||||||
```
|
|
||||||
|
|
||||||
then reference it from a module via `config.sops.secrets."<name>".path`
|
|
||||||
(or `sops.templates` for values that need to be embedded in a rendered
|
|
||||||
config file, e.g. `nix.conf`'s `access-tokens`). Never write a secret value
|
|
||||||
directly into a tracked `.nix` file. A pre-commit hook (`.githooks/`,
|
|
||||||
enabled via `git config core.hooksPath .githooks`, done automatically by
|
|
||||||
`scripts/codex-setup.sh`) runs `gitleaks protect --staged` to catch mistakes
|
|
||||||
before they're committed.
|
|
||||||
|
|
||||||
This repository's git *history* still contains secrets committed before this
|
|
||||||
migration (see `remove-sensetive-info-refactor.md`) — those are being
|
|
||||||
scrubbed and rotated separately; don't treat the repo as safe to make public
|
|
||||||
until that's finished.
|
|
||||||
@@ -8,10 +8,14 @@ and to verify that declared NixOS hosts still evaluate after dependency updates.
|
|||||||
- A scheduled workflow runs `nix flake update` once per week.
|
- A scheduled workflow runs `nix flake update` once per week.
|
||||||
- On GitHub, any resulting `flake.lock` change is proposed through a pull request.
|
- On GitHub, any resulting `flake.lock` change is proposed through a pull request.
|
||||||
- On Gitea, the workflow can commit and push `flake.lock` directly when PR automation is not configured.
|
- On Gitea, the workflow can commit and push `flake.lock` directly when PR automation is not configured.
|
||||||
- A separate CI workflow evaluates every configured host before merge, listed
|
- A separate CI workflow evaluates every configured host before merge:
|
||||||
dynamically via `nix eval --json .#nixosConfigurations --apply builtins.attrNames`
|
- `nixos`
|
||||||
rather than hand-enumerated, so it can't drift as `<platform>-<buildtype>`
|
- `docker`
|
||||||
targets are added or removed. See `README.md` for the current target list.
|
- `kuma`
|
||||||
|
- `server`
|
||||||
|
- `nix-cache`
|
||||||
|
- `nix-minimal`
|
||||||
|
- `pxe-boot`
|
||||||
|
|
||||||
## Why hosts should stop using `--upgrade-all`
|
## Why hosts should stop using `--upgrade-all`
|
||||||
|
|
||||||
@@ -20,15 +24,9 @@ and to verify that declared NixOS hosts still evaluate after dependency updates.
|
|||||||
Recommended rebuild command:
|
Recommended rebuild command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo nixos-rebuild switch --flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
sudo nixos-rebuild switch --flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(hostname)
|
||||||
```
|
```
|
||||||
|
|
||||||
Flake attribute names are `<platform>-<buildtype>` (e.g. `proxmox-docker`)
|
|
||||||
and no longer match `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, which is what the
|
|
||||||
command above reads.
|
|
||||||
|
|
||||||
Using the committed lock file keeps all hosts aligned and makes updates auditable through CI and code review.
|
Using the committed lock file keeps all hosts aligned and makes updates auditable through CI and code review.
|
||||||
|
|
||||||
Codex and automated review sessions must not run rebuilds. Limit checks to
|
Codex and automated review sessions must not run rebuilds. Limit checks to
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
# Spec: Refactor Flake Targets into Platform × Build-Type Matrix
|
|
||||||
|
|
||||||
## Context
|
|
||||||
|
|
||||||
The flake at `~/nixos` currently defines these output targets (flat, ad-hoc naming):
|
|
||||||
|
|
||||||
- `docker`
|
|
||||||
- `linode-minimal`
|
|
||||||
- `nix-cache`
|
|
||||||
- `nix-minimal`
|
|
||||||
- `nixos`
|
|
||||||
- `server`
|
|
||||||
- `pxe-boot`
|
|
||||||
|
|
||||||
Some already follow a `platform-buildtype` convention (`linode-minimal`), most don't.
|
|
||||||
`~/nix-auto-installer` is a related repo and should be checked for any coupling to
|
|
||||||
these target names (scripts, docs, CI, or install automation that reference them by
|
|
||||||
name) before renaming anything.
|
|
||||||
|
|
||||||
## Goal
|
|
||||||
|
|
||||||
Restructure the flake so targets are generated from two orthogonal concepts:
|
|
||||||
|
|
||||||
**Build types** (what the system is for):
|
|
||||||
- `minimal`
|
|
||||||
- `nix-cache`
|
|
||||||
- `server`
|
|
||||||
- `docker`
|
|
||||||
- `pxe-boot`
|
|
||||||
- `gui`
|
|
||||||
|
|
||||||
**Platforms** (what it's deployed on):
|
|
||||||
- `linode` (Linode VM)
|
|
||||||
- `proxmox` (Proxmox VM)
|
|
||||||
- `lxc` (Proxmox LXC container)
|
|
||||||
|
|
||||||
Final targets should be named consistently as `<platform>-<buildtype>`, e.g.:
|
|
||||||
|
|
||||||
```
|
|
||||||
linode-minimal proxmox-minimal lxc-minimal
|
|
||||||
linode-nix-cache proxmox-nix-cache lxc-nix-cache
|
|
||||||
linode-server proxmox-server lxc-server
|
|
||||||
linode-docker proxmox-docker lxc-docker
|
|
||||||
linode-pxe-boot proxmox-pxe-boot lxc-pxe-boot
|
|
||||||
linode-gui proxmox-gui lxc-gui
|
|
||||||
```
|
|
||||||
|
|
||||||
That's the full matrix (18 targets) if every build type applies to every platform.
|
|
||||||
See **Open Questions** below — some combinations may not make sense and should be
|
|
||||||
confirmed with me before being built out, not silently included or dropped.
|
|
||||||
|
|
||||||
## Migration mapping (old → new)
|
|
||||||
|
|
||||||
| Old target | New target | Notes |
|
|
||||||
|--------------------|------------------------------------------------------|-------|
|
|
||||||
| `linode-minimal` | `linode-minimal` | Already correct, keep as-is |
|
|
||||||
| `nix-minimal` | likely `proxmox-minimal` or a platform-less base module | Ambiguous — see Open Questions |
|
|
||||||
| `nix-cache` | base module consumed by `linode-nix-cache`, `proxmox-nix-cache`, `lxc-nix-cache` | Currently platform-less; needs to become a build-type module, not a standalone target |
|
|
||||||
| `server` | base module consumed by `linode-server`, `proxmox-server`, `lxc-server` | Same as above |
|
|
||||||
| `docker` | base module consumed by `linode-docker`, `proxmox-docker`, `lxc-docker` | Confirm docker actually makes sense as an LXC/VM guest build vs. a standalone container image — see Open Questions |
|
|
||||||
| `pxe-boot` | TBD — may stay a single target rather than a per-platform one | See Open Questions |
|
|
||||||
| `nixos` | TBD — unclear what this maps to in the new scheme | See Open Questions |
|
|
||||||
|
|
||||||
## Open Questions (Claude Code: raise these with me before implementing, don't guess)
|
|
||||||
|
|
||||||
1. **`nixos` target** — what is this currently used for (bare metal install, dev
|
|
||||||
shell, template)? It doesn't obviously map to any of the six build types.
|
|
||||||
2. **`nix-minimal` vs `linode-minimal`** — are these two different things, or is
|
|
||||||
`nix-minimal` a leftover/duplicate?
|
|
||||||
3. **`pxe-boot` and `gui` across all three platforms** — does PXE boot make sense
|
|
||||||
for an LXC container or a cloud VM (Linode), or is it inherently bare-metal/
|
|
||||||
network-boot only and should remain a single non-platform target? Does `gui`
|
|
||||||
make sense inside an LXC container?
|
|
||||||
4. **`docker` as a build type** — is this "a NixOS host configured to run Docker"
|
|
||||||
(which would sensibly have linode/proxmox/lxc variants), or "a Docker container
|
|
||||||
image built by the flake" (which wouldn't take a platform prefix at all, since
|
|
||||||
it doesn't run on Linode/Proxmox/LXC as a guest OS)? These are structurally
|
|
||||||
different and change how it should be wired in.
|
|
||||||
5. Confirm whether all 18 combinations should actually exist, or whether this is
|
|
||||||
meant to produce only the combinations that are genuinely useful (e.g. maybe no
|
|
||||||
one needs `lxc-pxe-boot`).
|
|
||||||
|
|
||||||
## Implementation approach
|
|
||||||
|
|
||||||
1. **Inventory first.** Read the current `flake.nix` and any `nixosConfigurations`/
|
|
||||||
`modules` structure. Map every existing target to what module(s) it actually
|
|
||||||
pulls in. Don't assume — confirm against the real file contents.
|
|
||||||
2. **Separate build-type and platform into their own module directories**, e.g.:
|
|
||||||
```
|
|
||||||
modules/build-types/minimal.nix
|
|
||||||
modules/build-types/nix-cache.nix
|
|
||||||
modules/build-types/server.nix
|
|
||||||
modules/build-types/docker.nix
|
|
||||||
modules/build-types/pxe-boot.nix
|
|
||||||
modules/build-types/gui.nix
|
|
||||||
|
|
||||||
modules/platforms/linode.nix
|
|
||||||
modules/platforms/proxmox.nix
|
|
||||||
modules/platforms/lxc.nix
|
|
||||||
```
|
|
||||||
Build-type modules should contain only what makes a system "minimal" vs
|
|
||||||
"server" vs "gui", etc. Platform modules should contain only what's specific
|
|
||||||
to running as a Linode VM vs Proxmox VM vs LXC container (virtualisation
|
|
||||||
guest tools, boot method, filesystem/image format, LXC-specific constraints
|
|
||||||
like no kernel modules, etc).
|
|
||||||
3. **Generate the target matrix programmatically** in `flake.nix` rather than
|
|
||||||
hand-writing 18 near-identical `nixosConfigurations` entries — e.g. a small
|
|
||||||
function that takes a platform name and build-type name, composes the two
|
|
||||||
modules plus any shared base module, and produces the named output. This
|
|
||||||
keeps future build types/platforms a one-line addition rather than a copy-paste
|
|
||||||
job.
|
|
||||||
4. **Only build combinations we've confirmed make sense** (see Open Questions) —
|
|
||||||
don't emit all 18 by default if some are structurally invalid.
|
|
||||||
5. **Preserve existing working configs during the transition.** Don't delete the
|
|
||||||
old target names until their replacements build successfully — rename/alias
|
|
||||||
at the end, not the start, so there's no window where the flake is broken.
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
For every new target produced:
|
|
||||||
```bash
|
|
||||||
nix flake check
|
|
||||||
nix build .#nixosConfigurations.<target>.config.system.build.toplevel
|
|
||||||
```
|
|
||||||
Confirm each builds without evaluation errors before considering it done. If a
|
|
||||||
target fails to build, report which one and why rather than silently skipping it.
|
|
||||||
|
|
||||||
## Deliverables
|
|
||||||
|
|
||||||
- Refactored `flake.nix` using the composed module + generated-matrix approach.
|
|
||||||
- New `modules/build-types/*.nix` and `modules/platforms/*.nix` files.
|
|
||||||
- Old flat target names removed only after their replacements are verified.
|
|
||||||
- A short `README.md` (or section in existing docs) listing the final target
|
|
||||||
names and what each one is for.
|
|
||||||
- A summary at the end of what changed, what was removed, and any of the Open
|
|
||||||
Questions above that got resolved differently than expected.
|
|
||||||
|
|
||||||
## Out of scope
|
|
||||||
|
|
||||||
- Don't touch `~/nix-auto-installer` contents beyond checking it for references
|
|
||||||
to the old target names — if changes there are needed, flag them, don't make
|
|
||||||
them without confirming.
|
|
||||||
- Don't add new build types or platforms beyond the ones listed here.
|
|
||||||
Generated
+1
-22
@@ -166,8 +166,7 @@
|
|||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nixos-conf-editor": "nixos-conf-editor",
|
"nixos-conf-editor": "nixos-conf-editor",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2"
|
||||||
"sops-nix": "sops-nix"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"snowfall-lib": {
|
"snowfall-lib": {
|
||||||
@@ -193,26 +192,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sops-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1783174389,
|
|
||||||
"narHash": "sha256-aCWC8ngycU7OdJrU2+Je3qf+1a2ykuBvpPhZT/9tXMc=",
|
|
||||||
"owner": "Mic92",
|
|
||||||
"repo": "sops-nix",
|
|
||||||
"rev": "f1406619a3884cd5c47992a70b8b35c9c0fcb4c9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "Mic92",
|
|
||||||
"repo": "sops-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|||||||
@@ -12,81 +12,149 @@
|
|||||||
url = "github:nix-community/disko";
|
url = "github:nix-community/disko";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
sops-nix = {
|
|
||||||
url = "github:Mic92/sops-nix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixos-conf-editor, home-manager, sops-nix, ... } @ inputs:
|
outputs = { self, nixpkgs, nixos-conf-editor, home-manager, ... } @ inputs:
|
||||||
|
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit (nixpkgs) lib;
|
|
||||||
|
|
||||||
# Generates a nixosConfiguration from a platform (what it runs on) and
|
# 🔧 Docker override (pin version here)
|
||||||
# a build type (what it's for), plus the per-identity host.nix that
|
# dockerOverlay = final: prev: {
|
||||||
# carries the bits that must stay fixed regardless of platform
|
# docker = prev.docker_29;
|
||||||
# (hostName, hostId, per-machine secrets). Every build type except
|
# docker_cli = prev.docker_29;
|
||||||
# nix-cache itself consumes the nix-cache substituter and remote
|
# };
|
||||||
# builder.
|
|
||||||
mkTarget = { platform, buildType, hostPath, homeFile ? ./modules/common/home.nix }:
|
in {
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
|
nixosConfigurations = {
|
||||||
|
|
||||||
|
nixos = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
inputs.disko.nixosModules.disko
|
./hosts/nixos/configuration.nix
|
||||||
sops-nix.nixosModules.sops
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
./modules/common/configuration.nix
|
|
||||||
./modules/platforms/${platform}.nix
|
home-manager.nixosModules.home-manager {
|
||||||
./modules/build-types/${buildType}.nix
|
home-manager.useGlobalPkgs = true;
|
||||||
hostPath
|
home-manager.useUserPackages = true;
|
||||||
{ environment.etc."flake-target".text = "${platform}-${buildType}"; }
|
home-manager.users.nixos = import ./hosts/nixos/home.nix;
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
users.nixos = import homeFile;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
] ++ lib.optionals (buildType != "nix-cache") [
|
|
||||||
./modules/nix-cache/client.nix
|
|
||||||
./modules/remote-builder-client.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
};
|
};
|
||||||
|
|
||||||
# Generated platform x build-type matrix. pxe-boot has no linode
|
docker = nixpkgs.lib.nixosSystem {
|
||||||
# variant (PXE/DHCP/TFTP need LAN L2 adjacency, which a Linode VPS
|
inherit system;
|
||||||
# doesn't have).
|
|
||||||
generatedTargets = {
|
|
||||||
linode-minimal = mkTarget { platform = "linode"; buildType = "minimal"; hostPath = ./hosts/linode-minimal/host.nix; };
|
|
||||||
proxmox-minimal = mkTarget { platform = "proxmox"; buildType = "minimal"; hostPath = ./hosts/proxmox-minimal/host.nix; };
|
|
||||||
lxc-minimal = mkTarget { platform = "lxc"; buildType = "minimal"; hostPath = ./hosts/lxc-minimal/host.nix; };
|
|
||||||
|
|
||||||
linode-nix-cache = mkTarget { platform = "linode"; buildType = "nix-cache"; hostPath = ./hosts/nix-cache/host.nix; };
|
# 🔧 create custom pkgs with overlay
|
||||||
proxmox-nix-cache = mkTarget { platform = "proxmox"; buildType = "nix-cache"; hostPath = ./hosts/nix-cache/host.nix; };
|
pkgs = import nixpkgs {
|
||||||
lxc-nix-cache = mkTarget { platform = "lxc"; buildType = "nix-cache"; hostPath = ./hosts/nix-cache/host.nix; };
|
inherit system;
|
||||||
|
|
||||||
linode-server = mkTarget { platform = "linode"; buildType = "server"; hostPath = ./hosts/server/host.nix; };
|
overlays = [
|
||||||
proxmox-server = mkTarget { platform = "proxmox"; buildType = "server"; hostPath = ./hosts/server/host.nix; };
|
(final: prev: {
|
||||||
lxc-server = mkTarget { platform = "lxc"; buildType = "server"; hostPath = ./hosts/server/host.nix; };
|
docker = prev.docker_29;
|
||||||
|
docker_cli = prev.docker_29;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
linode-docker = mkTarget { platform = "linode"; buildType = "docker"; hostPath = ./hosts/docker/host.nix; };
|
modules = [
|
||||||
proxmox-docker = mkTarget { platform = "proxmox"; buildType = "docker"; hostPath = ./hosts/docker/host.nix; };
|
./hosts/docker/configuration.nix
|
||||||
lxc-docker = mkTarget { platform = "lxc"; buildType = "docker"; hostPath = ./hosts/docker/host.nix; };
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
linode-gui = mkTarget { platform = "linode"; buildType = "gui"; hostPath = ./hosts/nixos/host.nix; homeFile = ./hosts/nixos/home.nix; };
|
home-manager.nixosModules.home-manager {
|
||||||
proxmox-gui = mkTarget { platform = "proxmox"; buildType = "gui"; hostPath = ./hosts/nixos/host.nix; homeFile = ./hosts/nixos/home.nix; };
|
home-manager.useGlobalPkgs = true;
|
||||||
lxc-gui = mkTarget { platform = "lxc"; buildType = "gui"; hostPath = ./hosts/nixos/host.nix; homeFile = ./hosts/nixos/home.nix; };
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
kuma = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./hosts/kuma/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
proxmox-pxe-boot = mkTarget { platform = "proxmox"; buildType = "pxe-boot"; hostPath = ./hosts/pxe-boot/host.nix; };
|
home-manager.nixosModules.home-manager {
|
||||||
lxc-pxe-boot = mkTarget { platform = "lxc"; buildType = "pxe-boot"; hostPath = ./hosts/pxe-boot/host.nix; };
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
server = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./hosts/server/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nix-cache = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./hosts/nix-cache/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nix-minimal = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
./hosts/nix-minimal/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
pxe-boot = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./hosts/pxe-boot/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/proxmox.nix
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
linode-minimal = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./hosts/linode/configuration.nix
|
||||||
|
./modules/hardware-configuration/vm/linode.nix
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.nixos = import ./modules/common/home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
nixosConfigurations = generatedTargets;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page, on
|
||||||
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
|
{ config, lib, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix-cache/client.nix
|
||||||
|
../../modules/remote-builder-client.nix
|
||||||
|
../../modules/docker/mount-data.nix
|
||||||
|
../../modules/docker/enable-service.nix
|
||||||
|
../../modules/tailscale/enable-service.nix
|
||||||
|
../../modules/rotate-traefik-logs.nix
|
||||||
|
../../modules/raspi/mount-data.nix
|
||||||
|
../../modules/services/nextcloud-cron-job.nix
|
||||||
|
../../modules/services/docker-health-to-gotify.nix
|
||||||
|
../../modules/services/enable-rpcbind.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
networking.hostName = "docker"; # Define your hostname.
|
||||||
|
networking.hostId = "007f0200";
|
||||||
|
boot.zfs.forceImportRoot = false;
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nfs-utils
|
||||||
|
];
|
||||||
|
boot.supportedFilesystems = [ "nfs" ];
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"L+ /home/nixos/docker - - - - /mnt/docker/config"
|
||||||
|
"d /mnt/docker 0755 nixos users -"
|
||||||
|
"d /mnt/raspi-backup 0755 nixos users -"
|
||||||
|
];
|
||||||
|
users.users.nixos.extraGroups = [ "docker" ];
|
||||||
|
services.openssh.settings.PermitRootLogin = "yes";
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 8080 443 8090 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||||
|
# to actually do that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.sta>
|
||||||
|
system.stateVersion = "25.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "docker";
|
|
||||||
networking.hostId = "007f0200";
|
|
||||||
boot.zfs.forceImportRoot = false;
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `docker` target — stateVersion must never
|
|
||||||
# be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "linode-minimal";
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `linode-minimal` target — stateVersion
|
|
||||||
# must never be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "26.05";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page, on
|
||||||
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Use the GRUB 2 boot loader.
|
||||||
|
boot.loader.grub.enable = true;
|
||||||
|
# boot.loader.grub.efiSupport = true;
|
||||||
|
# boot.loader.grub.efiInstallAsRemovable = true;
|
||||||
|
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
||||||
|
# Define on which hard drive you want to install Grub.
|
||||||
|
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
|
||||||
|
|
||||||
|
# networking.hostName = "nixos"; # Define your hostname.
|
||||||
|
|
||||||
|
# Configure network connections interactively with nmcli or nmtui.
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
# time.timeZone = "Europe/Amsterdam";
|
||||||
|
|
||||||
|
# Configure network proxy if necessary
|
||||||
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||||
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
# i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
# console = {
|
||||||
|
# font = "Lat2-Terminus16";
|
||||||
|
# keyMap = "us";
|
||||||
|
# useXkbConfig = true; # use xkb.options in tty.
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Enable the X11 windowing system.
|
||||||
|
# services.xserver.enable = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Configure keymap in X11
|
||||||
|
# services.xserver.xkb.layout = "us";
|
||||||
|
# services.xserver.xkb.options = "eurosign:e,caps:escape";
|
||||||
|
|
||||||
|
# Enable CUPS to print documents.
|
||||||
|
# services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable sound.
|
||||||
|
# services.pulseaudio.enable = true;
|
||||||
|
# OR
|
||||||
|
# services.pipewire = {
|
||||||
|
# enable = true;
|
||||||
|
# pulse.enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
|
# services.libinput.enable = true;
|
||||||
|
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
# users.users.alice = {
|
||||||
|
# isNormalUser = true;
|
||||||
|
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||||
|
# packages = with pkgs; [
|
||||||
|
# tree
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
|
||||||
|
# programs.firefox.enable = true;
|
||||||
|
|
||||||
|
# List packages installed in system profile.
|
||||||
|
# You can use https://search.nixos.org/ to find more packages (and options).
|
||||||
|
# environment.systemPackages = with pkgs; [
|
||||||
|
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||||
|
# wget
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# Some programs need SUID wrappers, can be configured further or are
|
||||||
|
# started in user sessions.
|
||||||
|
# programs.mtr.enable = true;
|
||||||
|
# programs.gnupg.agent = {
|
||||||
|
# enable = true;
|
||||||
|
# enableSSHSupport = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
inetutils
|
||||||
|
mtr
|
||||||
|
sysstat
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.nixos = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/nixos";
|
||||||
|
description = "nixos";
|
||||||
|
extraGroups = [ "wheel" "networkmanager" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.usePredictableInterfaceNames = false;
|
||||||
|
networking.useDHCP = false;
|
||||||
|
networking.interfaces.eth0.useDHCP = true;
|
||||||
|
|
||||||
|
# Enable the OpenSSH daemon.
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
# settings.permitRootLogin = "yes";
|
||||||
|
};
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||||
|
# to actually do that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||||
|
system.stateVersion = "26.05"; # Did you read the comment?
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "lxc-minimal";
|
|
||||||
|
|
||||||
# No pre-existing deployed machine to preserve — pin explicitly to the
|
|
||||||
# current release rather than let it silently default.
|
|
||||||
system.stateVersion = "26.05";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page, on
|
||||||
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
|
{ config, lib, pkgs, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix-cache/server.nix
|
||||||
|
../../modules/beszel/enable-agent.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "nix-cache"; # Define your hostname.
|
||||||
|
|
||||||
|
services.beszel.agent.environment = {
|
||||||
|
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
||||||
|
#HUB_URL = "http://docker.sweet.home:8090";
|
||||||
|
KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPR9kwtC4TAeTRu46A7+opZsYpxqkRJ+x/ZyB2GWCeG";
|
||||||
|
TOKEN = "c9192e4c-7b5d-4910-8241-c2d68afadbac";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ 80 8080 443 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||||
|
# to actually do that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.sta>
|
||||||
|
system.stateVersion = "25.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{ config, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "nix-cache";
|
|
||||||
|
|
||||||
sops.secrets."beszel-token".sopsFile = ../../secrets/nix-cache.yaml;
|
|
||||||
sops.templates."nix-cache-beszel.env".content = ''
|
|
||||||
TOKEN=${config.sops.placeholder."beszel-token"}
|
|
||||||
'';
|
|
||||||
|
|
||||||
services.beszel.agent.environment = {
|
|
||||||
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
|
||||||
#HUB_URL = "http://docker.sweet.home:8090";
|
|
||||||
KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPR9kwtC4TAeTRu46A7+opZsYpxqkRJ+x/ZyB2GWCeG";
|
|
||||||
};
|
|
||||||
services.beszel.agent.environmentFile = config.sops.templates."nix-cache-beszel.env".path;
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `nix-cache` target — stateVersion must
|
|
||||||
# never be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page, on
|
||||||
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
# inputs.disko.nixosModules.disko
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix-cache/client.nix
|
||||||
|
../../modules/remote-builder-client.nix
|
||||||
|
../../modules/disko/proxmox.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "nix-minimal"; # Define your hostname.
|
||||||
|
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ 80 8080 443 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||||
|
# to actually do that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.sta>
|
||||||
|
system.stateVersion = "25.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
|
{ config, pkgs, lib, inputs, ... }:
|
||||||
|
let
|
||||||
|
nixosConfEditor = builtins.getFlake "github:snowfallorg/nixos-conf-editor";
|
||||||
|
in {
|
||||||
|
#{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
inputs.nixos-conf-editor.packages.${pkgs.system}.nixos-conf-editor
|
||||||
|
nodejs
|
||||||
|
appimage-run
|
||||||
|
seahorse
|
||||||
|
vscode
|
||||||
|
p7zip
|
||||||
|
popsicle # balena-etcher
|
||||||
|
shotcut
|
||||||
|
gimp
|
||||||
|
pdfarranger
|
||||||
|
terminator
|
||||||
|
libreoffice-qt
|
||||||
|
transmission_4-qt
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix/cache-client.nix
|
||||||
|
../../modules/nix/remote-builder-client.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Bootloader.
|
||||||
|
boot.loader.grub.useOSProber = true;
|
||||||
|
|
||||||
|
networking.hostName = "nixos"; # Define your hostname.
|
||||||
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
# i18n.defaultLocale = "en_AU.UTF-8";
|
||||||
|
|
||||||
|
# i18n.extraLocaleSettings = {
|
||||||
|
# LC_ADDRESS = "en_AU.UTF-8";
|
||||||
|
# LC_IDENTIFICATION = "en_AU.UTF-8";
|
||||||
|
# LC_MEASUREMENT = "en_AU.UTF-8";
|
||||||
|
# LC_MONETARY = "en_AU.UTF-8";
|
||||||
|
# LC_NAME = "en_AU.UTF-8";
|
||||||
|
# LC_NUMERIC = "en_AU.UTF-8";
|
||||||
|
# LC_PAPER = "en_AU.UTF-8";
|
||||||
|
# LC_TELEPHONE = "en_AU.UTF-8";
|
||||||
|
# LC_TIME = "en_AU.UTF-8";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Enable the X11 windowing system.
|
||||||
|
services.xserver.enable = true;
|
||||||
|
|
||||||
|
# Enable the Cinnamon Desktop Environment.
|
||||||
|
services.xserver.displayManager.lightdm.enable = true;
|
||||||
|
services.xserver.desktopManager.cinnamon.enable = true;
|
||||||
|
# services.xserver.desktopManager.xfce.enable = true;
|
||||||
|
|
||||||
|
# Configure keymap in X11
|
||||||
|
services.xserver.xkb = {
|
||||||
|
layout = "au";
|
||||||
|
variant = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable CUPS to print documents.
|
||||||
|
services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable sound with pipewire.
|
||||||
|
# services.pulseaudio.enable = false;
|
||||||
|
security.rtkit.enable = true;
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
# If you want to use JACK applications, uncomment this
|
||||||
|
#jack.enable = true;
|
||||||
|
|
||||||
|
# use the example session manager (no others are packaged yet so this is enabled by default,
|
||||||
|
# no need to redefine it in your config for now)
|
||||||
|
#media-session.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
|
# services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
|
users.users.nixos.extraGroups = [ "networkmanager" ]; # Enable ‘sudo’ for the user.
|
||||||
|
|
||||||
|
# Install firefox.
|
||||||
|
programs.firefox.enable = true;
|
||||||
|
|
||||||
|
system.stateVersion = "25.05"; # Did you read the comment?
|
||||||
|
|
||||||
|
services.xrdp.enable = true;
|
||||||
|
services.xrdp.defaultWindowManager = "cinnamon-session";
|
||||||
|
services.xrdp.openFirewall = true;
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
services.gnome.gnome-keyring.enable = true;
|
||||||
|
|
||||||
|
# security.pam.services.lightdm.enableGnomeKeyring = true;
|
||||||
|
|
||||||
|
# services.gnome.gnome-keyring.enable = true;
|
||||||
|
security.pam.services.login.enableGnomeKeyring = true;
|
||||||
|
|
||||||
|
services.xserver.displayManager.sessionCommands = ''
|
||||||
|
eval $(gnome-keyring-daemon --start --components=secrets,ssh)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
'';
|
||||||
|
|
||||||
|
# systemd.services.nextcloud-appimage = {
|
||||||
|
# enable = true;
|
||||||
|
# Unit = {
|
||||||
|
# Description = "Nextcloud AppImage client";
|
||||||
|
# After = [ "graphical-session.target" ];
|
||||||
|
# Wants = [ "graphical-session.target" ]; # optional but helpful
|
||||||
|
# };
|
||||||
|
# Service = {
|
||||||
|
# ExecStart = "/run/current-system/sw/bin/appimage-run /home/nixos/Applications/Nextcloud.AppImage --background";
|
||||||
|
# Restart = "on-failure";
|
||||||
|
# # You can add RestartSec = "5s"; if you like
|
||||||
|
# };
|
||||||
|
# Install = {
|
||||||
|
# WantedBy = [ "default.target" ];
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
../../modules/common/aliases.nix
|
../../common/aliases.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.username = "nixos"; # your actual username
|
home.username = "nixos"; # your actual username
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "nixos";
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `nixos` target — stateVersion must never
|
|
||||||
# be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# Preserves the hostname of the existing, already-deployed machine
|
|
||||||
# (previously the flat `nix-minimal` target) — the flake attribute name
|
|
||||||
# changed, the real machine's hostname did not.
|
|
||||||
networking.hostName = "nix-minimal";
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `nix-minimal` target — stateVersion must
|
|
||||||
# never be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -91,6 +91,15 @@ let
|
|||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix/cache-client.nix
|
||||||
|
../../modules/nix/remote-builder-client.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "pxe-boot";
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
ipxe
|
ipxe
|
||||||
];
|
];
|
||||||
@@ -153,4 +162,6 @@ in
|
|||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 69 ];
|
networking.firewall.allowedUDPPorts = [ 69 ];
|
||||||
|
|
||||||
|
system.stateVersion = "25.05";
|
||||||
}
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "pxe-boot";
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `pxe-boot` target — stateVersion must
|
|
||||||
# never be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page, on
|
||||||
|
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||||
|
|
||||||
|
{ config, lib, pkgs, inputs,... }:
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
../../modules/common/configuration.nix
|
||||||
|
../../modules/nix-cache/client.nix
|
||||||
|
../../modules/remote-builder-client.nix
|
||||||
|
../../modules/beszel/enable-agent.nix
|
||||||
|
../../modules/services/enable-rpcbind.nix
|
||||||
|
../../modules/services/zfs/enable-service.nix
|
||||||
|
# ../../modules/services/zfs/auto-mount-volumes.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
networking.hostName = "server"; # Define your hostname.
|
||||||
|
networking.hostId = "6689f93e";
|
||||||
|
|
||||||
|
boot.zfs.extraPools = [ "tank" ];
|
||||||
|
|
||||||
|
services.beszel.agent.environment = {
|
||||||
|
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
||||||
|
#HUB_URL = "http://docker.sweet.home:8090";
|
||||||
|
KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPR9kwtC4TAeTRu46A7+opZsYpxqkRJ+x/ZyB2GWCeG";
|
||||||
|
TOKEN = "48e71783-35df-4ea0-a8c2-05bc5e020d2e";
|
||||||
|
EXTRA_FILESYSTEMS="/tank/docker/volumes";
|
||||||
|
LOG_LEVEL="debug";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
systemd.services.nfs-server = {
|
||||||
|
after = [ "zfs-mount.service" ];
|
||||||
|
requires = [ "zfs-mount.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nfs.server = {
|
||||||
|
enable = true;
|
||||||
|
exports = ''
|
||||||
|
/tank/docker/config 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
|
/tank/docker/volumes 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
|
/tank/docker/databases 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
|
/tank/docker/nextcloud-data 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
|
/tank/raspi/volumes 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 111 2049 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
|
||||||
|
# Copy the NixOS configuration file and link it from the resulting system
|
||||||
|
# (/run/current-system/configuration.nix). This is useful in case you
|
||||||
|
# accidentally delete configuration.nix.
|
||||||
|
# system.copySystemConfiguration = true;
|
||||||
|
|
||||||
|
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||||
|
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||||
|
#
|
||||||
|
# Most users should NEVER change this value after the initial install, for any reason,
|
||||||
|
# even if you've upgraded your system to a new NixOS release.
|
||||||
|
#
|
||||||
|
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||||
|
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||||
|
# to actually do that.
|
||||||
|
#
|
||||||
|
# This value being lower than the current NixOS release does NOT mean your system is
|
||||||
|
# out of date, out of support, or vulnerable.
|
||||||
|
#
|
||||||
|
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||||
|
# and migrated your data accordingly.
|
||||||
|
#
|
||||||
|
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.sta>
|
||||||
|
system.stateVersion = "25.05"; # Did you read the comment?
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{ config, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.hostName = "server";
|
|
||||||
networking.hostId = "6689f93e";
|
|
||||||
|
|
||||||
sops.secrets."beszel-token".sopsFile = ../../secrets/server.yaml;
|
|
||||||
sops.templates."server-beszel.env".content = ''
|
|
||||||
TOKEN=${config.sops.placeholder."beszel-token"}
|
|
||||||
'';
|
|
||||||
|
|
||||||
services.beszel.agent.environment = {
|
|
||||||
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
|
||||||
#HUB_URL = "http://docker.sweet.home:8090";
|
|
||||||
KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPR9kwtC4TAeTRu46A7+opZsYpxqkRJ+x/ZyB2GWCeG";
|
|
||||||
EXTRA_FILESYSTEMS = "/tank/docker/volumes";
|
|
||||||
LOG_LEVEL = "debug";
|
|
||||||
};
|
|
||||||
services.beszel.agent.environmentFile = config.sops.templates."server-beszel.env".path;
|
|
||||||
|
|
||||||
# Preserved from the pre-refactor `server` target — stateVersion must never
|
|
||||||
# be bumped on an already-installed machine.
|
|
||||||
system.stateVersion = "25.05";
|
|
||||||
}
|
|
||||||
@@ -5,5 +5,7 @@ services.beszel.agent.enable = true;
|
|||||||
services.beszel.agent.environment = {
|
services.beszel.agent.environment = {
|
||||||
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
#DOCKER_HOST = "tcp://docker-socket-proxy:2375";
|
||||||
HUB_URL = "http://docker.sweet.home:8090";
|
HUB_URL = "http://docker.sweet.home:8090";
|
||||||
|
#KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA2Snq66P/6GwTEafKuu3D/V1f7ofjKL9GD6ik+Kf/Gn";
|
||||||
|
#TOKEN = "235b3-25a94f482-84576-40d34c48";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# Pins the Docker Engine version, carried forward from the pre-refactor
|
|
||||||
# `docker` target's inline pkgs overlay.
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(final: prev: {
|
|
||||||
docker = prev.docker_29;
|
|
||||||
docker_cli = prev.docker_29;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
../docker/mount-data.nix
|
|
||||||
../docker/enable-service.nix
|
|
||||||
../tailscale/enable-service.nix
|
|
||||||
../rotate-traefik-logs.nix
|
|
||||||
../raspi/mount-data.nix
|
|
||||||
../services/nextcloud-cron-job.nix
|
|
||||||
../services/docker-health-to-gotify.nix
|
|
||||||
../services/enable-rpcbind.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
nfs-utils
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.supportedFilesystems = [ "nfs" ];
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"L+ /home/nixos/docker - - - - /mnt/docker/config"
|
|
||||||
"d /mnt/docker 0755 nixos users -"
|
|
||||||
"d /mnt/raspi-backup 0755 nixos users -"
|
|
||||||
];
|
|
||||||
|
|
||||||
users.users.nixos.extraGroups = [ "docker" ];
|
|
||||||
services.openssh.settings.PermitRootLogin = "yes";
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 8080 443 8090 ];
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
{ config, pkgs, lib, inputs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
inputs.nixos-conf-editor.packages.${pkgs.system}.nixos-conf-editor
|
|
||||||
nodejs
|
|
||||||
appimage-run
|
|
||||||
seahorse
|
|
||||||
vscode
|
|
||||||
p7zip
|
|
||||||
popsicle # balena-etcher
|
|
||||||
shotcut
|
|
||||||
gimp
|
|
||||||
pdfarranger
|
|
||||||
terminator
|
|
||||||
libreoffice-qt
|
|
||||||
transmission_4-qt
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.loader.grub.useOSProber = true;
|
|
||||||
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.xserver.displayManager.lightdm.enable = true;
|
|
||||||
services.xserver.desktopManager.cinnamon.enable = true;
|
|
||||||
|
|
||||||
services.xserver.xkb = {
|
|
||||||
layout = "au";
|
|
||||||
variant = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
services.printing.enable = true;
|
|
||||||
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users.nixos.extraGroups = [ "networkmanager" ];
|
|
||||||
|
|
||||||
programs.firefox.enable = true;
|
|
||||||
|
|
||||||
services.xrdp.enable = true;
|
|
||||||
services.xrdp.defaultWindowManager = "cinnamon-session";
|
|
||||||
services.xrdp.openFirewall = true;
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
services.gnome.gnome-keyring.enable = true;
|
|
||||||
security.pam.services.login.enableGnomeKeyring = true;
|
|
||||||
|
|
||||||
services.xserver.displayManager.sessionCommands = ''
|
|
||||||
eval $(gnome-keyring-daemon --start --components=secrets,ssh)
|
|
||||||
export SSH_AUTH_SOCK
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
users.users.nixos.extraGroups = [ "networkmanager" ];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
inetutils
|
|
||||||
mtr
|
|
||||||
sysstat
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
../nix-cache/server.nix
|
|
||||||
../beszel/enable-agent.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
../beszel/enable-agent.nix
|
|
||||||
../services/zfs/enable-service.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.zfs.extraPools = [ "tank" ];
|
|
||||||
|
|
||||||
systemd.services.nfs-server = {
|
|
||||||
after = [ "zfs-mount.service" ];
|
|
||||||
requires = [ "zfs-mount.service" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.nfs.server = {
|
|
||||||
enable = true;
|
|
||||||
exports = ''
|
|
||||||
/tank/docker/config 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
|
||||||
/tank/docker/volumes 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
|
||||||
/tank/docker/databases 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
|
||||||
/tank/docker/nextcloud-data 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
|
||||||
/tank/raspi/volumes 192.168.2.0/24(rw,sync,no_subtree_check,no_root_squash)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 111 2049 ];
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,19 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
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 = ''
|
mySwitchCmd = ''
|
||||||
sudo nixos-rebuild switch \
|
sudo nixos-rebuild switch \
|
||||||
--no-write-lock-file \
|
--no-write-lock-file \
|
||||||
--refresh \
|
--refresh \
|
||||||
--flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
--flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(hostname)
|
||||||
'';
|
'';
|
||||||
myTestCmd = ''
|
myTestCmd = ''
|
||||||
sudo nixos-rebuild test \
|
sudo nixos-rebuild test \
|
||||||
--no-write-lock-file \
|
--no-write-lock-file \
|
||||||
--refresh \
|
--refresh \
|
||||||
--flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(cat /etc/flake-target)
|
--flake git+https://gitea.lan.ddnsgeek.com/beatzaplenty/nixos.git#$(hostname)
|
||||||
'';
|
'';
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
../set-locale.nix
|
../set-locale.nix
|
||||||
];
|
];
|
||||||
# Use the GRUB 2 boot loader.
|
# Use the GRUB 2 boot loader.
|
||||||
# boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
#boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
|
#boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
|
||||||
|
|
||||||
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||||
@@ -25,31 +25,9 @@
|
|||||||
git
|
git
|
||||||
gcr
|
gcr
|
||||||
];
|
];
|
||||||
|
|
||||||
# Secrets shared by every host, decrypted at activation via each host's
|
|
||||||
# existing SSH host key (sops-nix derives the age key from
|
|
||||||
# /etc/ssh/ssh_host_ed25519_key automatically — see modules/common/README
|
|
||||||
# or docs/ for the sops workflow). hashedPassword/hashedPasswordFile need
|
|
||||||
# neededForUsers so they're available before the normal secret-activation
|
|
||||||
# step, since user creation happens very early in boot.
|
|
||||||
sops.defaultSopsFile = ../../secrets/common.yaml;
|
|
||||||
sops.secrets."root-hashedPassword".neededForUsers = true;
|
|
||||||
sops.secrets."nixos-hashedPassword".neededForUsers = true;
|
|
||||||
sops.secrets."nix-github-token" = { };
|
|
||||||
|
|
||||||
# nix.conf doesn't support a *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.
|
|
||||||
sops.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}
|
|
||||||
'';
|
|
||||||
|
|
||||||
#Set root password
|
#Set root password
|
||||||
users.users.root = {
|
users.users.root = {
|
||||||
hashedPasswordFile = config.sops.secrets."root-hashedPassword".path;
|
hashedPassword = "$6$Kwv9KAyvcurAViQF$H4.u3feqGE7lVoNgkFXhE3n2Pmo//9JYDTCz8ifrVHBxPjwa1xMby7tEZ8Bpt5MXs9Rkx6/YbZWxs5CpH0s/70";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
@@ -59,7 +37,7 @@ users.users.root = {
|
|||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
tree
|
tree
|
||||||
];
|
];
|
||||||
hashedPasswordFile = config.sops.secrets."nixos-hashedPassword".path;
|
hashedPassword = "$6$Kwv9KAyvcurAViQF$H4.u3feqGE7lVoNgkFXhE3n2Pmo//9JYDTCz8ifrVHBxPjwa1xMby7tEZ8Bpt5MXs9Rkx6/YbZWxs5CpH0s/70";
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCq/Q5LvIXlZwO2kdeAN5nLGZ59nZB7JHYMEszHxmNtGMzv1lM31jiPNsr0z2EKVZhE7OOfa2IF9rhWYD7JUA9G0yzdZ4WTXFNGVVOJoOVH6vAF3XCxoVilOEwTc7h2Wiy+rzd0B28/3spffzQQWJhY6GRQVa8j+6xAGF60Fcvl1vLosYT9Bn2ZbK4TCWOwAn2jqXIieGpZdn/UNZbGOeKRiCvhktDfMAzuQzN/9jMu/oF4pkPn2X1UrsQdNlvp0Ci8md612MozIpncQJyAF1ADhunr3sMx0isUXiqD29R5DS4TftpekqLNLak+zcxFa8N7DcRNp3DcKfJvyTkwQrR4r+b7lFLYOLHLagSso9CzeW/paAS2q9I5SBm/2DtE1diLLg2jZikYcstsu/G5RgvbzbKqjiaMwTdXC3AMvDxQrs7U5pDRZFzoofG3cpODbTm+uy3m0kP70z0M1K45UbDG0p+itnTu9x40JbQEgefbx38AItNvAIx1A8HO4I1VX28= wayne@stream"
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCq/Q5LvIXlZwO2kdeAN5nLGZ59nZB7JHYMEszHxmNtGMzv1lM31jiPNsr0z2EKVZhE7OOfa2IF9rhWYD7JUA9G0yzdZ4WTXFNGVVOJoOVH6vAF3XCxoVilOEwTc7h2Wiy+rzd0B28/3spffzQQWJhY6GRQVa8j+6xAGF60Fcvl1vLosYT9Bn2ZbK4TCWOwAn2jqXIieGpZdn/UNZbGOeKRiCvhktDfMAzuQzN/9jMu/oF4pkPn2X1UrsQdNlvp0Ci8md612MozIpncQJyAF1ADhunr3sMx0isUXiqD29R5DS4TftpekqLNLak+zcxFa8N7DcRNp3DcKfJvyTkwQrR4r+b7lFLYOLHLagSso9CzeW/paAS2q9I5SBm/2DtE1diLLg2jZikYcstsu/G5RgvbzbKqjiaMwTdXC3AMvDxQrs7U5pDRZFzoofG3cpODbTm+uy3m0kP70z0M1K45UbDG0p+itnTu9x40JbQEgefbx38AItNvAIx1A8HO4I1VX28= wayne@stream"
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMJhrfFayLBG+gWtO6oAvgambw5nWWgztiTFEaaaVRH debian@surface"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICMJhrfFayLBG+gWtO6oAvgambw5nWWgztiTFEaaaVRH debian@surface"
|
||||||
|
|||||||
@@ -17,10 +17,11 @@ in {
|
|||||||
|
|
||||||
programs.bash.enable = true;
|
programs.bash.enable = true;
|
||||||
|
|
||||||
# GitHub access-tokens setting used to live here in plaintext; it's now
|
home.file = {
|
||||||
# rendered system-wide from a sops-nix secret via nix.extraOptions in
|
".config/nix/nix.conf".text = ''
|
||||||
# modules/common/configuration.nix instead (covers the daemon for every
|
access-tokens = github.com=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
|
||||||
# user, not just this one).
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# Optional: packages
|
# Optional: packages
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|||||||
+15
-31
@@ -10,38 +10,9 @@
|
|||||||
type = "gpt";
|
type = "gpt";
|
||||||
|
|
||||||
partitions = {
|
partitions = {
|
||||||
esp = {
|
|
||||||
priority = 1;
|
|
||||||
name = "ESP";
|
|
||||||
size = "512M";
|
|
||||||
type = "EF00";
|
|
||||||
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
mountOptions = [ "umask=0077" ];
|
|
||||||
extraArgs = [
|
|
||||||
"-F"
|
|
||||||
"32"
|
|
||||||
"-n"
|
|
||||||
"boot"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
swap = {
|
|
||||||
size = "8G";
|
|
||||||
|
|
||||||
content = {
|
|
||||||
type = "swap";
|
|
||||||
randomEncryption = false;
|
|
||||||
# label = "swap";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
root = {
|
root = {
|
||||||
size = "100%";
|
priority = 1;
|
||||||
|
size = "-8G";
|
||||||
|
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
@@ -53,6 +24,19 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
swap = {
|
||||||
|
priority = 2;
|
||||||
|
size = "100%";
|
||||||
|
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
extraArgs = [
|
||||||
|
"-L"
|
||||||
|
"swap"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
boot.loader.grub.device = "/dev/sda";
|
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
{ device = "/dev/sda";
|
{ device = "/dev/sda";
|
||||||
@@ -32,7 +31,7 @@ boot.loader.grub.extraConfig = ''
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
boot.loader.grub.forceInstall = true;
|
boot.loader.grub.forceInstall = true;
|
||||||
# boot.loader.grub.device = "nodev";
|
boot.loader.grub.device = "nodev";
|
||||||
boot.loader.timeout = 10;
|
boot.loader.timeout = 10;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
# boot.loader.grub.device = "/dev/sda2"; # or "nodev" for efi only
|
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
|
||||||
|
|
||||||
# fileSystems."/" =
|
fileSystems."/" =
|
||||||
# { device = "/dev/disk/by-label/nixos";
|
{ device = "/dev/disk/by-label/nixos";
|
||||||
# fsType = "ext4";
|
fsType = "ext4";
|
||||||
# };
|
};
|
||||||
|
|
||||||
# swapDevices =
|
swapDevices =
|
||||||
# [ { device = "/dev/disk/by-label/swap"; }
|
[ { device = "/dev/disk/by-label/swap"; }
|
||||||
# ];
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
../hardware-configuration/vm/linode.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
usePredictableInterfaceNames = false;
|
|
||||||
useDHCP = false;
|
|
||||||
interfaces.eth0.useDHCP = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
boot.isContainer = true;
|
|
||||||
|
|
||||||
boot.loader.grub.enable = false;
|
|
||||||
boot.loader.systemd-boot.enable = false;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
../hardware-configuration/vm/proxmox.nix
|
|
||||||
../boot/efi.nix
|
|
||||||
../disko/proxmox.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
# Spec: Remove Sensitive Information from NixOS Flake
|
|
||||||
|
|
||||||
## Goal
|
|
||||||
|
|
||||||
Every secret currently readable in plaintext anywhere in this repo (working tree *and* git history) gets removed, replaced with `sops-nix`-managed encrypted references, and rotated. When this is done, the repo should be safe to make public without exposing anything about the systems it configures.
|
|
||||||
|
|
||||||
Treat this as three sequential milestones. Do not start git history rewriting (Milestone 3) until Milestones 1 and 2 are fully verified and the flake still builds. This should be its own branch (`refactor/secrets`) until fully verified, then merged.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Milestone 1 — Audit
|
|
||||||
|
|
||||||
Before touching anything, produce a complete inventory. Do not guess at scope — grep the whole tree and the whole history.
|
|
||||||
|
|
||||||
1. Run a secret scanner across the working tree and full history. Use both, since they catch different things:
|
|
||||||
- `gitleaks detect --source . -v --log-opts="--all"` (scans history too)
|
|
||||||
- `trufflehog git file://. --since-commit=$(git rev-list --max-parents=0 HEAD) --only-verified=false`
|
|
||||||
If neither is installed, add them via a temporary `nix-shell -p gitleaks trufflehog` — don't install anything globally on the host.
|
|
||||||
|
|
||||||
2. Manually grep for the categories below, since scanners miss config-specific patterns:
|
|
||||||
- `hashedPassword`, `password`, `initialPassword`, `initialHashedPassword` in any `users.users.*` block
|
|
||||||
- `age.secrets`, `sops.secrets` (if any partial secrets work already exists — check for it)
|
|
||||||
- PSK / `preSharedKey`, `privateKeyFile` inline values (vs. file references) for WireGuard
|
|
||||||
- `authKey`, `apiToken`, `api_key`, `token =`, `secret =` in service modules (Tailscale, Cloudflare, backup tools, etc.)
|
|
||||||
- SSH private key material: search for `BEGIN OPENSSH PRIVATE KEY` / `BEGIN RSA PRIVATE KEY` literals
|
|
||||||
- TLS cert/key pairs committed under e.g. `secrets/`, `certs/`, `pki/`
|
|
||||||
- Real name, personal email, home address, or anything in comments/hostnames that maps a machine to your physical identity or network layout (e.g. hostnames like `wayne-desktop`, static LAN IPs, ISP-identifying info)
|
|
||||||
- `.env` files, `secrets.nix`, `secrets.yaml`, or any file that looks like it was meant to be gitignored but wasn't
|
|
||||||
|
|
||||||
3. Produce `secrets-inventory.md` (temporary, delete before finishing) listing: file path, line, secret type, and which host/service it belongs to. This becomes the checklist for Milestone 2 — every row must be either migrated to sops or deleted, with nothing left unaccounted for.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Milestone 2 — Migrate to sops-nix
|
|
||||||
|
|
||||||
### 2.1 Set up sops-nix
|
|
||||||
|
|
||||||
1. Add the flake input:
|
|
||||||
```nix
|
|
||||||
sops-nix.url = "github:Mic92/sops-nix";
|
|
||||||
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
```
|
|
||||||
2. Import `sops-nix.nixosModules.sops` into each host's module list (or into a shared `common.nix` if all hosts use it).
|
|
||||||
3. Generate an age keypair **per host** (not one shared key for everything — a compromised host shouldn't decrypt every other host's secrets):
|
|
||||||
```
|
|
||||||
nix-shell -p age --run "age-keygen -o /var/lib/sops-nix/key.txt"
|
|
||||||
```
|
|
||||||
Print the public key (`age-keygen -y`) for each host — you'll need it for `.sops.yaml`.
|
|
||||||
4. Also generate one age key for yourself (your admin workstation) so you can edit secrets without needing to SSH into a host: store it at `~/.config/sops/age/keys.txt`, back it up somewhere outside this repo (password manager, offline). **If this key is lost, every secret encrypted with it is unrecoverable — losing the age key is equivalent to losing the secrets.**
|
|
||||||
5. Create `.sops.yaml` at the repo root defining creation rules: which age public keys can decrypt which secrets files, keyed by path regex, so e.g. `secrets/hostA.yaml` is decryptable by your admin key + hostA's key, `secrets/hostB.yaml` by your admin key + hostB's key.
|
|
||||||
|
|
||||||
### 2.2 Migrate each secret category from the inventory
|
|
||||||
|
|
||||||
For each row in `secrets-inventory.md`:
|
|
||||||
|
|
||||||
- **Password hashes**: generate hash with `mkpasswd -m sha-512` (or `bcrypt` if your setup wants that), store under `sops.secrets."<name>/hashedPassword"`, reference via `users.users.<name>.hashedPasswordFile = config.sops.secrets."<name>/hashedPassword".path;`. Do not put the *plaintext* password anywhere, only the hash, and only the hash goes into the encrypted sops file.
|
|
||||||
- **API tokens / auth keys**: move the raw value into the per-host sops YAML, reference in the module via `config.sops.secrets."<service>/token".path` — most NixOS service modules that take a token also accept a `*File` variant (e.g. `environmentFile`, `tokenFile`); use that instead of passing the value directly.
|
|
||||||
- **Private keys / certs**: move the PEM/key content wholesale into a sops secret, output as a file with appropriate `sops.secrets.<name>.path`, `owner`, `mode`, `restartUnits` so the depending service (sshd, wireguard, nginx) reloads when the secret changes.
|
|
||||||
- **Personal/identifying info**: this doesn't belong in sops (it's not "secret," it's just information you don't want public). Replace real names/emails with placeholders or move to a small untracked `local.nix` that's `.gitignore`'d and imported conditionally, with a documented template (`local.nix.example`) committed instead.
|
|
||||||
|
|
||||||
### 2.3 Verify before moving on
|
|
||||||
|
|
||||||
- `nixos-rebuild dry-build --flake .#<host>` succeeds for every host.
|
|
||||||
- `sudo nixos-rebuild switch --flake .#<host>` on at least one real machine (or a VM) confirms secrets decrypt and services start.
|
|
||||||
- Confirm decrypted secrets land under `/run/secrets/` (not the Nix store — anything placed in `/nix/store` is world-readable by design, so sops-nix's runtime-only placement is the whole point; double check no module accidentally pulls a secret path into a store-built config file).
|
|
||||||
- Re-run the grep/scanner sweep from Milestone 1 against the *working tree only* (not history yet) — it should now come back clean.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Milestone 3 — Scrub git history
|
|
||||||
|
|
||||||
Do this only after Milestone 2 is merged to your main branch and confirmed working, since it rewrites every commit SHA from the point of the earliest offending commit onward.
|
|
||||||
|
|
||||||
**This is destructive and irreversible on your local clone. Back up first:**
|
|
||||||
```
|
|
||||||
cp -r /path/to/nixos-repo /path/to/nixos-repo-backup-$(date +%F)
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Install `git-filter-repo` (not the older `git filter-branch` / BFG — filter-repo is the currently maintained, faster, safer tool):
|
|
||||||
```
|
|
||||||
nix-shell -p git-filter-repo
|
|
||||||
```
|
|
||||||
2. Use the `secrets-inventory.md` list to build a list of literal strings/paths to strip. Two approaches, use both:
|
|
||||||
- Path-based: if whole files were secret (e.g. `secrets.nix`, a `.env`, a private key file), remove them entirely from history:
|
|
||||||
```
|
|
||||||
git filter-repo --path secrets.nix --path .env --invert-paths
|
|
||||||
```
|
|
||||||
- Value-based: for secrets embedded inline in files you're keeping (not deleting the whole file), use `--replace-text` with a file listing each literal secret string to replace with `***REMOVED***`:
|
|
||||||
```
|
|
||||||
git filter-repo --replace-text expressions.txt
|
|
||||||
```
|
|
||||||
3. After filtering, verify: run the Milestone 1 scanners again against full history (`--log-opts="--all"`). They must come back clean.
|
|
||||||
4. Force-push the rewritten history:
|
|
||||||
```
|
|
||||||
git push origin --force --all
|
|
||||||
git push origin --force --tags
|
|
||||||
```
|
|
||||||
5. **Every other clone of this repo (other machines, WSL instances, CI) must be deleted and re-cloned fresh** — a `git pull` against rewritten history will not work cleanly and risks resurrecting the old commits. Don't try to reconcile old clones; throw them away and re-clone.
|
|
||||||
6. If this repo has ever been pushed to a public host (GitHub, etc.) or a fork/mirror exists, treat every secret that was ever in history as **permanently compromised regardless of the rewrite** — caches, forks, and Wayback-style archives can retain old commits indefinitely. History scrubbing prevents *future* exposure via `git clone`; it does not undo past exposure.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Milestone 4 — Rotate everything
|
|
||||||
|
|
||||||
Because the secrets were exposed in history (even briefly, even in a private repo), the migration is not complete until every credential in the inventory has been **rotated**, not just re-encrypted. Re-encrypting an already-leaked value protects it going forward but doesn't undo the leak.
|
|
||||||
|
|
||||||
For each row in the original inventory:
|
|
||||||
- Password hashes → change the actual account password, regenerate the hash, update the sops file.
|
|
||||||
- API tokens/auth keys → revoke the old token in the issuing service's dashboard (Cloudflare, Tailscale, backup provider, etc.) and generate a new one.
|
|
||||||
- SSH/WireGuard private keys → generate new keypairs, update the corresponding public key wherever it's trusted (authorized_keys, peer configs, etc.), retire the old ones.
|
|
||||||
- TLS certs → reissue if the private key was exposed.
|
|
||||||
|
|
||||||
Keep `secrets-inventory.md` open during this step and check off each row as rotated. Delete the file only once every row is checked off — it should not be committed.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Ongoing prevention
|
|
||||||
|
|
||||||
Add a pre-commit hook (or a `nix flake check` step) running `gitleaks protect --staged` so a secret can't be committed again by accident. Document in the repo README (briefly) that new secrets go through `sops <file>` to edit, never as plaintext in a tracked file.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Definition of done
|
|
||||||
|
|
||||||
- [ ] Milestone 1 inventory complete and reviewed
|
|
||||||
- [ ] All hosts have per-host age keys; admin key backed up outside the repo
|
|
||||||
- [ ] Every inventoried secret migrated to sops-nix, referenced via `*File`/`sops.secrets.*.path`, nothing plaintext in the working tree
|
|
||||||
- [ ] `nixos-rebuild dry-build` and at least one real `switch` verified per host
|
|
||||||
- [ ] Working-tree scanner sweep clean
|
|
||||||
- [ ] History rewritten with `git-filter-repo`, force-pushed, full-history scanner sweep clean
|
|
||||||
- [ ] All other clones deleted and re-cloned from the rewritten history
|
|
||||||
- [ ] Every credential in the original inventory rotated (not just re-encrypted)
|
|
||||||
- [ ] Pre-commit secret scanning hook added
|
|
||||||
- [ ] `secrets-inventory.md` deleted from the working directory (never committed)
|
|
||||||
@@ -70,9 +70,6 @@ EOF
|
|||||||
echo "Nix version:"
|
echo "Nix version:"
|
||||||
nix --version
|
nix --version
|
||||||
|
|
||||||
echo "Enabling tracked git hooks (pre-commit secret scan)..."
|
|
||||||
git config core.hooksPath .githooks
|
|
||||||
|
|
||||||
echo "Installing jq if unavailable..."
|
echo "Installing jq if unavailable..."
|
||||||
if ! command -v jq >/dev/null 2>&1; then
|
if ! command -v jq >/dev/null 2>&1; then
|
||||||
nix profile install nixpkgs#jq
|
nix profile install nixpkgs#jq
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
root-hashedPassword: ENC[AES256_GCM,data:Kp0nOZI7vDoLhJHiOJBwJn0rQZ5yhnwapGnAcA+qh8vlDETtFs/iQdetF/2ZxmANf62SviTNd+Ag0q5JIF1996x7onZGXqxgSMCuVzZLBdUlsO5IR0BslWWz47khYGTe4WkUg4NB1itBfQ==,iv:5Sra5vJ79V8hxQT3g9qJ+dOj2W2sumIhqpitqnHjJdk=,tag:3Igu0+8GeUZHqS3fKUVwog==,type:str]
|
|
||||||
nixos-hashedPassword: ENC[AES256_GCM,data:pT7tVRN6X4a+DNUgB7fIUUE3CbnetkjxmoSL1PxSU+ktsFU+fB0mEvJjA1uujsGH5Rcztg7YM815+M0Z67ILmHaXbza5DtFacrqhi4/b277xly0SHRX4yOvBwQh6mJG1jn/0O/wvUUIYdw==,iv:bp2nfhC8nFbk6o5iWDAugvbzu7J/a1xayFnBEtkhNpE=,tag:HqWgkIpSrSM/K9OK2WO+VQ==,type:str]
|
|
||||||
nix-github-token: ENC[AES256_GCM,data:OfNRGJg16Ede6EilWUetCs9za+xk5/Lsa3SpVajsqz8PMdA1xQNeCWdX7ZAMdijHClpBhU6ETFGsXvt41O9aORS951uijeGSW7/NH35/bnPISrKdYeBx/+xEiqwH,iv:QGU3v7xOy89uzRTCb1U9ICyJ8XYIpXrUsDt12aL3g2Y=,tag:Bde2wcWNv8H4WLxSEUAodg==,type:str]
|
|
||||||
sops:
|
|
||||||
age:
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB6NkpZRzJuMFNuV09WamR0
|
|
||||||
SERDN0VSUlNQbkhSem1EeFlxdlhmdUx0S21JCnY1VkRBQTBqcW9JRHpJWEtJSitN
|
|
||||||
dHkyR0I4ckNkWkpGWHAzZGRaZkhJalEKLS0tIHRrU3RhU3UxN3B4NHdLeStuSXQ4
|
|
||||||
anFkRlpMTHowZzJNdnY0MExQcXd4OUEKgbT7uOSFkfEs6t3X6jmGOiC28lDJWF33
|
|
||||||
50f2fZ771ylhHa6WJMetGZ5cwl9r1RCaDiWyJEaqNGe7NqARlhr3EQ==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age10nd382a9klsn2mrs60emdtsxe43pht3a0m9p29phfrhy0wfyt3vsq9r667
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBDamw2ekY0dFZyOGNJelVa
|
|
||||||
ZGlNK2VNOWtWNTRzU3o2aVJvRi9CME5yS1JFCndlamdFMzVRTnoyVE1ZWXZkTjRR
|
|
||||||
eWdSZzZERHE5VElrOGZvcE4vK0g2d0EKLS0tIG15QlVyalZTK2NpVDdWWU4yUU4r
|
|
||||||
SkFncC9rZkNKUS9MSmF6WGQwOENwZTQKs5kLNLdQJoZtcsw3zlUWUUtJs0MJnuvw
|
|
||||||
o5vziOswRnuXENw//xN01nMDC6Ckzvb+q9GFIyxHLE4j3fT5XdZakg==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age19gfn2yedg76dmztm4hncr7vf3r3c9j0qpt4rap7y7gersjk4m3ks2lhd0e
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyaWpWTGd4TEVoaHg4b3hm
|
|
||||||
S1o3VXdkYkZCS0QxcW5hUWxyVjFneE5aSmp3ClNsdEZoMHpPUzI4K3B0ZnBYMlEw
|
|
||||||
MkJyd2NPcGJDZzgvc1EyWFBhNVlGUVEKLS0tIEptYXI2bnJHZVZGR3hSSm1sMlN5
|
|
||||||
ay8wdUh6TEowL0ZiUWtqbXl3NzhYOVEKW9l4mr+MLhuXA8sgQndaU8NiFeCMcxhG
|
|
||||||
qjKFn+mu2GFbwfZWAy6y/KUd9Ug4H6y3pNHlJMHupTu8v2wZ+3S4EA==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age1ll6hj5ggruetgjwjfnplpn5xtq35uhlcdflksx3xmnjm6s3uad9sz70jkf
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAxVG13RVVweGpRM04vMWxG
|
|
||||||
V2hMMnp2Qk5Ub1BZQWNKNXVya3J4NGpreDJrCktqajVPRXdEL1BMU1dMbDhmU01L
|
|
||||||
UlQvRVQvcEFUZVZ5Umc3Y0hMUWNLVFEKLS0tIFgzRnF1RHdQdktDVjROSURYYTdx
|
|
||||||
NjAydjVuV1VCOGZoVFdTZmw1YmJ0eEEKN9KRGegafu1sjHlhyn4KCMPPAKxsSZLc
|
|
||||||
QJkei1ZQ0AVgC2QfCVEXonMOrs45nCIplG+uyER9khZyyjKObWk1pA==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age120le4a5l8dh3lyfgvmj3d9ksmej6ajs5mer5y7r0vfg3x9fn69dqf8xgzu
|
|
||||||
lastmodified: "2026-07-19T02:30:40Z"
|
|
||||||
mac: ENC[AES256_GCM,data:UiL3VMDF6rq4Nr87KspcDx434q3tfNXeb5pwH2O+4ssNQ6xzcYDdzXBnhAY3zLBsqPMKrvHBd4Ot/gEMcq3FMIVe7Q6p9yWKpep66KZ/yWEhAlwIVhD79Oj8VS+1CHKjf25zpRdhZorp04oeFQQd9VfjJB4EE/Q1aVbwTGlpIic=,iv:i/0conaFgFia+wzNTdUL6tlSTw35HTK3Ap1Sr5RGHf8=,tag:ULbz5FllShA/JjlSRdxA0g==,type:str]
|
|
||||||
unencrypted_suffix: _unencrypted
|
|
||||||
version: 3.13.1
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
beszel-token: ENC[AES256_GCM,data:meuzUP/6wCssJDVTgbC0XwiLZPMGyDl55HEIiON9xOXCD9k6,iv:TDqWcp+8Mxd8wN09r5otQRQXq3XTeQphaTWxvvuLTAs=,tag:cRPZQGlwB/dTguBAheWPQg==,type:str]
|
|
||||||
sops:
|
|
||||||
age:
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBkb29VM3haQ0c0WDY0STVn
|
|
||||||
L1ZyOUROSnR6ZjZZZWc1VGFFNVp6bWxCV3hZCnlGTC9CbEtIM3MvSGJQaStEbzJ0
|
|
||||||
eWVhY2l6UHNDRTYxdEpkd003WXFia2MKLS0tIHcxU3FPYTVuZ0RqZTZTT1RvZnN0
|
|
||||||
OGlQM3B2R0l4MHhWNXBBWmpiOEVxK1EK8kxh3ikKL6Fw2am3r7lPGpB0fCqzEukO
|
|
||||||
NU10Cbf38Bd+fybRbBnvRuu9To1FOf+KU3iKbsuWmZn4KJn4Ajcbhw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age10nd382a9klsn2mrs60emdtsxe43pht3a0m9p29phfrhy0wfyt3vsq9r667
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCNWRhK2QrV1ZibllqY25Y
|
|
||||||
ZVRPLzZ0TE82TWZ4L0w5ZmFPTDBtT0poODBnCkE5TWhJcXJjNkdva1hYZ3loeVdq
|
|
||||||
UlBXWHZpRUpMSGhPU0FIRi9JMEtTdGMKLS0tIE9yUk5Ebjk2MEFtNEkyR3RDcU51
|
|
||||||
ZVMwNnNRMlBMVVFlamU1U3JQSy9UT00KJZdEpRHuj4Dp1dGwP1z4xi9oddQOrQj2
|
|
||||||
qheEN/IlifVdZDpvlLUc8jgLzd/TO5EeEhVqfbdrlua8FHly29oTNw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age120le4a5l8dh3lyfgvmj3d9ksmej6ajs5mer5y7r0vfg3x9fn69dqf8xgzu
|
|
||||||
lastmodified: "2026-07-19T02:30:40Z"
|
|
||||||
mac: ENC[AES256_GCM,data:7+FeT6aeCGn+JFBXbPO0qP4BJ1nHPSennewv1kWkG+hOTIqs1ymuswUK1Hyfi6Z9h2umFX9HvK+o3qtmYvk6k7BUNe6w6QUHTNwm6lmNqrb7sgAE3iFVI2p9m14NGhgoTfnXx1M4JIZ1iuNYhCukpENI4+svIe+r7x5YeE5Evac=,iv:4AKAPI6upyAvHBr8BLWX7R/NupmJdcXdqiN8e0ZQ3ls=,tag:TkpfpCaLhn+Mx5cQZZuMdA==,type:str]
|
|
||||||
unencrypted_suffix: _unencrypted
|
|
||||||
version: 3.13.1
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
beszel-token: ENC[AES256_GCM,data:cbQOXhLzNk4g9d6hvm2DH7Q5ApTPCTzsW2txflDT2dD/UPIE,iv:V19MI1GEo5/0205Hrt7JImfkjduFiZ7f9aIkDVaI8mU=,tag:WCArgdrnIOudVe/Tw+oxRw==,type:str]
|
|
||||||
sops:
|
|
||||||
age:
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBxaFZURjAxMGRJZEJ5MW1x
|
|
||||||
ZjVwWEQrQlkwNmRibVNiL2RpTTFLeUVDQ3hRCkVIamVnZkM1MnlueloxMHVFQnBF
|
|
||||||
RjV2bnUrZUo4WGZJTmR4Y0xITkxRUkUKLS0tIGlJdVQ5MFBubVhxRUVMWW0wSGpP
|
|
||||||
UGdKNUNPYW9nek1UZ0tWbXd3QVNUNDgKIHOiKelITQdH5R4Nc3WF7mzz15D1f9on
|
|
||||||
VaTdr5qkf8LNNvPI0fxsXA9is5cqeg+KbDRHtUumEhNp6Zrf8zWBkw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age10nd382a9klsn2mrs60emdtsxe43pht3a0m9p29phfrhy0wfyt3vsq9r667
|
|
||||||
- enc: |
|
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA3N0hvV01naytDSWVwK1B1
|
|
||||||
MXM1ZkdpaVc2Q3FPV2VBcC83WmcvSjdGUGgwClJGSXZ6YW5JeFlValNJbjVhK29u
|
|
||||||
bUFqN2dRQTI4ZkwyeXNWYk5JeWVJRXcKLS0tIDlMMkNBUnNUSTJwVVFmc2dlcEZS
|
|
||||||
VGQ1VHR2dXB0M3RsalppVWxiUUROM0UKZM/4QDTam3LDTzjnDs41Ije50R7Q7GC4
|
|
||||||
IZbUZjs72rBzY8IkJDbN9JidadEc4NAtMOJwXiJbpZGiCBNfc8+SXw==
|
|
||||||
-----END AGE ENCRYPTED FILE-----
|
|
||||||
recipient: age1ll6hj5ggruetgjwjfnplpn5xtq35uhlcdflksx3xmnjm6s3uad9sz70jkf
|
|
||||||
lastmodified: "2026-07-19T02:30:40Z"
|
|
||||||
mac: ENC[AES256_GCM,data:rKHZjU/MH08ASTlu32HZO9uWmsBYuMCEC6M8gwVhzuWvmablnP05tS2z13XfaWaCEUXk6kmGJKuU0zu5+IKVZgamCF6DAMtxQb6bVCaLsoAm/GSqWQ5VI9eHqgnSSdN/o3ul/33Rf8iBQo4aw8FFAmDVuNz8bfAn0QefFTj0ByI=,iv:JD2gtqRinOY77etg6PUmZNovkYl1Q3F6ZvRi4x7RznQ=,tag:/5IMpWKRVt+l1luCTQE0BA==,type:str]
|
|
||||||
unencrypted_suffix: _unencrypted
|
|
||||||
version: 3.13.1
|
|
||||||
Reference in new issue
Block a user