Config of my NixOS hosts
  • Nix 82.5%
  • Emacs Lisp 8.3%
  • Lua 6.9%
  • CSS 1.7%
  • TypeScript 0.6%
Find a file
2026-05-20 05:05:21 +02:00
hosts fix(stellaris): avoid duplicate blueman applet unit 2026-05-20 05:05:21 +02:00
lib Format using nixfmt rfc style 2024-08-20 22:58:24 +02:00
modules fix(opencode): configure browser MCP profiles 2026-05-14 03:38:02 +02:00
packages/mia Remove activitywatch 2026-01-13 13:56:00 +01:00
ssh_keys Remove laptop config 2025-12-23 14:46:30 +01:00
.gitignore Add VS code 2021-08-23 03:55:50 +02:00
common.nix fix(nix): use nix-index-database for command lookup on flakes 2026-04-14 13:46:02 +02:00
flake.lock Update inputs 2026-04-30 03:42:25 +02:00
flake.nix fix(nix): use nix-index-database for command lookup on flakes 2026-04-14 13:46:02 +02:00
overlay.nix feat(opencode): switch Scala integration to Metals MCP 2026-04-14 08:13:18 +02:00
README.adoc feat(aegis): add controllable Mullvad WireGuard LAN gateway 2026-04-11 19:36:38 +02:00
UNLICENSE Add UNLICENSE 2021-07-08 19:23:23 +02:00

== Build a config and switch to it
[source,bash]
----
sudo nixos-rebuild switch --flake .#thehostname
----
If `#thehostname` is not provided, it defaults to the current hostname

== Try to build a configuration
[source,bash]
----
nix build .#nixosConfigurations.thehostname.config.system.build.toplevel
----

== Update lock file to the latest inputs
[source,bash]
----
nix flake update
----

== Build the Aegis installer ISO
[source,bash]
----
nix build .#nixosConfigurations.aegis-installer.config.system.build.isoImage
----

The built image is available under `result/iso/`.

== Write installer ISO to USB
[source,bash]
----
sudo dd if=result/iso/*.iso of=/dev/sdX bs=4M conv=fsync status=progress
----

Replace `/dev/sdX` with your USB device.

== Install Aegis from the custom ISO
Boot the Protectli from the USB stick, then run:

[source,bash]
----
install-aegis
----

The installer wipes `/dev/nvme0n1`, creates EFI + ext4 partitions, and installs `.#aegis`.
You can target another disk with `install-aegis /dev/your-disk`.
After first boot, connect with SSH as user `admin` using your configured SSH key.

== Aegis DNS and DHCP
- `aegis` provides DNS filtering with AdGuard Home on `192.168.1.1:53`.
- The AdGuard web UI is available on LAN at `http://192.168.1.1:3000`.
- `dnsmasq` provides DHCP on LAN (`192.168.1.100-192.168.1.199`).

AdGuard web authentication is required. Create the admin hash file on `aegis`:

[source,bash]
----
PASSWORD='choose-a-strong-password'
HASH="$(nix shell nixpkgs#apacheHttpd -c htpasswd -nbBC 12 "" "$PASSWORD" | tr -d ':\n')"
sudo install -d -m 0755 /etc/secrets
sudo sh -c 'printf "%s\n" "$1" > /etc/secrets/aegis-adguard-admin-password-hash' _ "$HASH"
sudo chmod 0644 /etc/secrets/aegis-adguard-admin-password-hash
----

== Aegis Wi-Fi (WPA2)
- SSID: `NSA honeypot`.
- Create the WPA2 passphrase file on `aegis`:

[source,bash]
----
sudo install -d -m 0755 /etc/secrets
sudo install -m 0600 /dev/null /etc/secrets/aegis-wifi-passphrase
sudo sh -c 'printf "%s\n" "your-8-to-63-char-passphrase" > /etc/secrets/aegis-wifi-passphrase'
----

== Aegis Mullvad VPN gateway (kill-switch)
`aegis` can run a Mullvad WireGuard client and route all LAN traffic through it.

1. Copy your Mullvad WireGuard `.conf` files to `aegis`:

[source,bash]
----
sudo install -d -m 0755 /etc/secrets/mullvad/servers
sudo cp /path/to/mullvad/*.conf /etc/secrets/mullvad/servers/
sudo ln -sfn /etc/secrets/mullvad/servers/your-default.conf /etc/secrets/mullvad/current.conf
----

2. Control it on `aegis`:

[source,bash]
----
sudo mullvad-gw list
sudo mullvad-gw up
sudo mullvad-gw status
sudo mullvad-gw switch nl-ams-wg-001
sudo mullvad-gw down
----

`up` enables a LAN kill-switch (LAN forwarding is blocked unless traffic exits via `mullvad`).

3. Control it remotely from `stellaris`:

[source,bash]
----
aegis-vpn list
aegis-vpn up
aegis-vpn status
aegis-vpn switch nl-ams-wg-001
aegis-vpn down
----