diff --git a/nixos/.gitignore b/nixos/.gitignore
new file mode 100644
index 0000000..3113471
--- /dev/null
+++ b/nixos/.gitignore
@@ -0,0 +1,3 @@
+/secrets
+
+.*.swp
diff --git a/nixos/assets/openssh-authorized-keys b/nixos/assets/openssh-authorized-keys
new file mode 100644
index 0000000..e69de29
diff --git a/nixos/assets/wallpaper-macos-swirlies b/nixos/assets/wallpaper-macos-swirlies
new file mode 100644
index 0000000..6c7e957
Binary files /dev/null and b/nixos/assets/wallpaper-macos-swirlies differ
diff --git a/nixos/common.nix b/nixos/common.nix
new file mode 100644
index 0000000..5c68cc6
--- /dev/null
+++ b/nixos/common.nix
@@ -0,0 +1,272 @@
+# This module presumes impermanence and BTRFS.
+
+{ pkgs, ... }:
+
+{
+ i18n.defaultLocale = "en_GB.UTF-8";
+
+ environment = {
+ systemPackages = with pkgs; [
+ dust
+ lm_sensors
+ lsof
+ nix-diff
+ nix-tree
+ ouch
+ pv
+ usbutils
+ tealdeer
+ tree
+ wget
+ ];
+
+ sessionVariables = {
+ XDG_CONFIG_HOME = "$HOME/.config";
+ XDG_CACHE_HOME = "$HOME/.cache";
+ XDG_DATA_HOME = "$HOME/.local/share";
+ XDG_STATE_HOME = "$HOME/.local/state";
+ };
+
+ # Feel free to comment this out during initial install.
+
+ persistence = {
+ "/mnt/persistent-data" = {
+ hideMounts = true;
+ directories = [
+ "/etc/NetworkManager/system-connections"
+ "/etc/nixos"
+ "/var/lib/nixos"
+ "/var/log"
+ ];
+ files = [
+ "/etc/machine-id"
+ "/etc/ssh/ssh_host_ed25519_key"
+ "/etc/ssh/ssh_host_ed25519_key.pub"
+ "/etc/ssh/ssh_host_rsa_key"
+ "/etc/ssh/ssh_host_rsa_key.pub"
+ ];
+ users.rei.directories = [
+ ".ssh"
+ ];
+ };
+ "/mnt/machine-state" = {
+ hideMounts = true;
+ users.rei.directories = [
+ ".cache"
+ ".local/state"
+ ];
+ users.root.directories = [
+ ".cache"
+ ".local/state"
+ ];
+ };
+ };
+
+ shellAliases = {
+ # Default arguments.
+
+ cp = "cp -r";
+ rsync = "rsync -r --info=progress2";
+ mkdir = "mkdir -p";
+ rm = "rm -rf";
+ less = "less -S";
+ lsblk = "lsblk -o +fstype,uuid";
+ df = "df -h";
+ wipefs = "wipefs -a";
+ dust = "dust --limit-filesystem";
+ "mkfs.ntfs" = "mkfs.ntfs --quick";
+ nix-shell = "nix-shell --run $SHELL";
+ yt-dlp = "yt-dlp --write-subs";
+
+ # Command shortcuts.
+
+ s = "sudo ";
+ v = "vim";
+ vd = "vimdiff";
+ lns = "ln -s";
+ headc = "head -c";
+ chmodr = "chmod -R";
+ chownr = "chown -R";
+ sc = "systemctl";
+ scu = "systemctl --user";
+ jc = "journalctl";
+ jcu = "journalctl --user";
+ jck = "journalctl -k";
+ jcli = "journalctl-last-invocation";
+ ipl = "ip -br l";
+ ip4a = "ip -br -4 a";
+ ip6a = "ip -br -6 a";
+ ip4r = "ip -4 r s t all";
+ ip6r = "ip -6 r s t all";
+ ip4n = "ip -4 n";
+ ip6n = "ip -6 n";
+ nrs = "nixos-rebuild switch";
+ nrb = "nixos-rebuild boot";
+ nrt = "nixos-rebuild test";
+ ncg = "nix-collect-garbage";
+ nsff = "nix-store-fuzzy-find";
+ nbp = "nix-build-pkg";
+ nd = "nix develop --command $SHELL";
+
+ # New commands.
+
+ nixos-cleanup-generations = ''
+ zsh -c "nix-env --profile /nix/var/nix/profiles/system --delete-generations +20 && \
+ /run/current-system/bin/switch-to-configuration boot"
+ '';
+ };
+
+ etc.vimrc.text = ''
+ " $XDG_CONFIG_HOME/vim has to exist for this module to work.
+ runtime! xdg.vim
+
+ " NetRW always uses the first directory in runtimepath which is $HOME/.vim, so we manually
+ " set it to the XDG state directory because the only thing it should create anyway is its
+ " history file.
+ let g:netrw_home = '$XDG_STATE_HOME/vim'
+
+ " Sublime settings files can have comments.
+ autocmd BufNewFile,BufRead *.sublime-settings set filetype=jsonc
+ " Most software that reads JSON with comments also accepts trailing commas.
+ autocmd FileType jsonc highlight link jsonTrailingCommaError Normal
+
+ set nowrap
+ set hlsearch
+ set tabstop=2
+ set noexpandtab
+ set autoindent
+
+ command W w
+ command Q q
+ command Wq wq
+ command Qa qa
+ command Wqa wqa
+ '';
+ };
+
+ hardware.enableAllFirmware = true;
+
+ users = {
+ defaultUserShell = pkgs.zsh;
+ mutableUsers = false;
+ users.rei = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" "wireshark" ];
+ openssh.authorizedKeys.keyFiles = [ assets/openssh-authorized-keys ];
+ };
+ };
+
+ nix.settings = {
+ auto-optimise-store = true;
+ experimental-features = [ "flakes" "nix-command" ];
+ use-xdg-base-directories = true;
+ };
+
+ nixpkgs.config.allowUnfree = true;
+
+ programs = {
+ git.enable = true;
+
+ htop = {
+ enable = true;
+ # Not read directly, instead these are copied into the user config file when htop is run.
+ settings = {
+ hide_userland_threads = true;
+ highlight_base_name = true;
+ };
+ };
+
+ vim = {
+ enable = true;
+ defaultEditor = true;
+ # Default Vim package does not read /etc/vimrc, plus this one has better Nix language support.
+ package = pkgs.vim-full.override {
+ guiSupport = false;
+ };
+ };
+
+ zsh = {
+ enable = true;
+ histFile = "$XDG_STATE_HOME/zsh/history";
+ shellInit = ''
+ ZDOTDIR=$XDG_CONFIG_HOME/zsh
+ ZSH_COMPDUMP=$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
+ '';
+ interactiveShellInit = ''
+ # Add newline to prompt, but only after the first command.
+ precmd() { precmd() { echo } }
+
+ # Disable lack of newline indicator.
+ PROMPT_EOL_MARK=""
+ '';
+ ohMyZsh = {
+ enable = true;
+ theme = "robbyrussell";
+ plugins = [ "git" ];
+ preLoaded = ''
+ COMPLETION_WAITING_DOTS=true
+ HYPHEN_INSENSITIVE=true
+ '';
+ };
+ };
+
+ nix-index-database.comma.enable = true;
+ };
+
+ # TODO: Check if we should use systemd.user.tmpfiles with %h and default options, also to
+ # deduplicate rules between users.
+ systemd.tmpfiles.rules = [
+ "d /home/rei/.config 0700 rei users"
+ # Vim needs this to exist in order to use XDG dirs.
+ "d /home/rei/.config/vim 0755 rei users"
+
+ "d /root/.config 0700 root root"
+ # See above.
+ "d /root/.config/vim 0755 root root"
+ ];
+
+ networking = {
+ hostName = "ruysch";
+ networkmanager.enable = true;
+ };
+
+ services = {
+ btrfs.autoScrub.enable = true;
+ fwupd.enable = true;
+
+ openssh = {
+ settings = {
+ PasswordAuthentication = false;
+ KbdInteractiveAuthentication = false;
+ };
+ extraConfig = ''
+ PrintLastLog no
+ '';
+ };
+ };
+
+ networking = {
+ # I fart in your general direction!
+ firewall.rejectPackets = true;
+ nftables.enable = true;
+ };
+
+ security = {
+ polkit = {
+ enable = true;
+ # Not yet in stable as of 26.05.
+ # enablePkexecWrapper = true;
+ extraConfig = ''
+ polkit.addRule(function (action, subject) {
+ if (subject.user == "rei") {
+ return polkit.Result.AUTH_SELF;
+ }
+ });
+ '';
+ };
+
+ sudo.extraConfig = ''
+ Defaults lecture="never"
+ '';
+ };
+}
diff --git a/nixos/flake.lock b/nixos/flake.lock
new file mode 100644
index 0000000..f2673a3
--- /dev/null
+++ b/nixos/flake.lock
@@ -0,0 +1,122 @@
+{
+ "nodes": {
+ "home-manager": {
+ "inputs": {
+ "nixpkgs": [
+ "impermanence",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1768598210,
+ "narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "type": "github"
+ }
+ },
+ "impermanence": {
+ "inputs": {
+ "home-manager": "home-manager",
+ "nixpkgs": "nixpkgs"
+ },
+ "locked": {
+ "lastModified": 1792739756,
+ "narHash": "sha256-s0TeXWG5Ci75Y/Hzon0Z7NrN/fG773Rc54/z6oPFszQ=",
+ "owner": "nix-community",
+ "repo": "impermanence",
+ "rev": "fa627f4c8b8e92f58f58a73d99ee4e1304e64eb2",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "impermanence",
+ "type": "github"
+ }
+ },
+ "nix-index-database": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs-26-05"
+ ]
+ },
+ "locked": {
+ "lastModified": 1794739050,
+ "narHash": "sha256-PCGNIyAydZcdUXCxEXTjrS1+wWS+k9E+ENqBkUK2Mpg=",
+ "owner": "nix-community",
+ "repo": "nix-index-database",
+ "rev": "9bd074026d6db75b59aae8cd6071b5f2fe27a36c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nix-index-database",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1768564909,
+ "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-26-05": {
+ "locked": {
+ "lastModified": 1794872590,
+ "narHash": "sha256-E+XLAfnC7+bdr4qlEgRv6cdGmiqTU5oeFNKCha7epqQ=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "f68407657ad294471eb4b2e65d193df26edf729f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-26.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-unstable": {
+ "locked": {
+ "lastModified": 1794890597,
+ "narHash": "sha256-lME2lHoDHAaSHP3/okgiVoJ0icVEvsQH8LeU3We7tcc=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "04906337b6d53e8bb0eaf0470ae9f070a4d4eb55",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "impermanence": "impermanence",
+ "nix-index-database": "nix-index-database",
+ "nixpkgs-26-05": "nixpkgs-26-05",
+ "nixpkgs-unstable": "nixpkgs-unstable"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/nixos/flake.nix b/nixos/flake.nix
new file mode 100644
index 0000000..96a6a53
--- /dev/null
+++ b/nixos/flake.nix
@@ -0,0 +1,35 @@
+{
+ inputs = {
+ nixpkgs-26-05.url = "github:nixos/nixpkgs/nixos-26.05";
+ nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
+ impermanence.url = "github:nix-community/impermanence";
+ nix-index-database = {
+ url = "github:nix-community/nix-index-database";
+ inputs.nixpkgs.follows = "nixpkgs-26-05";
+ };
+ };
+
+ outputs = inputs @ {
+ self,
+ nixpkgs-26-05,
+ nixpkgs-unstable,
+ impermanence,
+ nix-index-database,
+ ...
+ }: {
+ nixosConfigurations.ruysch = nixpkgs-26-05.lib.nixosSystem {
+ specialArgs.pkgs-unstable = import nixpkgs-unstable {
+ system = "x86_64-linux";
+ config.allowUnfree = true;
+ };
+ modules = [
+ impermanence.nixosModules.impermanence
+ nix-index-database.nixosModules.default
+ ./common.nix
+ ./graphical.nix
+ ./ruysch.nix
+ ./ruysch-graphical.nix
+ ];
+ };
+ };
+}
diff --git a/nixos/graphical.nix b/nixos/graphical.nix
new file mode 100644
index 0000000..db1f413
--- /dev/null
+++ b/nixos/graphical.nix
@@ -0,0 +1,206 @@
+{ pkgs, pkgs-unstable, ... }:
+
+{
+ boot = {
+ consoleLogLevel = 0;
+ kernelParams = [ "splash" "quiet" ];
+ plymouth.enable = true;
+ };
+
+ # For ddcutil.
+ users.users.rei.extraGroups = [ "i2c" ];
+
+ hardware = {
+ bluetooth.enable = true;
+ # For ddcutil.
+ i2c.enable = true;
+ };
+
+ environment.systemPackages = with pkgs; [
+ # CLI programs.
+
+ android-tools
+ # TODO: Consider replacing with ddcutil-service.
+ ddcutil
+ wl-clipboard
+
+ # Graphical programs.
+
+ blanket
+ celluloid
+ gnome-calculator
+ loupe
+ # We don't use programs.nm-applet.enable because that also creates an enabled systemd unit for
+ # the applet. We just want nm-connection-editor.
+ networkmanagerapplet
+ obsidian
+ spotify
+ sublime-merge
+ pkgs-unstable.overskride
+ pkgs-unstable.pwvucontrol
+ pkgs-unstable.yt-dlp
+
+ # Icon themes.
+
+ adw-gtk3
+ adwaita-icon-theme
+ ];
+
+ programs = {
+ firefox.enable = true;
+ gnome-terminal.enable = true;
+ niri.enable = true;
+
+ thunderbird = {
+ enable = true;
+ policies = {
+ ExtensionSettings."langpack-en-GB@thunderbird.mozilla.org" = {
+ installation_mode = "force_installed";
+ install_url = let inherit (pkgs.thunderbird) version; in
+ "https://releases.mozilla.org/pub/thunderbird/releases/${version}/linux-x86_64/xpi/en-GB.xpi";
+ };
+ RequestedLocales = [ "en-GB" ];
+ };
+ };
+
+ dconf = {
+ enable = true;
+ profiles.user.databases = [ {
+ settings = {
+ "ca/desrt/dconf-editor".show-warning = false;
+ "org/gnome/desktop/interface" = {
+ accent-color = "purple";
+ color-scheme = "prefer-dark";
+ font-hinting = "none";
+ font-name = "Fira Sans Condensed 11";
+ gtk-theme = "adw-gtk3-dark";
+ monospace-font-name = "Fira Mono 10";
+ };
+ "org/gnome/desktop/wm/preferences".button-layout = "";
+ "org/gnome/nautilus/icon-view".default-zoom-level = "large";
+ "org/gnome/nautilus/list-view".default-zoom-level = "small";
+ "org/gnome/nautilus/preferences".default-folder-viewer = "list-view";
+ "org/gnome/terminal/legacy".default-show-menubar = false;
+ "org/gtk/gtk4/settings/file-chooser".show-hidden = true;
+ };
+ } ];
+ };
+ };
+
+ services.gvfs.enable = true;
+
+ fonts = {
+ packages = with pkgs; [
+ fira
+ # Hopefully temporary, for Ironbar.
+ font-awesome
+ # google-fonts
+ noto-fonts
+ ];
+ fontconfig = {
+ defaultFonts = {
+ sansSerif = [ "Fira Sans Condensed" ];
+ monospace = [ "Fira Mono" ];
+ };
+ hinting.enable = false;
+ };
+ };
+
+ # TODO: Replace all these with CLI arguments / environment variables.
+ systemd.user.tmpfiles.rules = [
+ "d /home/rei/.config/niri 0755 rei users"
+ "L /home/rei/.config/niri/config.kdl - - - - /etc/niri/config.kdl"
+ "L /home/rei/.config/nwg-bar - - - - /etc/nwg-bar"
+ ];
+
+ environment = {
+ persistence = {
+ "/mnt/persistent-data".users.rei.directories = [
+ "backups"
+ "downloads"
+ "projects"
+ "screenshots"
+ ".config/mozilla/firefox"
+ # TODO: Move to machine state.
+ ".config/spotify"
+ ".thunderbird"
+ ];
+ "/mnt/machine-state" = {
+ directories = [
+ "/var/lib/bluetooth"
+ ];
+ users.rei.directories = [
+ ".android"
+ ".config/obsidian"
+ ];
+ };
+ };
+
+ etc = {
+ "xdg/autostart/nm-applet.desktop".text = ''
+ [Desktop Entry]
+ Hidden=true
+ '';
+ "xdg/hypr/hyprlock.conf".text = ''
+ background {
+ path = /home/rei/projects/infrastructure/nixos/assets/wallpaper-macos-swirlies
+ blur_passes = 4
+ blur_size = 4
+ contrast = 1.0
+ brightness = 1.0
+ vibrancy = 0.0
+ }
+
+ animations {
+ animation = fade, 0
+ }
+
+ # Clock.
+
+ label {
+ halign = center
+ valign = center
+ position = 0, 140
+
+ # TODO: Get the letter spacing identical to the explicit font name version.
+ # text = $TIME
+ text = $TIME
+ text_align = center
+ }
+
+ # Password textbox.
+
+ input-field {
+ halign = center
+ valign = center
+ position = 0, -180
+
+ size = 450, 75
+ placeholder_text = Password
+ fail_text = Incorrect
+ inner_color = rgb(FFFFFF)
+ font_color = rgb(000000)
+ check_color = rgb(FF9800)
+ outline_thickness = 0
+ rounding = 10
+ fade_on_empty = false
+ # TODO: Doesn't exist anymore, what did this use to achieve?
+ # fail_timeout = 500
+ }
+
+ # Keyboard layout indicator.
+ # TODO: Why does this not work anymore?
+
+ # label {
+ # halign = center
+ # valign = center
+ # position = 0, -600
+
+ # text = $LAYOUT[!,Keyboard layout: български,Keyboard layout: Ελληνικά]
+ # }
+ '';
+ };
+ };
+
+ security.soteria.enable = true;
+}
diff --git a/nixos/readme.md b/nixos/readme.md
new file mode 100644
index 0000000..349fac7
--- /dev/null
+++ b/nixos/readme.md
@@ -0,0 +1,3 @@
+# NixOS Infrastructure
+
+- Secrets go in `/etc/nixos/secrets`.
diff --git a/nixos/ruysch-graphical.nix b/nixos/ruysch-graphical.nix
new file mode 100644
index 0000000..cbb4542
--- /dev/null
+++ b/nixos/ruysch-graphical.nix
@@ -0,0 +1,386 @@
+{ pkgs, pkgs-unstable, ... }:
+
+{
+ hardware.logitech.wireless.enable = true;
+
+ programs.wireshark = {
+ enable = true;
+ # Default is CLI-only package.
+ package = pkgs.wireshark;
+ usbmon.enable = true;
+ };
+
+ environment = {
+ systemPackages = with pkgs; [
+ cartero
+ darktable
+ signal-desktop
+ pkgs-unstable.jetbrains.rust-rover
+ ];
+
+ persistence = {
+ "/mnt/persistent-data" = {
+ users.rei = {
+ directories = [
+ ".config/JetBrains"
+ ".config/sublime-merge"
+ ".local/share/JetBrains"
+ ".java"
+ ".claude"
+ ".mc"
+ ];
+ files = [
+ ".claude.json"
+ ];
+ };
+ };
+ "/mnt/machine-state".users.rei.directories = [
+ ".cargo"
+ ".config/Signal"
+ ".local/share/direnv"
+ ];
+ };
+
+ etc = let
+ bluetoothctl = "${pkgs.bluez}/bin/bluetoothctl";
+ brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
+ busctl = "${pkgs.systemd}/bin/busctl";
+ emote = "${pkgs.emote}/bin/emote";
+ firefox = "${pkgs.firefox}/bin/firefox";
+ gnome-terminal = "${pkgs.gnome-terminal}/bin/gnome-terminal";
+ hyprlock = "${pkgs.hyprlock}/bin/hyprlock";
+ ironbar = "${pkgs.ironbar}/bin/ironbar";
+ loginctl = "${pkgs.systemd}/bin/loginctl";
+ mako = "${pkgs.mako}/bin/mako";
+ nautilus = "${pkgs.nautilus}/bin/nautilus";
+ nmcli = "${pkgs.networkmanager}/bin/nmcli";
+ nwg-bar = "${pkgs.nwg-bar}/bin/nwg-bar";
+ pactl = "${pkgs.pulseaudio}/bin/pactl";
+ playerctl = "${pkgs.playerctl}/bin/playerctl";
+ rofi = "${pkgs.rofi}/bin/rofi";
+ swaybg = "${pkgs.swaybg}/bin/swaybg";
+ swayidle = "${pkgs.swayidle}/bin/swayidle";
+ systemctl = "${pkgs.systemd}/bin/systemctl";
+ wayland-logout = "${pkgs.wayland-logout}/bin/wayland-logout";
+ wl-gammarelay-rs = "${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs";
+ wlr-randr = "${pkgs.wlr-randr}/bin/wlr-randr";
+ in {
+ "mako/config".text = ''
+ font=Fira Sans Condensed 11
+ background-color=#000000
+ width=400
+ border-size=0
+ padding=10
+ default-timeout=5000
+ '';
+
+ "niri/config.kdl".text = ''
+ spawn-at-startup "${swaybg}" "--image" \
+ "/home/rei/projects/infrastructure/nixos/assets/wallpaper-macos-swirlies"
+ spawn-at-startup "${ironbar}"
+ spawn-at-startup "${wl-gammarelay-rs}"
+ spawn-at-startup "${mako}" "--config" "/etc/mako/config"
+
+
+
+ prefer-no-csd
+ screenshot-path "~/screenshots/niri-%Y-%m-%d-%H:%M:%S.png"
+
+ hotkey-overlay { skip-at-startup; }
+
+ input {
+ disable-power-key-handling
+
+ keyboard {
+ xkb {
+ layout "us,bg(phonetic),gr"
+ options "compose:ralt"
+ }
+ }
+ mouse { accel-profile "flat"; }
+ touchpad {
+ click-method "clickfinger"
+ natural-scroll
+ accel-speed 0.2
+ }
+ }
+
+ cursor { xcursor-theme "Adwaita"; }
+
+ layout {
+ gaps 60
+ center-focused-column "on-overflow"
+ always-center-single-column
+ empty-workspace-above-first
+
+ // struts { top -60; }
+ focus-ring { off; }
+ preset-column-widths {
+ proportion 0.5
+ proportion 1.0
+ }
+ insert-hint { color "#9141AC88"; }
+ }
+
+ overview { backdrop-color "#181821"; }
+ recent-windows { off; }
+ animations { slowdown 0.5; }
+ gestures { hot-corners { off; }; }
+
+
+
+ // Internal laptop screen.
+
+ output "BOE 0x0BCA Unknown" { scale 1.125; }
+
+ // TandemDrive office monitors.
+
+ output "Dell Inc. DELL P2715Q V48W26AB160L" { scale 1.25; }
+ output "Dell Inc. DELL P2715Q V48W26AB261L" { scale 1.25; }
+ output "Dell Inc. DELL P2715Q V48W263V308S" { scale 1.25; }
+ output "Dell Inc. DELL U3225QE GTC9C84" { mode "3840x2160@120"; }
+ output "LG Electronics LG HDR 4K 0x0005C746" { scale 1.25; }
+ output "LG Electronics LG Ultra HD 0x00020FEA" { scale 1.25; }
+ output "LG Electronics LG Ultra HD 0x00020FF4" { scale 1.25; }
+
+ // TV room Social Hub
+
+ output "Samsung Electric Company SAMSUNG 0x01000E00" {
+ scale 1.5
+ mode custom=true "2560x1440@60"
+ }
+
+
+
+ binds {
+ Super+Q { close-window; }
+ Super+W { spawn "${rofi}" "-show" "drun"; }
+ Super+E { spawn "${gnome-terminal}"; }
+ Super+R { spawn "${nautilus}"; }
+
+ Super+T { spawn "${firefox}"; }
+ Super+Shift+T { spawn "${firefox}" "--private-window"; }
+
+ Super+A { center-column; }
+ Super+S { switch-preset-column-width; }
+ Super+D { toggle-window-floating; }
+
+ Super+U allow-when-locked=true {
+ spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "-2%"
+ }
+ Super+I allow-when-locked=true {
+ spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "+2%"
+ }
+ Super+Shift+I allow-when-locked=true {
+ spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "100%"
+ }
+ Super+O allow-when-locked=true {
+ spawn "${pactl}" "set-sink-mute" "@DEFAULT_SINK@" "toggle"
+ }
+
+ Super+P allow-when-locked=true { spawn "${wlr-randr}" "--output" "eDP-1" "--toggle"; }
+
+ Super+H { spawn "${nmcli}" "connection" "up" "airvpn"; }
+ Super+Shift+H { spawn "${nmcli}" "connection" "down" "airvpn"; }
+
+ Super+J { spawn "${emote}"; }
+ // TODO: Put this in linux-utils as Nix package.
+ // Super+K allow-when-locked=true { spawn "wl-gammarelay-toggle-temperature"; }
+ Super+K allow-when-locked=true {
+ spawn "${busctl}" "--user" "set-property" "rs.wl-gammarelay" "/" "rs.wl.gammarelay" \
+ "Temperature" "q" "4500"
+ }
+ Super+Shift+K allow-when-locked=true {
+ spawn "${busctl}" "--user" "set-property" "rs.wl-gammarelay" "/" "rs.wl.gammarelay" \
+ "Temperature" "q" "6500"
+ }
+ // TODO: Set up session-based locking like on Arch.
+ // Super+L { spawn "${loginctl}" "lock-session"; }
+ Super+L { spawn "${hyprlock}"; }
+
+ // I.e. the Non-Screeching Earwarmers.
+ Super+B { spawn "${bluetoothctl}" "connect" "58:18:62:1F:E3:33"; }
+ Super+Shift+B { spawn "${bluetoothctl}" "disconnect" "58:18:62:1F:E3:33"; }
+
+ Super+M { spawn "${playerctl}" "play-pause"; }
+ Super+Comma { spawn "${playerctl}" "previous"; }
+ Super+Period { spawn "${playerctl}" "next"; }
+
+ // TODO: Turn into Nix package.
+ // Super+BracketLeft allow-when-locked=true { spawn "ddc-brightness" "down"; }
+ // Super+BracketRight allow-when-locked=true { spawn "ddc-brightness" "up"; }
+ // Super+Shift+BracketRight allow-when-locked=true { spawn "ddc-brightness" "max"; }
+
+ Super+Tab { toggle-overview; }
+ Super+Space { switch-layout "next"; }
+ Super+Escape { spawn "${nwg-bar}"; }
+ Super+F11 { fullscreen-window; }
+
+ Super+Left { focus-column-left; }
+ Super+Right { focus-column-right; }
+ Super+Up { focus-workspace-up; }
+ Super+Down { focus-workspace-down; }
+ Super+Home { focus-column-first; }
+ Super+End { focus-column-last; }
+
+ Super+Shift+Left { move-column-left; }
+ Super+Shift+Right { move-column-right; }
+ Super+Shift+Up { move-column-to-workspace-up; }
+ Super+Shift+Down { move-column-to-workspace-down; }
+ Super+Shift+Home { move-column-to-first; }
+ Super+Shift+End { move-column-to-last; }
+
+ Super+Control+Shift+Left { move-column-to-monitor-left; }
+ Super+Control+Shift+Right { move-column-to-monitor-right; }
+ Super+Control+Shift+Up { move-column-to-monitor-up; }
+ Super+Control+Shift+Down { move-column-to-monitor-down; }
+
+ Super+1 { set-column-width "40%"; }
+ Super+2 { set-column-width "50%"; }
+ Super+3 { set-column-width "66.667%"; }
+ Super+4 { set-column-width "75%"; }
+ Super+5 { set-column-width "100%"; }
+
+ // TODO: Add back rectangle screenshot selection.
+ Print { screenshot; }
+ Super+Print { screenshot-window; }
+
+ // Special function keys.
+
+ XF86MonBrightnessDown allow-when-locked=true { spawn "${brightnessctl}" "set" "10%-"; }
+ XF86MonBrightnessUp allow-when-locked=true { spawn "${brightnessctl}" "set" "+10%"; }
+
+ XF86AudioLowerVolume allow-when-locked=true {
+ spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "-2%"
+ }
+ XF86AudioRaiseVolume allow-when-locked=true {
+ spawn "${pactl}" "set-sink-volume" "@DEFAULT_SINK@" "+2%"
+ }
+ XF86AudioMute allow-when-locked=true {
+ spawn "${pactl}" "set-sink-mute" "@DEFAULT_SINK@" "toggle"
+ }
+
+ XF86AudioPlay allow-when-locked=true { spawn "${playerctl}" "play-pause"; }
+ XF86AudioPause allow-when-locked=true { spawn "${playerctl}" "play-pause"; }
+ }
+
+
+
+ // 75% width windows.
+
+ window-rule {
+ match app-id="firefox" is-floating=false
+ match app-id="jetbrains-rustrover" is-floating=false
+ match app-id="md.obsidian.Obsidian" is-floating=false
+ match app-id="signal" is-floating=false
+ match app-id="spotify" is-floating=false
+ match app-id="sublime_merge" is-floating=false
+ match app-id="thunderbird" is-floating=false
+
+ default-column-width { proportion 0.75; }
+ }
+
+ // Floated windows.
+
+ window-rule {
+ match app-id="org.gnome.Calculator"
+
+ open-floating true
+ }
+
+ // Un-floated windows.
+
+ window-rule {
+ match app-id="jetbrains-rustrover" title="^Conflicts$"
+ match app-id="jetbrains-rustrover" title="^Merge Revisions for "
+ match app-id="jetbrains-rustrover" title="^Settings – "
+
+ open-floating false
+ }
+
+ // Windows with clipped off shadows.
+
+ window-rule {
+ match app-id="jetbrains-rustrover" is-floating=false
+
+ clip-to-geometry true
+ }
+
+ // Add shadow to floating windows.
+
+ window-rule {
+ match is-floating=true
+ // These already have shadows, and aren't rectangular so clipping the existing ones off
+ // is a pain in the arse.
+ exclude app-id="jetbrains-rustrover"
+
+ shadow {
+ on
+ color "#0004"
+ softness 30
+ spread 0
+ offset x=0 y=0
+ draw-behind-window true
+ }
+ }
+ '';
+
+ "nwg-bar/bar.json".text = ''
+ [ {
+ "label": "_Lock",
+ "exec": "${loginctl} lock-session",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-lock-screen-symbolic.svg"
+ }, {
+ "label": "Log out",
+ "exec": "${wayland-logout}",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-log-out-symbolic.svg"
+ }, {
+ "label": "_Suspend",
+ "exec": "${systemctl} suspend",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg"
+ }, {
+ "label": "_Hibernate",
+ "exec": "${systemctl} hibernate",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg"
+ }, {
+ "label": "Shut down",
+ "exec": "${systemctl} poweroff",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-shutdown-symbolic.svg"
+ }, {
+ "label": "Reboot",
+ "exec": "${systemctl} reboot",
+ "icon": "/usr/local/share/icons/kernelmaft/scalable/system-restart-symbolic.svg"
+ } ]
+ '';
+ "nwg-bar/style.css".text = ''
+ window { background-color: black; }
+
+ #outer-box { margin: 30px; }
+
+ label {
+ margin-top: 8px;
+ color: white;
+ }
+
+ button {
+ margin: 10px;
+ padding: 14px;
+ background-color: #333;
+ }
+
+ button:hover { background-color: #444; }
+ '';
+ };
+ };
+
+ services.evremap = {
+ enable = true;
+ settings = {
+ device_name = "Logitech MX Vertical";
+ remap = [
+ { input = [ "BTN_EXTRA" ]; output = [ "BTN_MIDDLE" ]; }
+ { input = [ "BTN_SIDE" ]; output = [ "BTN_MIDDLE" ]; }
+ ];
+ };
+ };
+}
diff --git a/nixos/ruysch.nix b/nixos/ruysch.nix
new file mode 100644
index 0000000..7714672
--- /dev/null
+++ b/nixos/ruysch.nix
@@ -0,0 +1,268 @@
+{ lib, pkgs, pkgs-unstable, ... }:
+
+{
+ system.stateVersion = "26.05";
+
+
+
+ nixpkgs.hostPlatform = "x86_64-linux";
+
+ boot = {
+ loader = {
+ efi.canTouchEfiVariables = true;
+ systemd-boot.enable = true;
+ };
+ initrd = {
+ availableKernelModules = [
+ "nvme"
+ "sd_mod"
+ "thunderbolt"
+ "uas"
+ "usb_storage"
+ "xhci_pci"
+ ];
+
+ luks.devices.soil = {
+ device = "/dev/disk/by-uuid/69a2344e-9c66-46a5-ac81-8ecdce8f0c8e";
+ # Enable TRIM support.
+ allowDiscards = true;
+ crypttabExtraOpts = [ "fido2-device=auto" ];
+ };
+
+ systemd.services.wipe-ephemeral-root = {
+ unitConfig.DefaultDependencies = false;
+
+ after = [ "systemd-cryptsetup@soil.service" ];
+ requires = [ "systemd-cryptsetup@soil.service" ];
+ wantedBy = [ "initrd.target" ];
+ before = [ "sysroot.mount" ];
+
+ serviceConfig.Type = "oneshot";
+ path = with pkgs; [ btrfs-progs util-linux ];
+
+ script = ''
+ mount --mkdir /dev/mapper/soil /soil
+ btrfs subvolume delete --recursive /soil/ephemeral-root
+ btrfs subvolume create /soil/ephemeral-root
+ umount /soil
+ '';
+ };
+ };
+
+ kernelModules = [ "kvm-amd" ];
+ kernelPackages = pkgs.linuxPackages_zen;
+ };
+
+ hardware.cpu.amd.updateMicrocode = true;
+
+ swapDevices = [ {
+ device = "/var/lib/swapfile";
+ size = 32 * 1024;
+ } ];
+
+ fileSystems = {
+ "/boot" = {
+ device = "/dev/disk/by-uuid/A478-356B";
+ fsType = "vfat";
+ options = [ "fmask=0077" "dmask=0077" ];
+ };
+ "/" = {
+ device = "/dev/mapper/soil";
+ fsType = "btrfs";
+ options = [ "subvol=/ephemeral-root" ];
+ };
+ "/nix" = {
+ device = "/dev/mapper/soil";
+ fsType = "btrfs";
+ options = [ "subvol=/machine-state/nix" ];
+ };
+ "/mnt/machine-state" = {
+ device = "/dev/mapper/soil";
+ fsType = "btrfs";
+ options = [ "subvol=/machine-state" ];
+ neededForBoot = true;
+ };
+ "/mnt/persistent-data" = {
+ device = "/dev/mapper/soil";
+ fsType = "btrfs";
+ options = [ "subvol=/persistent-data" ];
+ neededForBoot = true;
+ };
+ };
+
+ users = {
+ users = {
+ # As of 2026-08-03 we need to use this path directly because this gets read before any
+ # impermanence mounts happen. In fact, these are systemd mount units, and NixOS accounts are
+ # provisioned before systemd itself is even started.
+ rei.hashedPasswordFile = "/mnt/persistent-data/etc/nixos/secrets/password-ruysch-rei";
+
+ garage = {
+ isSystemUser = true;
+ group = "garage";
+ };
+ };
+ groups.garage = {};
+ };
+
+ networking = {
+ hostName = "ruysch";
+ networkmanager.enable = true;
+
+ hosts = {
+ "fdef:4d4b:17b2::1" = [ "travel-router-vivian" ];
+ "10.0.0.1" = [ "travel-router-vivian" ];
+ };
+ };
+
+ environment = {
+ systemPackages = with pkgs; [
+ minio-client
+ python3
+ pkgs-unstable.claude-code
+ ];
+
+ persistence."/mnt/persistent-data".directories = [
+ # For TandemDrive config.
+ "/usr/local/etc"
+ "/var/lib/garage"
+ "/var/lib/postgresql"
+ ];
+
+ etc."claude/settings.json".source = (pkgs.formats.json {}).generate "claude-config" {
+ # Required by TandemDrive security policy.
+
+ permissions = {
+ deny = [
+ "Read(.env)"
+ "Read(.env.*)"
+ "Read(~/.ssh/**)"
+ "Read(~/.gnupg/**)"
+ "Read(~/.config/**)"
+ "Read(~/Documents/**)"
+ "Bash(* | bash)"
+ "Bash(* | sh)"
+ "Bash(sudo *)"
+ "Bash(ssh *)"
+ "Bash(git push *)"
+ "Bash(git commit *)"
+ ];
+ ask = [
+ "Bash(git push *)"
+ "Bash(git commit *)"
+ ];
+ disableBypassPermissionsMode = "disable";
+ };
+
+ # Personal config.
+
+ env = {
+ CLAUDE_CODE_ENABLE_AWAY_SUMMARY = 0;
+ CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION = "false";
+ };
+ feedbackSurveyRate = 0;
+ modelSettings.claude-opus-5-5.effortLevel = "high";
+ # Default is dark.
+ theme = "auto";
+ };
+ };
+
+ services = {
+ tzupdate = {
+ # Triggers malware detection at TandemDrive office, therefore disabled.
+ # enable = true;
+ # timer.enable = true;
+ };
+
+ beesd.filesystems.soil = {
+ spec = "UUID=33bee671-ce7b-4747-a922-95ef885f0172";
+ workDir = "/machine-state/var/lib/bees";
+ extraOptions = [ "--thread-count" "2" ];
+ };
+
+ postgresql = {
+ enable = true;
+ package = pkgs.postgresql_18;
+ ensureUsers = [ {
+ name = "rei";
+ ensureClauses.superuser = true;
+ } ];
+ ensureDatabases = [ "rei" ];
+ authentication = ''
+ local all all trust
+ host all all ::1/128 trust
+ host all all 127.0.0.1/32 trust
+ '';
+ };
+
+ garage = {
+ enable = true;
+ package = pkgs.garage_2;
+ settings = {
+ replication_factor = 1;
+ rpc_bind_addr = "[::]:3901";
+ rpc_secret_file = "/etc/nixos/secrets/ruysch-garage-rpc-secret";
+ s3_api = {
+ api_bind_addr = "[::]:3900";
+ s3_region = "garage";
+ };
+ };
+ };
+
+ redis = {
+ package = pkgs.valkey;
+ servers."" = {
+ enable = true;
+ unixSocketPerm = 666;
+ };
+ };
+ };
+
+ programs = {
+ # We have physical cores, so enable this.
+ htop.settings.show_cpu_frequency = true;
+
+ ssh.extraConfig = ''
+ Host git.service.d11n.nl
+ Port 258
+
+ # TODO: Check if we can specify this in an actual config item.
+ VerifyHostKeyDNS yes
+ ForwardAgent no
+ '';
+
+ direnv = {
+ enable = true;
+ nix-direnv.enable = true;
+ };
+ };
+
+ systemd.services = {
+ # We need a named user so that the RPC key file can be owned by it.
+
+ garage.serviceConfig = {
+ DynamicUser = lib.mkForce false;
+ User = "garage";
+ Group = "garage";
+ };
+
+ redis.serviceConfig.RuntimeDirectoryMode = lib.mkForce "0755";
+ };
+
+ systemd.user.tmpfiles.rules = [
+ # TODO: Don't persist entire .claude directory.
+ "L /home/rei/.claude/settings.json - - - - /etc/claude/settings.json"
+ ];
+
+ systemd.tmpfiles.rules = [
+ "L+ /tmp/.s.PGSQL.5432 - - - - /run/postgresql/.s.PGSQL.5432"
+ ];
+
+ security.pam = {
+ u2f.enable = true;
+ # TODO: Get Yubikey for sudo to work.
+ };
+
+ # Temporary until we figure out how to reliably block tzupdate on TandemDrive network.
+ time.timeZone = "Europe/Amsterdam";
+}