352 lines
11 KiB
Nix
352 lines
11 KiB
Nix
{ pkgs, pkgs-unstable, ... }:
|
||
|
||
{
|
||
environment = {
|
||
systemPackages = with pkgs; [
|
||
cartero
|
||
darktable
|
||
signal-desktop
|
||
pkgs-unstable.jetbrains.rust-rover
|
||
];
|
||
|
||
programs.wireshark = {
|
||
enable = true;
|
||
# Default is CLI-only package.
|
||
package = pkgs.wireshark;
|
||
usbmon.enable = true;
|
||
};
|
||
|
||
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 {
|
||
"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 "${swayidle}" "timeout" "600" "${hyprlock}"
|
||
spawn-at-startup "${mako}"
|
||
|
||
|
||
|
||
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 monitors TandemDrive.
|
||
output "LG Electronics LG Ultra HD 0x00020FEA" { scale 1.25; }
|
||
output "LG Electronics LG Ultra HD 0x00020FF4" { scale 1.25; }
|
||
|
||
|
||
|
||
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"; }
|
||
|
||
// TODO: Replace with toggle script.
|
||
Super+H { spawn "${nmcli}" "connection" "up" "airvpn-serbia"; }
|
||
Super+Shift+H { spawn "${nmcli}" "connection" "down" "airvpn-serbia"; }
|
||
|
||
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="signal" is-floating=false
|
||
match app-id="spotify" is-floating=false
|
||
match app-id="sublime_merge" 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="^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
|
||
|
||
shadow {
|
||
on
|
||
color "#0004"
|
||
softness 30
|
||
spread 0
|
||
offset x=0 y=0
|
||
}
|
||
}
|
||
'';
|
||
|
||
"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" ]; }
|
||
];
|
||
};
|
||
};
|
||
}
|