oddlama / nix-config

โ„๏ธ My nix config and dotfiles
167 stars 3 forks source link
dotfiles flake nix nix-dotfiles nix-flake nixos nixos-configuration nixos-dotfiles

Hosts | Overview | Structure

preview

โ„๏ธ My NixOS Configuration

This is my personal nix config which I use to maintain my whole infrastructure, including my homelab, external servers and my development machines.

Hosts

Type Name Hardware Purpose
๐Ÿ’ป Laptop nom Gigabyte AERO 15-W8 (i7-8750H) My laptop and my main portable development machine Framework when?
๐Ÿ–ฅ๏ธ Desktop kroma PC (AMD Ryzen 9 5900X) Main workstation and development machine, also for some occasional gaming
๐Ÿ–ฅ๏ธ Server ward ODROID H3 Energy efficient SBC for my home firewall and some lightweight services using containers and microvms.
๐Ÿ–ฅ๏ธ Server sire Threadripper 1950X Home media server and data storage. Runs all services as microvms.
๐Ÿฅ” Server zackbiene ODROID N2+ ARM SBC for home automation, isolating the sketchy stuff from my main network
โ˜๏ธ VPS sentinel Hetzner Cloud server Proxies and protects my local services
โ˜๏ธ VPS envoy Hetzner Cloud server Mailserver

Overview

An overview over what you will find in this repository. I usually put a lot of effort into all my configurations and try to go over every option in detail. These lists summarize the major parts.

I've also included a (subjective) indicator of customization (๐Ÿ’Ž) so you can more easily find the configs that are very polished or different from the basic setup that most people would have. The configurations are sorted into three categories:

Dotfiles

~~~~ Program Source Description
๐Ÿš Shell ZSH & Starship Link ZSH configuration with FZF, starship prompt, sqlite history and histdb-skim for fancy CtrlR
๐Ÿ–ฅ๏ธ Terminal Kitty Link Terminal configuration with nerdfonts and history CtrlShiftH to view scrollback buffer in neovim
๐ŸชŸ WM hyprland & i3 Link, Link Tiling window manager, heavily customized to my personal preferences
๐Ÿ”‹ Bar waybar Link Taskbar and status
๐ŸŒ Browser Firefox Link Firefox with many privacy settings and betterfox
๐Ÿ–Š๏ธ Editor Neovim Link Extensive neovim configuration, made with nixvim
๐Ÿ“œ Manpager Neovim Link Isolated neovim as manpager via nixvim
๐Ÿ“ท Screenshots Custom based on grimblast Link Custom scripts utilizing grimblast for QR code detection and OCR / satty editing
๐Ÿ—จ๏ธ Notifications SwayNotificationCenter Link Notification center with customized color scheme
๐ŸŽฎ Gaming Steam & Bottles Link Setup for gaming

Services

~~~~ ๐Ÿ’Ž Service Source Description
๐Ÿ™ Git โ€“ Forgejo Link Forgejo with SSO
๐Ÿ”‘ SSO ๐Ÿ’Ž Kanidm Link Identity provider for Single Sign On on my hosted services. ๐Ÿ’Ž With custom-made secret provisioning.
๐Ÿ”ด DNS Adblock โ€“ AdGuard Home Link DNS level adblocker
๐Ÿ” Passwords โ€“ Vaultwarden Link Self-hosted password manager
๐Ÿ“ท Photos โ€“ Immich Link Self-hosted photo and video backup solution
๐Ÿ—‚๏ธ Documents ๐Ÿ’Ž Paperless Link Document management system. ๐Ÿ’Ž with per-user Samba share integration (consume & archive)
๐Ÿ—“๏ธ CalDAV/CardDAV โ€“ Radicale Link Contacts, Calender and Tasks synchronization
๐Ÿ“ NAS ๐Ÿ’Ž Samba Link Network attached storage. ๐Ÿ’Ž Cross-integration with paperless
๐Ÿงฑ Minecraft ๐Ÿ’Ž PaperMC Link Minecraft game server. ๐Ÿ’Ž Autostart on connect, systemd service with background console, automatic backups
๐Ÿ›ก๏ธ VPN - Netbird Link Internal network gateway and wireguard VPN server with dynamic peer configuration and SSO authentication.
๐Ÿ“ง Mailserver ๐Ÿ’Ž Stalwart Link Modern mail server setup with custom self-service alias management including Bitwarden integration
๐Ÿ“ˆ Dashboard โ€“ Grafana Link Logs and metrics dashboard and alerting
๐Ÿ“” Logs DB โ€“ Loki Link Central log aggregation service
๐Ÿ“” Logs โ€“ Promtail Link Log shipping agent
๐Ÿ“š TSDB โ€“ Influxdb2 Link Time series database for storing host metrics
โฑ๏ธ Metrics โ€“ Telegraf Link Per-host collection of metrics

General & Miscellaneous

(WIP)

~~~~ ๐Ÿ’Ž Source Description
๐Ÿ—‘๏ธ Impermanence โ€“ Link Only persist what is necessary. ZFS rollback on boot. Most configuration is will be next to the respective service / program configuration.

Structure

If you are interested in parts of my configuration, you probably want to examine the contents of users/, config/, modules/ and hosts/. Also, a lot of interesting modules have been moved to nixos-extra-modules, a separate repository specifically for reusable stuff. The full structure of this flake is described in STRUCTURE.md, but here's a quick breakdown of the what you will find where.

config/ global configuration for all hosts
config/optional/ optional configuration included by hosts
hosts/<hostname> top-level configuration for <hostname>
modules/ classical reusable configuration modules
nix/ library functions and flake plumbing
pkgs/ Custom packages and scripts
secrets/ Global secrets and age identities
users/ User configuration and dotfiles

How-To

Add new machine

... incomplete.

Initial deploy

Afterwards:

New secret

...

Stuff

To be able to decrypt the repository-wide secrets (files that contain my PII and are thus hidden from public view), you will need to (be me and) add nix-plugins and point it to ./nix/extra-builtins.nix. The devshell will do this for you automatically. If this doesn't work for any reason, this can also be done manually:

  1. Get nix-plugins: NIX_PLUGINS=$(nix build --print-out-paths --no-link nixpkgs#nix-plugins)
  2. Run all commands with --option plugin-files "$NIX_PLUGINS"/lib/nix/plugins --option extra-builtins-file ./nix/extra-builtins.nix

Misc

Generate self-signed cert, e.g. for kanidm internal communication to proxy:

openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
  -keyout selfcert.key -out selfcert.crt -subj \
  "/CN=example.com" -addext "subjectAltName=DNS:example.com,DNS:sub1.example.com,DNS:sub2.example.com,IP:10.0.0.1"