|
||
---|---|---|
hosts | ||
img | ||
keys | ||
lib | ||
modules | ||
nix | ||
pkgs | ||
secrets | ||
users | ||
.envrc | ||
.gitignore | ||
flake.lock | ||
flake.nix | ||
hosts.toml | ||
README.md | ||
statix.toml |
Meine wundervolle nix config
Structure
hosts/
contain nixos configuration for hosts<hostname>/
configuration for hostsdefault.nix
Toplevel system definitionfs.nix
file system definitonnet.nix
network setupsecrets/
secrets local to this hostssecrets.nix.age
local secrets usable on deployhost.pub
host public key, needed for rekeying agenix secrets
modules/
extra nixos modules and shared configurationssecrets.nix
module to enable deploy-time secretsconfig/
base configuration used on all machinesdev/
configuration options enabling developer environmentgraphical/
configuration for graphical environmentshardware/
configuration for hardware componentsimpermanence/
impermanence modules for hosts
nix/
additional nix functionsdevshell.nix
Development shellextra-builtins.nix
Extra builtin plugin file to enable repository secrets- TODO
lib.nix
additional library functions
secrets/
global secrets<name>.key.pub
public key handles to decrypt secrets using yubikeyrecipients.txt
rage recipient file for encrypting secrets- currently containing both yubikeys and a rage backup key
secrets.nix.age
global secrets available at deploy
users/
home manager user configurationcommon/
shared home-manager modulesgraphical/
configuration for graphical programsprograms/
configuration for miscellaneous programsshells/
configuration for shellsdefault.nix
minimal setup for all usersinteractive.nix
minimal setup for interactive users on a command linegraphical.nix
configuration for users utilizing a graphical interface
<username>/
configuration for usersimpermanence.nix
users persistence configuration
keys
collection of yubikeys public key parts for decryptionimg
images, encrypted to not break any copyright by redistribution
Hosts
patricknix
Patricks main laptopdesktopnix
Patricks main desktoptestienix
old laptop for testinggojo
Simons Laptop
Users
patrick
my normal everyday unprivileged userroot
root user imported by every host
Flake output structure
checks
linting and other checks for this repositorypre-commit-check
automatic checks executed as pre-commit hooks
nixosHosts
top level configs for hostsnodes
alias tonixosNodes
devshell
development shell using devshellformatter
nix code formatterhosts
host meta declarationpkgs
nixpkgspackages
additional packagessecretsConfig
meta configuration for secretsstateVersion
global stateversion used by nixos and home-manager to determine default config
How-To
Add additional hosts
- Add host definition to
hosts.toml
- Create host configuration in
hosts/<name>
- Create and fill
default.nix
- Fill
net.nix
- Fill
fs.nix
- Don't forget to add necesarry config for filesystems, etc.
- Create and fill
- Generate ISO image with
nix build --print-out-paths --no-link .#images.<target-system>.live-iso
- This might take multiple minutes(~10)
- Alternatively boot an official nixos image connect with password
- Copy ISO to usb using dd
- After booting copy the installer to the live system using
nix copy --to <target> .#packages.<target-system>.installer-package.<target>
- Run the installer script from the nix store of the live system
- you can get the path using
nix path-info .#packages.<target-system>.installer-package.<target>
- you can get the path using
- Export all zpools and reboot into system
- Retrieve hostkeys using
ssh-keyscan <host> | grep -o 'ssh-ed25519.*' > host/<target>/secrets/host.pub
- Deploy system
Add secureboot to new systems
- generate keys with
sbct create-keys
- tar the resulting folder using
tar cvf secureboot.tar -C /etc/secureboot .
- Copy the tar to local using scp and encrypt it using rage
rage -e -R ./secrets/recipients.txt secureboot.tar -o <host>/secrets/secureboot.tar.age
- safe the encrypted archive to
hosts/<host>/secrets/secureboot.tar.age
- DO NOT forget to delete the unecrypted archives
- Deploy your system with lanzaboote enabled
- link
/run/secureboot
to/etc/secureboot
- This is necesarry since for your this apply the rekeyed keys are not yet available but already needed for signing the boot files
- link
- ensure the boot files are signed using
sbctl verify
- Now reboot the computer into BIOS and enable secureboot, this may include removing any existing old keys
- bootctl should now read
Secure Boot: disabled (setup)
- you can now enroll your secureboot keys using
sbctl enroll-keys
If you want to be able to boot microsoft signed images append--microsoft
- Time to reboot and pray
Add luks encryption TPM keys
systemd-cryptenroll --tpm2-with-pin={yes/no} --tpm2-device=auto <device>
Deploy
If deploying from a host not containing the necessary nix configuration option append
--nix-option plugin-files "$NIX_PLUGINS"/lib/nix/plugins --nix-option extra-builtins-file ./nix/extra-builtins`