diff --git a/graphical.nix b/graphical.nix deleted file mode 100644 index 337a9bd..0000000 --- a/graphical.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ pkgs, ... }: - -{ - hardware.bluetooth.enable = true; - - environment.systemPackages = with pkgs; [ - adwaita-icon-theme - overskride - spotify - sublime-merge - wl-clipboard - ]; - - programs = { - firefox.enable = true; - gnome-terminal.enable = true; - niri.enable = true; - thunderbird.enable = true; - - dconf = { - enable = true; - profiles.user.databases = [ { - settings = { - "ca/desrt/dconf-editor".show-warning = false; - "org/gnome/desktop/interface" = { - font-hinting = "none"; - font-name = "Fira Sans Condensed 11"; - monospace-font-name = "Fira Mono 10"; - }; - "org/gnome/desktop/wm/preferences".button-layout = ""; - "org/gnome/terminal/legacy".default-show-menubar = false; - }; - } ]; - }; - }; - - fonts = { - packages = with pkgs; [ - fira - noto-fonts - # google-fonts - ]; - fontconfig = { - defaultFonts = { - sansSerif = [ "Fira Sans Condensed" ]; - monospace = [ "Fira Mono" ]; - }; - hinting.enable = false; - }; - }; - - systemd.user.tmpfiles.rules = [ - "d /home/rei/.config/niri 0755 rei users" - "L /home/rei/.config/niri/config.kdl - - - - /etc/niri/config.kdl" - ]; - - environment = { - persistence = { - "/mnt/persistent-data".users.rei.directories = [ - "backups" - "downloads" - "projects" - "screenshots" - ".config/mozilla/firefox" - ".config/spotify" - ".thunderbird" - ]; - "/mnt/machine-state".directories = [ - "/var/lib/bluetooth" - ]; - }; - - etc."xdg/hypr/hyprlock.conf".text = '' - background { - path = /etc/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: Ελληνικά] - } - ''; - }; -} diff --git a/.gitignore b/nixos/.gitignore similarity index 52% rename from .gitignore rename to nixos/.gitignore index 956d472..3113471 100644 --- a/.gitignore +++ b/nixos/.gitignore @@ -1 +1,3 @@ /secrets + +.*.swp diff --git a/assets/openssh-authorized-keys b/nixos/assets/openssh-authorized-keys similarity index 100% rename from assets/openssh-authorized-keys rename to nixos/assets/openssh-authorized-keys diff --git a/assets/wallpaper-macos-swirlies b/nixos/assets/wallpaper-macos-swirlies similarity index 100% rename from assets/wallpaper-macos-swirlies rename to nixos/assets/wallpaper-macos-swirlies diff --git a/common.nix b/nixos/common.nix similarity index 91% rename from common.nix rename to nixos/common.nix index 276ec88..5c68cc6 100644 --- a/common.nix +++ b/nixos/common.nix @@ -12,6 +12,7 @@ lsof nix-diff nix-tree + ouch pv usbutils tealdeer @@ -75,6 +76,7 @@ dust = "dust --limit-filesystem"; "mkfs.ntfs" = "mkfs.ntfs --quick"; nix-shell = "nix-shell --run $SHELL"; + yt-dlp = "yt-dlp --write-subs"; # Command shortcuts. @@ -105,6 +107,13 @@ 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 = '' @@ -116,6 +125,11 @@ " 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 @@ -137,7 +151,7 @@ mutableUsers = false; users.rei = { isNormalUser = true; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "wireshark" ]; openssh.authorizedKeys.keyFiles = [ assets/openssh-authorized-keys ]; }; }; @@ -245,12 +259,12 @@ extraConfig = '' polkit.addRule(function (action, subject) { if (subject.user == "rei") { - // TODO: Find out what the difference between AUTH_SELF and AUTH_ADMIN is. return polkit.Result.AUTH_SELF; } }); ''; }; + sudo.extraConfig = '' Defaults lecture="never" ''; diff --git a/flake.lock b/nixos/flake.lock similarity index 78% rename from flake.lock rename to nixos/flake.lock index d638034..f2673a3 100644 --- a/flake.lock +++ b/nixos/flake.lock @@ -27,11 +27,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1769548169, - "narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=", + "lastModified": 1792739756, + "narHash": "sha256-s0TeXWG5Ci75Y/Hzon0Z7NrN/fG773Rc54/z6oPFszQ=", "owner": "nix-community", "repo": "impermanence", - "rev": "7b1d382faf603b6d264f58627330f9faa5cba149", + "rev": "fa627f4c8b8e92f58f58a73d99ee4e1304e64eb2", "type": "github" }, "original": { @@ -47,11 +47,11 @@ ] }, "locked": { - "lastModified": 1788680125, - "narHash": "sha256-amGSoDobwmp4CFvCn841ws2iuitus+HUJdD/gKgsrJA=", + "lastModified": 1794739050, + "narHash": "sha256-PCGNIyAydZcdUXCxEXTjrS1+wWS+k9E+ENqBkUK2Mpg=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "116ad1c2adb642405ef8916f6a94c8626f971344", + "rev": "9bd074026d6db75b59aae8cd6071b5f2fe27a36c", "type": "github" }, "original": { @@ -78,11 +78,11 @@ }, "nixpkgs-26-05": { "locked": { - "lastModified": 1788807765, - "narHash": "sha256-J9oC0bKnkXUrMegqRTXVkyDFJ0gn2U/Qpoo9HgGMQmA=", + "lastModified": 1794872590, + "narHash": "sha256-E+XLAfnC7+bdr4qlEgRv6cdGmiqTU5oeFNKCha7epqQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "93108a538f079596c9a16c72cf03e9322782b6dd", + "rev": "f68407657ad294471eb4b2e65d193df26edf729f", "type": "github" }, "original": { @@ -94,11 +94,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1788752844, - "narHash": "sha256-VaWGJ6+cIYN2erfSecbRV+4ljI185Ty2wUrXyvQbgOw=", + "lastModified": 1794890597, + "narHash": "sha256-lME2lHoDHAaSHP3/okgiVoJ0icVEvsQH8LeU3We7tcc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dc5d91f840324650bac8c379428c7037a416959a", + "rev": "04906337b6d53e8bb0eaf0470ae9f070a4d4eb55", "type": "github" }, "original": { diff --git a/flake.nix b/nixos/flake.nix similarity index 100% rename from flake.nix rename to nixos/flake.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/readme.md b/nixos/readme.md similarity index 100% rename from readme.md rename to nixos/readme.md 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/ruysch.nix b/nixos/ruysch.nix similarity index 78% rename from ruysch.nix rename to nixos/ruysch.nix index 917f1dd..7714672 100644 --- a/ruysch.nix +++ b/nixos/ruysch.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, pkgs, pkgs-unstable, ... }: { system.stateVersion = "26.05"; @@ -50,7 +50,7 @@ }; kernelModules = [ "kvm-amd" ]; - kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_zen; }; hardware.cpu.amd.updateMicrocode = true; @@ -108,12 +108,18 @@ 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; [ - claude-code minio-client + python3 + pkgs-unstable.claude-code ]; persistence."/mnt/persistent-data".directories = [ @@ -122,6 +128,43 @@ "/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 = { @@ -206,6 +249,11 @@ 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" ]; diff --git a/ruysch-graphical.nix b/ruysch-graphical.nix deleted file mode 100644 index 32d7af2..0000000 --- a/ruysch-graphical.nix +++ /dev/null @@ -1,286 +0,0 @@ -{ pkgs, pkgs-unstable, ... }: - -{ - environment = { - systemPackages = [ - pkgs-unstable.jetbrains.rust-rover - pkgs.cartero - pkgs.darktable - pkgs.loupe - pkgs.signal-desktop - ]; - - 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 = { - "niri/config.kdl".text = '' - spawn-at-startup "${pkgs.swaybg}/bin/swaybg" "--image" \ - "~/projects/infrastructure/nixos/assets/wallpaper-macos-swirlies" - spawn-at-startup "${pkgs.ironbar}/bin/ironbar" - spawn-at-startup "${pkgs.wl-gammarelay-rs}/bin/wl-gammarelay-rs" - spawn-at-startup "${pkgs.swayidle}/bin/swayidle" "timeout" "600" \ - "${pkgs.hyprlock}/bin/hyprlock" - - - - 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; } - // LG monitor TandemDrive. - output "LG Electronics LG Ultra HD 0x00020FEA" { scale 1.25; } - - - - binds { - Super+Q { close-window; } - Super+W { spawn "${pkgs.rofi}/bin/rofi" "-show" "drun"; } - Super+E { spawn "${pkgs.gnome-terminal}/bin/gnome-terminal"; } - Super+R { spawn "${pkgs.nautilus}/bin/nautilus"; } - - Super+T { spawn "${pkgs.firefox}/bin/firefox"; } - Super+Shift+T { spawn "${pkgs.firefox}/bin/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 "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "-2%" - } - Super+I allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "+2%" - } - Super+Shift+I allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "100%" - } - Super+O allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle" - } - - Super+P allow-when-locked=true { - spawn "${pkgs.wlr-randr}/bin/wlr-randr" "--output" "eDP-1" "--toggle" - } - - // TODO: Replace with toggle script. - Super+H { spawn "${pkgs.networkmanager}/bin/nmcli" "connection" "up" "airvpn-serbia"; } - Super+Shift+H { - spawn "${pkgs.networkmanager}/bin/nmcli" "connection" "down" "airvpn-serbia" - } - - Super+J { spawn "${pkgs.emote}/bin/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 "${pkgs.systemd}/bin/busctl" "--user" "set-property" "rs.wl-gammarelay" "/" \ - "rs.wl.gammarelay" "Temperature" "q" "4500" - } - Super+Shift+K allow-when-locked=true { - spawn "${pkgs.systemd}/bin/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 "${pkgs.systemd}/bin/loginctl" "lock-session"; } - Super+L { spawn "${pkgs.hyprlock}/bin/hyprlock"; } - - // I.e. the Non-Screeching Earwarmers. - Super+B { spawn "${pkgs.bluez}/bin/bluetoothctl" "connect" "58:18:62:1F:E3:33"; } - Super+Shift+B { spawn "${pkgs.bluez}/bin/bluetoothctl" "disconnect" "58:18:62:1F:E3:33"; } - - Super+M { spawn "${pkgs.playerctl}/bin/playerctl" "play-pause"; } - Super+Comma { spawn "${pkgs.playerctl}/bin/playerctl" "previous"; } - Super+Period { spawn "${pkgs.playerctl}/bin/playerctl" "next"; } - - // TODO: Turn in to 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 "${pkgs.nwg-bar}/bin/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; } - - XF86MonBrightnessDown allow-when-locked=true { - spawn "${pkgs.brightnessctl}/bin/brightnessctl" "set" "10%-" - } - XF86MonBrightnessUp allow-when-locked=true { - spawn "${pkgs.brightnessctl}/bin/brightnessctl" "set" "+10%" - } - - XF86AudioLowerVolume allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "-2%" - } - XF86AudioRaiseVolume allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-volume" "@DEFAULT_SINK@" "+2%" - } - XF86AudioMute allow-when-locked=true { - spawn "${pkgs.pulseaudio}/bin/pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle" - } - - XF86AudioPlay allow-when-locked=true { - spawn "${pkgs.playerctl}/bin/playerctl" "play-pause" - } - XF86AudioPause allow-when-locked=true { - spawn "${pkgs.playerctl}/bin/playerctl" "play-pause" - } - } - - - - window-rule { - match app-id="firefox" is-floating=false - match app-id="jetbrains-rustrover" is-floating=false - match app-id="spotify" is-floating=false - match app-id="sublime_merge" is-floating=false - - default-column-width { proportion 0.75; } - } - - window-rule { - match app-id="jetbrains-rustrover" is-floating=false - - clip-to-geometry true - } - ''; - - "nwg-bar/bar.json".text = '' - [ { - "label": "_Lock", - "exec": "${pkgs.systemd}/bin/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": "${pkgs.systemd}/bin/systemctl suspend", - "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg" - }, { - "label": "_Hibernate", - "exec": "${pkgs.systemd}/bin/systemctl hibernate", - "icon": "/usr/local/share/icons/kernelmaft/scalable/system-suspend-symbolic.svg" - }, { - "label": "Shut down", - "exec": "${pkgs.systemd}/bin/systemctl poweroff", - "icon": "/usr/local/share/icons/kernelmaft/scalable/system-shutdown-symbolic.svg" - }, { - "label": "Reboot", - "exec": "${pkgs.systemd}/bin/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; } - ''; - }; - }; -}