From 21b52a31e1eff5c8142f26e091fde083c21db55f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Jan 2025 11:30:32 +0100 Subject: niri --- accounts/gkleen@sif/default.nix | 309 +------------------------ accounts/gkleen@sif/hyprland.nix | 425 ----------------------------------- accounts/gkleen@sif/niri/default.nix | 139 ++++++++++++ accounts/gkleen@sif/niri/waybar.nix | 288 ++++++++++++++++++++++++ flake.lock | 186 ++++++++++++--- flake.nix | 18 +- hosts/sif/default.nix | 7 +- modules/niri.nix | 6 + overlays/matrix-synapse.nix | 4 - system-profiles/niri-flake.nix | 4 + 10 files changed, 615 insertions(+), 771 deletions(-) delete mode 100644 accounts/gkleen@sif/hyprland.nix create mode 100644 accounts/gkleen@sif/niri/default.nix create mode 100644 accounts/gkleen@sif/niri/waybar.nix create mode 100644 modules/niri.nix delete mode 100644 overlays/matrix-synapse.nix create mode 100644 system-profiles/niri-flake.nix diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 83dcf989..bcfd1224 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -92,6 +92,7 @@ in { home-manager.users.${userName} = { imports = [ ./libvirt + ./niri flakeInputs.nix-index-database.hmModules.nix-index flakeInputs.impermanence.nixosModules.home-manager.impermanence ]; @@ -250,287 +251,6 @@ in { "kitty_mod+m" = "detach_window ask"; }; }; - waybar = { - enable = true; - systemd = { - enable = true; - target = "hyprland-session.target"; - }; - settings = let - windowRewrites = { - "(.*) — Mozilla Firefox" = "$1"; - "(.*) - Mozilla Thunderbird" = "$1"; - "(.*) - mpv" = "$1"; - }; - iconSize = 11; - in [ - { - layer = "top"; - position = "top"; - height = 14; - output = [ "eDP-1" "DP-2" "DP-3" ]; - modules-left = [ "hyprland/workspaces" ]; - modules-center = [ "hyprland/window" ]; - modules-right = [ # "custom/worktime" "custom/worktime-today" - "custom/weather" "custom/keymap" "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "clock" ]; - - "custom/weather" = { - format = "{}"; - tooltip = true; - interval = 3600; - exec = "${lib.getExe pkgs.wttrbar} --hide-conditions --nerd --custom-indicator \"{ICON} {FeelsLikeC}°\""; - return-type = "json"; - }; - "custom/keymap" = { - format = "{}"; - tooltip = true; - return-type = "json"; - exec = pkgs.writers.writePython3 "keymap" {} '' - import os - import socket - import re - import subprocess - import json - - - def output(keymap): - short = keymap - if keymap == "English (programmer Dvorak)": - short = "dvp" - elif keymap == "English (US)": - short = "us" - print(json.dumps({'text': short, 'tooltip': keymap}, separators=(',', ':')), flush=True) # noqa: E501 - - - r = subprocess.run(["hyprctl", "devices", "-j"], check=True, stdout=subprocess.PIPE, text=True) # noqa: E501 - for keyboard in json.loads(r.stdout)['keyboards']: - if keyboard['name'] != "at-translated-set-2-keyboard": - continue - output(keyboard['active_keymap']) - - sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - sock.connect(os.environ["XDG_RUNTIME_DIR"] + "/hypr/" + os.environ["HYPRLAND_INSTANCE_SIGNATURE"] + "/.socket2.sock") # noqa: E501 - expected = re.compile(r'^activelayout>>at-translated-set-2-keyboard,(?P.+)$') # noqa: E501 - for line in sock.makefile(buffering=1, encoding='utf-8'): - if match := expected.match(line): - output(match.group("keymap")) - ''; - on-click = "hyprctl switchxkblayout at-translated-set-2-keyboard next"; - }; - "custom/worktime" = { - interval = 60; - exec = getExe pkgs.worktime; - tooltip = false; - }; - "custom/worktime-today" = { - interval = 60; - exec = "${getExe pkgs.worktime} today"; - tooltip = false; - }; - "hyprland/workspaces" = { - all-outputs = true; - }; - "hyprland/window" = { - separate-outputs = true; - icon = true; - icon-size = 14; - rewrite = windowRewrites; - }; - clock = { - interval = 1; - # timezone = "Europe/Berlin"; - format = "W{:%V-%u %F %H:%M:%S%Ez}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "year"; - mode-mon-col = 3; - weeks-pos = "left"; - on-scroll = 1; - format = { - months = "{}"; - days = "{}"; - weeks = "{}"; - weekdays = "{}"; - today = "{}"; - }; - }; - }; - battery = { - format = "{icon}"; - icon-size = iconSize - 2; - states = { warning = 30; critical = 15; }; - format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; - format-charging = "󰂄"; - format-plugged = "󰚥"; - tooltip-format = "{capacity}% {timeTo}"; - interval = 20; - }; - tray = { - icon-size = 16; - # show-passive-items = true; - spacing = 1; - }; - privacy = { - icon-spacing = 7; - icon-size = iconSize; - modules = [ - { type = "screenshare"; } - { type = "audio-in"; } - ]; - }; - idle_inhibitor = { - format = "{icon}"; - icon-size = iconSize; - format-icons = { activated = "󰈈"; deactivated = "󰈉"; }; - timeout = 120; - }; - backlight = { - format = "{icon}"; - icon-size = iconSize; - tooltip-format = "{percent}%"; - format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; - on-scroll-up = "lightctl -d -e4 -n1 up"; - on-scroll-down = "lightctl -d -e4 -n1 down"; - }; - wireplumber = { - format = "{icon}"; - icon-size = iconSize; - tooltip-format = "{volume}% {node_name}"; - format-icons = ["󰕿" "󰖀" "󰕾"]; - format-muted = "󰝟"; - # ignored-sinks = ["Easy Effects Sink"]; - on-scroll-up = "volumectl -d -u up"; - on-scroll-down = "volumectl -d -u down"; - on-click = "volumectl -d toggle-mute"; - }; - } - { - layer = "top"; - position = "top"; - height = 14; - output = [ "!eDP-1" "!DP-2" "!DP-3" ]; - modules-left = [ "hyprland/workspaces" ]; - modules-center = [ "hyprland/window" ]; - modules-right = [ "clock" ]; - - "hyprland/workspaces" = { - all-outputs = false; - }; - "hyprland/window" = { - separate-outputs = true; - icon = true; - icon-size = 14; - rewrite = windowRewrites; - }; - clock = { - interval = 1; - # timezone = "Europe/Berlin"; - format = "{:%H:%M}"; - tooltip-format = "W{:%V-%u %F %H:%M:%S%Ez}"; - }; - } - ]; - style = '' - @define-color white #ffffff; - @define-color grey #555555; - @define-color blue #1a8fff; - @define-color green #23fd00; - @define-color orange #f28a21; - @define-color red #f2201f; - - * { - border: none; - font-family: "Fira Sans Nerd Font"; - font-size: 10pt; - min-height: 0; - } - - window#waybar { - background-color: rgba(0, 0, 0, 0.66); - color: @white; - } - - .modules-left { - margin-left: 9px; - } - .modules-right { - margin-right: 9px; - } - - .module { - margin: 0 5px; - } - - #workspaces button { - color: @grey; - } - #workspaces button.hosting-monitor { - color: @white; - } - #workspaces button.visible { - color: @blue; - } - #workspaces button.active { - color: @green; - } - #workspaces button.urgent { - color: @red; - } - - #custom-weather, #custom-keymap, #custom-worktime, #custom-worktime-today { - color: @grey; - margin: 0 5px; - } - #custom-weather, #custom-worktime-today { - margin-right: 3px; - } - #custom-keymap, #custom-weather { - margin-left: 3px; - } - - #tray { - margin: 0; - } - #battery, #idle_inhibitor, #backlight, #wireplumber { - color: @grey; - margin: 0 5px 0 2px; - } - #idle_inhibitor { - margin-right: 2px; - margin-left: 3px; - } - #battery { - margin-right: 3px; - } - #battery.discharging { - color: @white; - } - #battery.warning { - color: @orange; - } - #battery.critical { - color: @red; - } - #battery.charging { - color: @white; - } - #idle_inhibitor.activated { - color: @white; - } - - #idle_inhibitor { - padding-top: 1px; - } - - #privacy { - color: @red; - margin: -1px 2px 0px 5px; - } - #clock { - /* margin-right: 5px; */ - } - ''; - }; wpaperd = { enable = true; settings.default = { @@ -543,7 +263,7 @@ in { enable = true; settings = { main = { - terminal = lib.getExe pkgs.kitty; + terminal = lib.getExe cfg.programs.kitty.package; layer = "overlay"; icon-theme = "Paper"; font = "Fira Sans"; @@ -639,13 +359,13 @@ in { enable = true; events = [ { event = "before-sleep"; command = lockCommand; } - { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } + # { event = "after-resume"; command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; } { event = "lock"; command = lockCommand; } ]; timeouts = [ - { timeout = 300; - command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; - } + # { timeout = 300; + # command = "${cfg.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; + # } { timeout = 330; command = lockCommand; } ]; extraArgs = [ @@ -927,23 +647,6 @@ in { color-scheme = "prefer-dark"; }; }; - - wayland.windowManager.hyprland = { - enable = true; - settings = import ./hyprland.nix inputs; - }; - - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - config = { - common.default = [ "gtk" ]; - hyprland.default = [ "gtk" "kde" "hyprland" ]; - }; - extraPortals = with pkgs; [ - xdg-desktop-portal-kde xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-desktop-portal-hyprland - ]; - }; }; }; } diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix deleted file mode 100644 index 90ae689a..00000000 --- a/accounts/gkleen@sif/hyprland.nix +++ /dev/null @@ -1,425 +0,0 @@ -{ pkgs, lib, config, userName, ... }: -let - cfg = config.home-manager.users.${userName}; -in { - monitor = [ - ",preferred,auto,auto,bitdepth,8" - "eDP-1,3840x2160@60,auto,1.5,bitdepth,8" - ]; - - "$terminal" = "kitty"; - "$menu" = "fuzzel"; - - env = [ - "NIXOS_OZONE_WL,1" - "QT_QPA_PLATFORM,wayland" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "GDK_BACKEND,wayland" - "GDK_SCALE,0.66" - "QT_AUTO_SCREEN_SCALE_FACTOR,1" - "SDL_VIDEODRIVER,wayland" - # "AQ_DRM_DEVICES,/dev/dri/by-path/pci-0000:01:00.0-card" - "__NV_PRIME_RENDER_OFFLOAD,1" - "__NV_PRIME_RENDER_OFFLOAD_PROVIDER,NVIDIA-G0" - "__GLX_VENDOR_LIBRARY_NAME,nvidia" - "__VK_LAYER_NV_optimus,NVIDIA_only" - ]; - - xwayland.force_zero_scaling = true; - - general = { - gaps_in = 3; - gaps_out = 9; - "col.active_border" = "rgba(33ccffee) rgba(00ff95ee) 45deg"; - "col.inactive_border" = "rgba(595959aa)"; - - resize_on_border = false; - - allow_tearing = false; - - layout = "dwindle"; - }; - - decoration = { - rounding = 5; - dim_special = 0.0; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - animation = [ - "windows, 1, 1, default, popin 80%" - "windowsMove, 0" - # "windows, 1, 7, myBezier" - # "windowsOut, 1, 7, myBezier, popin 80%" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 1, default" - "workspaces, 1, 1, default, fade" - # "workspaces, 1, 6, default" - ]; - }; - - dwindle = { - pseudotile = false; - preserve_split = true; - }; - - master = { - new_status = "master"; - }; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - # focus_on_activate = true; - mouse_move_enables_dpms = true; - key_press_enables_dpms = true; - new_window_takes_over_fullscreen = 1; - exit_window_retains_fullscreen = true; - }; - - cursor = { - use_cpu_buffer = true; - hide_on_key_press = true; - # no_hardware_cursors = 0; - }; - - input = { - kb_layout = "us,us"; - kb_variant = "dvp,"; - kb_model = ""; - kb_options = "compose:caps,grp:win_space_toggle"; - kb_rules = ""; - - follow_mouse = 1; - - sensitivity = 0; - - touchpad = { - natural_scroll = false; - }; - }; - - device = [ - { name = "synaptics-tm3512-010"; - sensitivity = 0.4; - } - { name = "tpps/2-elan-trackpoint"; - sensitivity = 0.2; - } - { name = "logitech-ergo-m575"; - sensitivity = 1.333; - } - ]; - - gestures = { - workspace_swipe = false; - }; - - dwindle = { - # no_gaps_when_only = 1; - }; - - "$mainMod" = "SUPER"; - - bind = [ - "$mainMod, return, exec, $terminal" - "$mainMod, Q, killactive" - "$mainMod SHIFT, Q, exec, hyprctl kill" - "$mainMod, V, togglefloating" - "$mainMod, D, exec, $menu" - "$mainMod SHIFT, D, exec, $menu --list-executables-in-path" - # "$mainMod, J, togglesplit," - - "$mainMod SHIFT, L, exec, loginctl lock-session" - "$mainMod SHIFT, E, exit" - - "$mainMod, left, movefocus, l" - "$mainMod, right, movefocus, r" - "$mainMod, up, movefocus, u" - "$mainMod, down, movefocus, d" - "$mainMod SHIFT, left, swapwindow, l" - "$mainMod SHIFT, right, swapwindow, r" - "$mainMod SHIFT, up, swapwindow, u" - "$mainMod SHIFT, down, swapwindow, d" - - "$mainMod, N, cyclenext, tiled" - "$mainMod, T, cyclenext, prev tiled" - "$mainMod SHIFT, N, swapnext" - "$mainMod SHIFT, T, swapnext, prev" - - "$mainMod, G, focusmonitor, 0" - "$mainMod, C, focusmonitor, 1" - "$mainMod, R, focusmonitor, 2" - "$mainMod, L, focusmonitor, 3" - - "$mainMod CTRL, G, movecurrentworkspacetomonitor, 0" - "$mainMod CTRL, C, movecurrentworkspacetomonitor, 1" - "$mainMod CTRL, R, movecurrentworkspacetomonitor, 2" - "$mainMod CTRL, L, movecurrentworkspacetomonitor, 3" - - "$mainMod, F, fullscreen, 1" - "$mainMod SHIFT, F, fullscreen, 0" - "$mainMod CTRL SHIFT, F, fullscreenstate, 1, 2" - - "$mainMod, code:14, workspace, 1" - "$mainMod, code:17, workspace, 2" - "$mainMod, code:13, workspace, 3" - "$mainMod, code:18, workspace, 4" - "$mainMod, code:12, workspace, 5" - "$mainMod, code:19, workspace, 6" - "$mainMod, code:11, workspace, 7" - "$mainMod, code:20, workspace, 8" - "$mainMod, code:15, workspace, 9" - "$mainMod, code:16, workspace, 10" - - "$mainMod SHIFT, code:14, movetoworkspacesilent, 1" - "$mainMod SHIFT, code:17, movetoworkspacesilent, 2" - "$mainMod SHIFT, code:13, movetoworkspacesilent, 3" - "$mainMod SHIFT, code:18, movetoworkspacesilent, 4" - "$mainMod SHIFT, code:12, movetoworkspacesilent, 5" - "$mainMod SHIFT, code:19, movetoworkspacesilent, 6" - "$mainMod SHIFT, code:11, movetoworkspacesilent, 7" - "$mainMod SHIFT, code:20, movetoworkspacesilent, 8" - "$mainMod SHIFT, code:15, movetoworkspacesilent, 9" - "$mainMod SHIFT, code:16, movetoworkspacesilent, 10" - - "$mainMod, semicolon, exec, dunstctl close" - "$mainMod SHIFT, semicolon, exec, dunstctl close-all" - "$mainMod, period, exec, dunstctl context" - "$mainMod, comma, exec, dunstctl history-pop" - - "$mainMod ALT, E, exec, emacsclient -c" - "$mainMod ALT, Y, exec, ${pkgs.writeShellScript "yt-dlp" '' - export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs socat ])}:$PATH" - socat STDIO UNIX-CONNECT:"$XDG_RUNTIME_DIR"/yt-dlp.sock <<<$'{ "urls": ["'"$(wl-paste)"$'"] }' - ''}" - "$mainMod ALT, L, exec, ${pkgs.writeShellScript "mpv" '' - export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs ])}:$PATH" - exec mpv "$(wl-paste)" - ''}" - - ", Print, exec, ${pkgs.writeShellScript "screenshot" '' - export PATH="${lib.makeBinPath (with pkgs; [ grim slurp wl-clipboard-rs coreutils ])}:$PATH" - - outFile="$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" - grim -g "$(slurp -b 00000080 -c FFFFFFFF -s 00000000 -w 1)" "$outFile" - wl-copy --type image/png <"$outFile" - ''}" - "SHIFT, Print, exec, ${pkgs.writeShellScript "screenshot" '' - export PATH="${lib.makeBinPath (with pkgs; [ grim jq wl-clipboard-rs coreutils ])}:$PATH" - - outFile="$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png" - grim -o "$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')" "$outFile" - wl-copy --type image/png <"$outFile" - ''}" - "CTRL SHIFT, Print, exec, ${pkgs.runCommand "picker" { - buildInputs = [ pkgs.makeWrapper ]; - } '' - makeWrapper ${lib.getExe pkgs.hyprpicker} $out \ - --prefix PATH : ${lib.makeBinPath [pkgs.wl-clipboard-rs]} - ''} -a" - "$mainMod, M, exec, ${pkgs.writeShellScript "qalc-fuzzel" '' - export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs libqalculate cfg.programs.fuzzel.package coreutils findutils libnotify gnugrep ])}:$PATH" - - RESULTS_DIR="$HOME/.cache/qalc-fuzzel" - prev() { - FOUND=false - while IFS= read -r line; do - [[ -n "$line" ]] || continue - FOUND=true - echo $line - done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat) - $FOUND || echo - } - FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $? - if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then - QALC_RES="$FUZZEL_RES" - QALC_RET=0 - else - QALC_RES=$(qalc "$FUZZEL_RES" 2>&1) - QALC_RET=$? - fi - [[ -n "$QALC_RES" ]] || exit 1 - EXISTING=false - fgrep -xrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch - [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true - if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then - RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' "$RES_FILE" <<<"$QALC_RES" - fi - [[ "$QALC_RES" =~ .*\ =\ (.*) ]] && QALC_RES="''${BASH_REMATCH[1]}" - [[ $QALC_RET -eq 0 ]] && wl-copy "$QALC_RES" - notify-send "$QALC_RES" - ''}" - "$mainMod, E, exec, ${pkgs.writeShellScript "emoji-fuzzel" '' - export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package wtype wl-clipboard-rs ])}:$PATH" - - FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <$HOME/.local/share/emoji-data/list.txt) || exit $? - [[ -n "$FUZZEL_RES" ]] || exit 1 - wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste - ''}" - "$mainMod, B, exec, ${pkgs.writeShellScript "bring" '' - export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package gawk gojq cfg.wayland.windowManager.hyprland.package ])}:$PATH" - - state="$(hyprctl -j clients)" - active_window="$(hyprctl -j activewindow)" - active_workspace="$(hyprctl -j activeworkspace | gojq -r '.id')" - - current_addr="$(echo "$active_window" | gojq -r '.address')" - - window="$(echo "$state" | - gojq -r '.[] | select(.workspace.id == '"$active_workspace"') | select(.monitor != -1 ) | "\(.title)\t\(.address)"' | - fuzzel --log-level=warning --dmenu)" - - addr="$(echo "$window" | awk -F $'\t' '{print $2}')" - - if [[ "$addr" = "$current_addr" ]]; then - exit 0 - fi - - fullscreen_on_same_ws="$(echo "$state" | gojq -r '.[] | select(.fullscreen == true) | select(.workspace.id == '"$active_workspace"') | .address')" - - if [[ "$window" != "" ]]; then - if [[ "$fullscreen_on_same_ws" == "" ]]; then - hyprctl dispatch focuswindow address:"''${addr}" - else - # If we want to focus app_A and app_B is fullscreen on the same workspace, - # app_A will get focus, but app_B will remain on top. - # This monstrosity is to make sure app_A will end up on top instead. - # XXX: doesn't handle fullscreen 0, but I don't care. - hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1; dispatch focuswindow address:''${addr}; dispatch fullscreen 1" - fi - fi - ''}" - "$mainMod SHIFT, B, exec, ${pkgs.writeShellScript "bring" '' - export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package gawk gojq cfg.wayland.windowManager.hyprland.package ])}:$PATH" - - state="$(hyprctl -j clients)" - active_window="$(hyprctl -j activewindow)" - - current_addr="$(echo "$active_window" | gojq -r '.address')" - - window="$(echo "$state" | - gojq -r '.[] | select(.monitor != -1 ) | "\(.title)\t\(.workspace.name)\t\(.address)"' | - fuzzel --log-level=warning --dmenu)" - - addr="$(echo "$window" | awk -F $'\t' '{print $3}')" - ws="$(echo "$window" | awk -F $'\t' '{print $2}')" - - if [[ "$addr" = "$current_addr" ]]; then - exit 0 - fi - - fullscreen_on_same_ws="$(echo "$state" | gojq -r ".[] | select(.fullscreen == true) | select(.workspace.name == \"$ws\") | .address")" - - if [[ "$window" != "" ]]; then - if [[ "$fullscreen_on_same_ws" == "" ]]; then - hyprctl dispatch focuswindow address:"''${addr}" - else - # If we want to focus app_A and app_B is fullscreen on the same workspace, - # app_A will get focus, but app_B will remain on top. - # This monstrosity is to make sure app_A will end up on top instead. - # XXX: doesn't handle fullscreen 0, but I don't care. - hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1; dispatch focuswindow address:''${addr}; dispatch fullscreen 1" - fi - fi - ''}" - - "$mainMod CTRL, return, togglespecialworkspace, term" - "$mainMod CTRL, e, togglespecialworkspace, edit" - "$mainMod CTRL, a, togglespecialworkspace, pwvucontrol" - "$mainMod CTRL, o, togglespecialworkspace, easyeffects" - "$mainMod CTRL, b, togglespecialworkspace, blueman" - "$mainMod CTRL, p, togglespecialworkspace, keepass" - ]; - bindm = [ - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" - ]; - bindel = [ - ", XF86MonBrightnessUp, exec, lightctl -d -e4 -n1 up" - ", XF86MonBrightnessDown, exec, lightctl -d -e4 -n1 down" - ", XF86AudioRaiseVolume, exec, volumectl -d -u up" - ", XF86AudioLowerVolume, exec, volumectl -d -u down" - ]; - bindl = [ - ", XF86AudioMute, exec, volumectl -d toggle-mute" - ", XF86AudioMicMute, exec, volumectl -d -m toggle-mute" - "$mainMod SHIFT, S, exec, systemctl suspend" - - ", switch:off:Lid Switch,exec,hyprctl dispatch dpms on eDP-1" - ", switch:on:Lid Switch,exec,hyprctl dispatch dpms off eDP-1" - - ", switch:off:Lid Switch,exec,${pkgs.writeShellScript "clamshell-off" '' - export PATH="${lib.makeBinPath (with pkgs; [ jq ])}:$PATH" - [[ $(hyprctl monitors -j | jq '.[] | select(.name == "eDP-1") | .disabled') = "true" ]] || exit 0 - - hyprctl keyword monitor "eDP-1,3840x2160@60,auto,1.5" - ''}" - ", switch:on:Lid Switch,exec,${pkgs.writeShellScript "clamshell-on" '' - export PATH="${lib.makeBinPath (with pkgs; [ jq ])}:$PATH" - - [[ $(hyprctl monitors -j | jq 'reduce (.[] | select(.disabled == false)) as $_ (0; .+1)') -gt 1 ]] || exit 0 - - hyprctl keyword monitor "eDP-1,disable" - ''}" - ]; - - windowrulev2 = [ - "suppressevent maximize fullscreen, class:.*" - - # "maximize, class:^(Element|thunderbird)$" - "workspace special:pwvucontrol, class:^com\.saivert\.pwvucontrol$" - "workspace special:easyeffects, class:^com\.github\.wwmm\.easyeffects$" - "workspace special:blueman, class:^\.blueman-manager-wrapped$" - "workspace special:keepass silent, class:^org\.keepassxc\.KeePassXC$, title:^(?!Unlock Database.*)(?!.*(Access Request|Passkey credentials)).*$" - # "group set always lock invade, class:^Element$" - "workspace 2, class:^firefox$" - "workspace 4, class:^evince$" - "workspace 4, class:^imv$" - "workspace 4, class:^org\.pwmt\.zathura$" - "workspace 10, class:^mpv$" - "workspace 1, class:^Element$" - "workspace 1, class:^thunderbird$" - "workspace 5, class:^virt-manager$" - "workspace 5, class:^qemu$" - "float, class:^org\.keepassxc\.KeePassXC$, title:^.*Access Request$" - "center, class:^org\.keepassxc\.KeePassXC$, title:^.*Access Request$" - "float, class:^org\.keepassxc\.KeePassXC$, title:^.*Passkey credentials$" - "center, class:^org\.keepassxc\.KeePassXC$, title:^.*Passkey credentials$" - "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database.*$" - "center, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database.*$" - "float, class:^xdg-desktop-portal-gtk$" - "center, class:^xdg-desktop-portal-gtk$" - - "bordercolor rgba(ffaa33ee) rgba(bfff00ee) 45deg, fullscreen:1" - "bordercolor rgba(3366ffee) rgba(6a00ffee) 45deg, xwayland:1" - "bordercolor rgba(6633ffee) rgba(ea00ffee) 45deg, xwayland:1, fullscreen:1" - ]; - - workspace = [ - "s[true], gapsout:100" - - "special:term, on-created-empty:kitty" - "special:edit, on-created-empty:emacsclient -c" - "special:pwvucontrol, on-created-empty:pwvucontrol" - "special:easyeffects, on-created-empty:easyeffects" - "special:blueman, on-created-empty:blueman-manager" - "special:keepass, on-created-empty:keepassxc" - - "1, defaultName:comm" - "2, defaultName:web" - "3, defaultName:work" - "4, defaultName:read" - ]; - - layerrule = [ - "blur, waybar" - "blur, launcher" - "noanim, notifications" - "blur, notifications" - ]; -} diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix new file mode 100644 index 00000000..6a8d10a0 --- /dev/null +++ b/accounts/gkleen@sif/niri/default.nix @@ -0,0 +1,139 @@ +{ config, pkgs, lib, ... }: +let + niri = config.programs.niri.package; + terminal = lib.getExe config.programs.kitty.package; + lightctl = lib.getExe' config.services.avizo.package "lightctl"; + volumectl = lib.getExe' config.services.avizo.package "volumectl"; + dunstctl = lib.getExe' config.services.dunst.package "dunstctl"; +in { + imports = [ + ./waybar.nix + ]; + + config = { + systemd.user.services.xwayland-satellite = { + Unit = { + BindsTo = [ "graphical-session.target" ]; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + Requisite = [ "graphical-session.target" ]; + }; + Service = { + Type = "notify"; + NotifyAccess = "all"; + ExecStart = lib.getExe pkgs.xwayland-satellite-unstable; + StandardOutput = "journal"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + }; + + programs.niri.settings = { + prefer-no-csd = true; + screenshot-path = "${config.home.homeDirectory}/screenshots"; + + input = { + keyboard.xkb = { + layout = "us,"; + variant = "dvp,"; + options = "compose:caps,grp:win_space_toggle"; + }; + }; + + environment = { + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland"; + GDK_BACKEND = "wayland"; + SDL_VIDEODRIVER = "wayland"; + }; + + cursor.hide-when-typing = true; + + binds = with config.lib.niri.actions; { + "Mod+Return".action = spawn terminal; + "Mod+Q".action = close-window; + "Mod+D".action = spawn (lib.getExe config.programs.fuzzel.package); + "Mod+Shift+D".action = spawn (lib.getExe config.programs.fuzzel.package) "--list-executables-in-path"; + + "Mod+H".action = focus-column-left; + "Mod+T".action = focus-window-down; + "Mod+N".action = focus-window-up; + "Mod+S".action = focus-column-right; + + "Mod+Shift+H".action = move-column-left; + "Mod+Shift+T".action = move-window-down; + "Mod+Shift+N".action = move-window-up; + "Mod+Shift+S".action = move-column-right; + + "Mod+Control+H".action = focus-monitor-left; + "Mod+Control+T".action = focus-monitor-down; + "Mod+Control+N".action = focus-monitor-up; + "Mod+Control+S".action = focus-monitor-right; + + "Mod+Shift+Control+H".action = move-workspace-to-monitor-left; + "Mod+Shift+Control+T".action = move-workspace-to-monitor-down; + "Mod+Shift+Control+N".action = move-workspace-to-monitor-up; + "Mod+Shift+Control+S".action = move-workspace-to-monitor-right; + + "Mod+G".action = focus-workspace-down; + "Mod+C".action = focus-workspace-up; + + "Mod+Control+G".action = move-column-to-workspace-down; + "Mod+Control+C".action = move-column-to-workspace-up; + + "Mod+Shift+G".action = move-workspace-down; + "Mod+Shift+C".action = move-workspace-up; + + "Mod+M".action = consume-window-into-column; + "Mod+W".action = expel-window-from-column; + + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + + "Mod+Space".action = switch-focus-between-floating-and-tiling; + "Mod+Shift+Space".action = toggle-window-floating; + + "Mod+Left".action = set-column-width "-10%"; + "Mod+Down".action = set-window-height "-10%"; + "Mod+Up".action = set-window-height "+10%"; + "Mod+Right".action = set-column-width "+10%"; + + "Mod+Shift+Z" = { + action = spawn (lib.getExe niri) "msg" "action" "power-off-monitors"; + allow-when-locked = true; + }; + + "XF86MonBrightnessUp" = { + action = spawn lightctl "-d" "-e4" "-n1" "up"; + allow-when-locked = true; + }; + "XF86MonBrightnessDown" = { + action = spawn lightctl "-d" "-e4" "-n1" "down"; + allow-when-locked = true; + }; + "XF86AudioRaiseVolume" = { + action = spawn volumectl "-d" "-u" "up"; + allow-when-locked = true; + }; + "XF86AudioLowerVolume" = { + action = spawn volumectl "-d" "-u" "down"; + allow-when-locked = true; + }; + "XF86AudioMute" = { + action = spawn volumectl "-d" "toggle-mute"; + allow-when-locked = true; + }; + "XF86AudioMicMute" = { + action = spawn volumectl "-d" "-m" "toggle-mute"; + allow-when-locked = true; + }; + + "Mod+Semicolon".action = spawn dunstctl "close"; + "Mod+Shift+Semicolon".action = spawn dunstctl "close-all"; + "Mod+Period".action = spawn dunstctl "context"; + "Mod+Comma".action = spawn dunstctl "history-pop"; + }; + }; + }; +} diff --git a/accounts/gkleen@sif/niri/waybar.nix b/accounts/gkleen@sif/niri/waybar.nix new file mode 100644 index 00000000..1a25b581 --- /dev/null +++ b/accounts/gkleen@sif/niri/waybar.nix @@ -0,0 +1,288 @@ +{ lib, pkgs, ... }: +{ + config = { + programs.waybar = { + enable = true; + systemd = { + enable = true; + target = "graphical-session.target"; + }; + settings = let + windowRewrites = { + "(.*) — Mozilla Firefox" = "$1"; + "(.*) - Mozilla Thunderbird" = "$1"; + "(.*) - mpv" = "$1"; + }; + iconSize = 11; + in [ + { + layer = "top"; + position = "top"; + height = 14; + output = [ "eDP-1" "DP-2" "DP-3" ]; + modules-left = [ "niri/workspaces" ]; + modules-center = [ "niri/window" ]; + modules-right = [ # "custom/worktime" "custom/worktime-today" + "custom/weather" + # "custom/keymap" + "privacy" "tray" "wireplumber" "backlight" "battery" "idle_inhibitor" "clock" ]; + + "custom/weather" = { + format = "{}"; + tooltip = true; + interval = 3600; + exec = "${lib.getExe pkgs.wttrbar} --hide-conditions --nerd --custom-indicator \"{ICON} {FeelsLikeC}°\""; + return-type = "json"; + }; + "custom/keymap" = { + format = "{}"; + tooltip = true; + return-type = "json"; + exec = pkgs.writers.writePython3 "keymap" {} '' + import os + import socket + import re + import subprocess + import json + + + def output(keymap): + short = keymap + if keymap == "English (programmer Dvorak)": + short = "dvp" + elif keymap == "English (US)": + short = "us" + print(json.dumps({'text': short, 'tooltip': keymap}, separators=(',', ':')), flush=True) # noqa: E501 + + + r = subprocess.run(["hyprctl", "devices", "-j"], check=True, stdout=subprocess.PIPE, text=True) # noqa: E501 + for keyboard in json.loads(r.stdout)['keyboards']: + if keyboard['name'] != "at-translated-set-2-keyboard": + continue + output(keyboard['active_keymap']) + + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sock.connect(os.environ["XDG_RUNTIME_DIR"] + "/hypr/" + os.environ["HYPRLAND_INSTANCE_SIGNATURE"] + "/.socket2.sock") # noqa: E501 + expected = re.compile(r'^activelayout>>at-translated-set-2-keyboard,(?P.+)$') # noqa: E501 + for line in sock.makefile(buffering=1, encoding='utf-8'): + if match := expected.match(line): + output(match.group("keymap")) + ''; + on-click = "hyprctl switchxkblayout at-translated-set-2-keyboard next"; + }; + "custom/worktime" = { + interval = 60; + exec = lib.getExe pkgs.worktime; + tooltip = false; + }; + "custom/worktime-today" = { + interval = 60; + exec = "${lib.getExe pkgs.worktime} today"; + tooltip = false; + }; + "niri/workspaces" = { + all-outputs = true; + }; + "niri/window" = { + separate-outputs = true; + icon = true; + icon-size = 14; + rewrite = windowRewrites; + }; + clock = { + interval = 1; + # timezone = "Europe/Berlin"; + format = "W{:%V-%u %F %H:%M:%S%Ez}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "year"; + mode-mon-col = 3; + weeks-pos = "left"; + on-scroll = 1; + format = { + months = "{}"; + days = "{}"; + weeks = "{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + }; + battery = { + format = "{icon}"; + icon-size = iconSize - 2; + states = { warning = 30; critical = 15; }; + format-icons = ["󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; + format-charging = "󰂄"; + format-plugged = "󰚥"; + tooltip-format = "{capacity}% {timeTo}"; + interval = 20; + }; + tray = { + icon-size = 16; + # show-passive-items = true; + spacing = 1; + }; + privacy = { + icon-spacing = 7; + icon-size = iconSize; + modules = [ + { type = "screenshare"; } + { type = "audio-in"; } + ]; + }; + idle_inhibitor = { + format = "{icon}"; + icon-size = iconSize; + format-icons = { activated = "󰈈"; deactivated = "󰈉"; }; + timeout = 120; + }; + backlight = { + format = "{icon}"; + icon-size = iconSize; + tooltip-format = "{percent}%"; + format-icons = ["󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠"]; + on-scroll-up = "lightctl -d -e4 -n1 up"; + on-scroll-down = "lightctl -d -e4 -n1 down"; + }; + wireplumber = { + format = "{icon}"; + icon-size = iconSize; + tooltip-format = "{volume}% {node_name}"; + format-icons = ["󰕿" "󰖀" "󰕾"]; + format-muted = "󰝟"; + # ignored-sinks = ["Easy Effects Sink"]; + on-scroll-up = "volumectl -d -u up"; + on-scroll-down = "volumectl -d -u down"; + on-click = "volumectl -d toggle-mute"; + }; + } + { + layer = "top"; + position = "top"; + height = 14; + output = [ "!eDP-1" "!DP-2" "!DP-3" ]; + modules-left = [ "niri/workspaces" ]; + modules-center = [ "niri/window" ]; + modules-right = [ "clock" ]; + + "niri/workspaces" = { + all-outputs = false; + }; + "niri/window" = { + separate-outputs = true; + icon = true; + icon-size = 14; + rewrite = windowRewrites; + }; + clock = { + interval = 1; + # timezone = "Europe/Berlin"; + format = "{:%H:%M}"; + tooltip-format = "W{:%V-%u %F %H:%M:%S%Ez}"; + }; + } + ]; + style = '' + @define-color white #ffffff; + @define-color grey #555555; + @define-color blue #1a8fff; + @define-color green #23fd00; + @define-color orange #f28a21; + @define-color red #f2201f; + + * { + border: none; + font-family: "Fira Sans Nerd Font"; + font-size: 10pt; + min-height: 0; + } + + window#waybar { + background-color: rgba(0, 0, 0, 0.66); + color: @white; + } + + .modules-left { + margin-left: 9px; + } + .modules-right { + margin-right: 9px; + } + + .module { + margin: 0 5px; + } + + #workspaces button { + color: @grey; + } + #workspaces button.hosting-monitor { + color: @white; + } + #workspaces button.visible { + color: @blue; + } + #workspaces button.active { + color: @green; + } + #workspaces button.urgent { + color: @red; + } + + #custom-weather, #custom-keymap, #custom-worktime, #custom-worktime-today { + color: @grey; + margin: 0 5px; + } + #custom-weather, #custom-worktime-today { + margin-right: 3px; + } + #custom-keymap, #custom-weather { + margin-left: 3px; + } + + #tray { + margin: 0; + } + #battery, #idle_inhibitor, #backlight, #wireplumber { + color: @grey; + margin: 0 5px 0 2px; + } + #idle_inhibitor { + margin-right: 2px; + margin-left: 3px; + } + #battery { + margin-right: 3px; + } + #battery.discharging { + color: @white; + } + #battery.warning { + color: @orange; + } + #battery.critical { + color: @red; + } + #battery.charging { + color: @white; + } + #idle_inhibitor.activated { + color: @white; + } + + #idle_inhibitor { + padding-top: 1px; + } + + #privacy { + color: @red; + margin: -1px 2px 0px 5px; + } + #clock { + /* margin-right: 5px; */ + } + ''; + }; + }; +} diff --git a/flake.lock b/flake.lock index f379dac0..ac52bba4 100644 --- a/flake.lock +++ b/flake.lock @@ -359,11 +359,11 @@ }, "impermanence": { "locked": { - "lastModified": 1734945620, - "narHash": "sha256-olIfsfJK4/GFmPH8mXMmBDAkzVQ1TWJmeGT3wBGfQPY=", + "lastModified": 1736688610, + "narHash": "sha256-1Zl9xahw399UiZSJ9Vxs1W4WRFjO1SsNdVZQD4nghz0=", "owner": "nix-community", "repo": "impermanence", - "rev": "d000479f4f41390ff7cf9204979660ad5dd16176", + "rev": "c64bed13b562fc3bb454b48773d4155023ac31b7", "type": "github" }, "original": { @@ -385,6 +385,63 @@ "url": "https://data.iana.org/time-zones/tzdb/leap-seconds.list" } }, + "niri-flake": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable_2", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1736840959, + "narHash": "sha256-po6B6ZkwtYI1BNIm5BR+JZ0HHKKNAnB+Dlr6BXCat3U=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "d775188e23f94b2f73e939414b808fc2b9ebad73", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "ref": "main", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1736614405, + "narHash": "sha256-AJ1rlgNOPb3/+DbS5hkhm21t6Oz8IgqLllwmZt0lyzk=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "e05bc269e678ecf828b96ae79c991c13b00b38a5", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.01", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1736836910, + "narHash": "sha256-jpyL3/lVeqbcXVOHoSPgXgIbJ9vZtiCDMSvZL0UyCgQ=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "36076d5279f349a32814dea91ca8f4dee61d5b08", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -413,11 +470,11 @@ ] }, "locked": { - "lastModified": 1735443188, - "narHash": "sha256-AydPpRBh8+NOkrLylG7vTsHrGO2b5L7XkMEL5HlzcA8=", + "lastModified": 1736652904, + "narHash": "sha256-8uolHABgroXqzs03QdulHp8H9e5kWQZnnhcda1MKbBM=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "55ab1e1df5daf2476e6b826b69a82862dcbd7544", + "rev": "271e5bd7c57e1f001693799518b10a02d1123b12", "type": "github" }, "original": { @@ -434,11 +491,11 @@ ] }, "locked": { - "lastModified": 1735412232, - "narHash": "sha256-W9wRlNvQLfV21359gTr3DglRBA6Q7NPUSU4RzgAAGsk=", + "lastModified": 1736736253, + "narHash": "sha256-GrktftEfXmmdKOU0yz3QXckDz1ncZ+f4KLU8XnYKYuA=", "owner": "AshleyYakeley", "repo": "NixVirt", - "rev": "55367360c00bd304042e5ad90841fd399330b77a", + "rev": "9063243af5e6674359a0ff7cec57f02eeacf0cea", "type": "github" }, "original": { @@ -449,11 +506,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1735388221, - "narHash": "sha256-e5IOgjQf0SZcFCEV/gMGrsI0gCJyqOKShBQU0iiM3Kg=", + "lastModified": 1736441705, + "narHash": "sha256-OL7leZ6KBhcDF3nEKe4aZVfIm6xQpb1Kb+mxySIP93o=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "7c674c6734f61157e321db595dbfcd8523e04e19", + "rev": "8870dcaff63dfc6647fb10648b827e9d40b0a337", "type": "github" }, "original": { @@ -570,6 +627,22 @@ } }, "nixpkgs-stable_2": { + "locked": { + "lastModified": 1736684107, + "narHash": "sha256-vH5mXxEvZeoGNkqKoCluhTGfoeXCZ1seYhC2pbMN0sg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "635e887b48521e912a516625eee7df6cf0eba9c1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_3": { "locked": { "lastModified": 1717179513, "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", @@ -585,7 +658,7 @@ "type": "github" } }, - "nixpkgs-stable_3": { + "nixpkgs-stable_4": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", @@ -603,21 +676,37 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1736167739, - "narHash": "sha256-IWir2Srf07xHsdf9WnLtaqPgL+CfS6tiZ9N/I+qbneE=", - "owner": "gkleen", + "lastModified": 1736701207, + "narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "a89c52fb11e656bbef04452a29eb0cd6cb6272c0", + "rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6", "type": "github" }, "original": { - "owner": "gkleen", - "ref": "fix/matrix-synapse", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_3": { + "locked": { + "lastModified": 1736798957, + "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9abb87b552b7f55ac8916b6fc9e5cb486656a2f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1681303793, "narHash": "sha256-JEdQHsYuCfRL2PICHlOiH/2ue3DwoxUX7DJ6zZxZXFk=", @@ -673,11 +762,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1735852239, - "narHash": "sha256-Xrg/HahR9SW1UzT5pwtpQR6D12ZIwwHjxav9YzB1q4U=", + "lastModified": 1736774291, + "narHash": "sha256-1rEUm7R93L8rltgyBzon2/lzIN2udC/Kd8nyvuDN6ps=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "bb182fd661f5f8a7d6c50dd44cf9a6ddca7ccc1a", + "rev": "499221030113adc5dea05886a1d7aa1cc3a315d1", "type": "github" }, "original": { @@ -740,8 +829,8 @@ "flake-compat": "flake-compat_4", "flake-utils": "flake-utils_2", "gitignore": "gitignore_3", - "nixpkgs": "nixpkgs_3", - "nixpkgs-stable": "nixpkgs-stable_3" + "nixpkgs": "nixpkgs_4", + "nixpkgs-stable": "nixpkgs-stable_4" }, "locked": { "lastModified": 1685361114, @@ -794,13 +883,14 @@ "home-manager": "home-manager", "home-manager-eostre": "home-manager-eostre", "impermanence": "impermanence", + "niri-flake": "niri-flake", "nix-index-database": "nix-index-database", "nixVirt": "nixVirt", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-eostre": "nixpkgs-eostre", "nixpkgs-pgbackrest": "nixpkgs-pgbackrest", - "nixpkgs-stable": "nixpkgs-stable_2", + "nixpkgs-stable": "nixpkgs-stable_3", "nvfetcher": "nvfetcher", "poetry2nix": "poetry2nix", "prometheus-borg-exporter": "prometheus-borg-exporter", @@ -815,11 +905,11 @@ ] }, "locked": { - "lastModified": 1735844895, - "narHash": "sha256-CIRlqX9tBK2awJkmVu2cKuap/0QziDXStQZ/u/+e8Z4=", + "lastModified": 1736808430, + "narHash": "sha256-wlgdf/n7bJMLBheqt1jmPoxJFrUP6FByKQFXuM9YvIk=", "owner": "Mic92", "repo": "sops-nix", - "rev": "24d89184adf76d7ccc99e659dc5f3838efb5ee32", + "rev": "553c7cb22fed19fd60eb310423fdc93045c51ba8", "type": "github" }, "original": { @@ -854,8 +944,9 @@ "type": "github" }, "original": { - "id": "systems", - "type": "indirect" + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "treefmt-nix": { @@ -902,6 +993,39 @@ "repo": "Waybar", "type": "github" } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1730166465, + "narHash": "sha256-nq7bouXQXaaPPo/E+Jbq+wNHnatD4dY8OxSrRqzvy6s=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "a713cf46cb7db84a0d1b57c3a397c610cad3cf98", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.5", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1736487362, + "narHash": "sha256-4kGoOA7FgK9N2mzS+TFEn41kUUNY6KwdiA/0rqlr868=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "8f55e27f63a749881c4bbfbb6b1da028342a91d1", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index c6eaab47..816fd499 100644 --- a/flake.nix +++ b/flake.nix @@ -4,20 +4,20 @@ nixConfig = { extra-substituters = [ "https://nix-community.cachix.org" + "https://niri.cachix.org" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" ]; }; inputs = { nixpkgs = { type = "github"; - # owner = "NixOS"; + owner = "NixOS"; repo = "nixpkgs"; - # ref = "nixos-unstable"; - owner = "gkleen"; - ref = "fix/matrix-synapse"; + ref = "nixos-unstable"; }; nixpkgs-pgbackrest = { type = "github"; @@ -184,9 +184,15 @@ repo = "NixVirt"; inputs.nixpkgs.follows = "nixpkgs"; }; + niri-flake = { + type = "github"; + owner = "sodiboo"; + repo = "niri-flake"; + ref = "main"; + }; }; - outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, ... }@inputs: + outputs = { self, nixpkgs, home-manager, sops-nix, deploy-rs, nvfetcher, niri-flake, ... }@inputs: let inherit (builtins) attrNames attrValues elemAt toJSON isNull pathExists; inherit (nixpkgs) lib; @@ -324,7 +330,7 @@ nixosConfigurations = installerNixosConfigurations // nixImport rec { dir = ./hosts; _import = mkNixosConfiguration [] dir; }; homeModules = nixImport rec { dir = ./home-modules; }; - homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); + homeConfigurations = listToAttrs (concatLists (mapAttrsToList (hostname: nixosConfig: mapAttrsToList (username: configuration: nameValuePair "${username}@${hostname}" { inherit (configuration.home) activationPackage; inherit (configuration) home-files; }) nixosConfig.config.home-manager.users) self.nixosConfigurations)); overlays = mapAttrs (_name: path: mkOverlay path) overlayPaths; diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index 088e1022..09d43109 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix @@ -27,6 +27,9 @@ in { allowUnfree = true; pulseaudio = true; }; + extraOverlays = [ + flakeInputs.niri-flake.overlays.niri + ]; }; time.timeZone = null; @@ -496,14 +499,14 @@ in { GTK.application_prefer_dark_theme = true; }; }; - programs.hyprland.enable = true; + programs.niri.enable = true; systemd.tmpfiles.settings = { "10-localtime"."/etc/localtime".L.argument = "/.bcachefs/etc/localtime"; "10-regreet"."/var/cache/regreet/cache.toml".C.argument = toString ((pkgs.formats.toml {}).generate "cache.toml" { last_user = "gkleen"; - user_to_last_sess.gkleen = "Hyprland"; + user_to_last_sess.gkleen = "niri"; }); }; diff --git a/modules/niri.nix b/modules/niri.nix new file mode 100644 index 00000000..4e2ddf8b --- /dev/null +++ b/modules/niri.nix @@ -0,0 +1,6 @@ +{ flakeInputs, ... }: +{ + imports = [ + flakeInputs.niri-flake.nixosModules.niri + ]; +} diff --git a/overlays/matrix-synapse.nix b/overlays/matrix-synapse.nix deleted file mode 100644 index 59b2c6da..00000000 --- a/overlays/matrix-synapse.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ final, prev, ... }: -{ - matrix-synapse-unwrapped = prev.matrix-synapse-unwrapped.overridePythonAttrs { doCheck = false; }; -} diff --git a/system-profiles/niri-flake.nix b/system-profiles/niri-flake.nix new file mode 100644 index 00000000..b28d51ff --- /dev/null +++ b/system-profiles/niri-flake.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + config.niri-flake.cache.enable = false; +} -- cgit v1.2.3