diff --git a/home/modules/anyrun/default.nix b/home/modules/anyrun/default.nix index 4c65a34..f2f572e 100644 --- a/home/modules/anyrun/default.nix +++ b/home/modules/anyrun/default.nix @@ -1,7 +1,4 @@ -{ - self, - ... -} @inputs: { pkgs, ...}: { +{self, ...} @ inputs: {pkgs, ...}: { imports = [ inputs.anyrun.homeManagerModules.default ]; diff --git a/home/modules/swappy.nix b/home/modules/swappy.nix index afeef69..b2d3f40 100644 --- a/home/modules/swappy.nix +++ b/home/modules/swappy.nix @@ -1,7 +1,4 @@ -{ - self, - ... -}: { +{self, ...}: { config, pkgs, lib, diff --git a/home/modules/wayland/eww/default.nix b/home/modules/wayland/eww/default.nix index 7fcacbf..5c40a37 100644 --- a/home/modules/wayland/eww/default.nix +++ b/home/modules/wayland/eww/default.nix @@ -1,4 +1,4 @@ -{self, ...} @inputs: { +{self, ...} @ inputs: { inputs, pkgs, config, @@ -17,58 +17,58 @@ }; config = lib.mkIf config.programs.eww.enable { - home.packages = with pkgs; [ - (inputs.eww.packages.${pkgs.system}.eww-wayland.overrideAttrs (old: { - nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.wrapGAppsHook]; - buildInputs = old.buildInputs ++ (with pkgs; [glib librsvg libdbusmenu-gtk3]); - })) - ]; + home.packages = with pkgs; [ + (inputs.eww.packages.${pkgs.system}.eww-wayland.overrideAttrs (old: { + nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.wrapGAppsHook]; + buildInputs = old.buildInputs ++ (with pkgs; [glib librsvg libdbusmenu-gtk3]); + })) + ]; - xdg.configFile = let - colorScheme = config.colors.colorScheme.colors; - files = builtins.readDir ./config; - splitList = let - splitList = n: list: - if lib.length list == 0 - then [] - else let - chunk = lib.sublist 0 n list; - rest = splitList n (lib.drop n list); - in - [chunk] ++ rest; - in - splitList; + xdg.configFile = let + colorScheme = config.colors.colorScheme.colors; + files = builtins.readDir ./config; + splitList = let + splitList = n: list: + if lib.length list == 0 + then [] + else let + chunk = lib.sublist 0 n list; + rest = splitList n (lib.drop n list); + in + [chunk] ++ rest; in - lib.concatMapAttrs (name: _: { - "eww/${name}" = { - source = pkgs.substituteAll ({ - src = ./config/${name}; - inherit (config.colors) backgroundAlpha; - pamixer = lib.getExe pkgs.pamixer; - pactl = "${pkgs.pulseaudio}/bin/pactl"; - jaq = lib.getExe pkgs.jaq; - socat = lib.getExe pkgs.socat; - curl = lib.getExe pkgs.curl; - speakerSink = builtins.toJSON config.programs.eww.speakerSink; - micName = builtins.toJSON config.programs.eww.micName; - fish = lib.getExe pkgs.fish; - pidof = "${pkgs.procps}/bin/pidof"; - xargs = "${pkgs.findutils}/bin/xargs"; - idleInhibit = "${pkgs.wlroots.examples}/bin/wlroots-idle-inhibit"; - # done twice so that it's a string - hyprbinds = builtins.toJSON (builtins.toJSON (splitList 5 (builtins.map (b: { - bind = - if (lib.hasPrefix ", " b.bind) - then (builtins.substring 2 ((builtins.stringLength b.bind) - 2) b.bind) - else b.bind; - keybind = builtins.replaceStrings [", "] [" + "] b.bind; - label = b.comment; - }) (builtins.filter (b: b.comment != null) config.display.binds)))); - } - // colorScheme); - executable = true; - }; - }) - files; + splitList; + in + lib.concatMapAttrs (name: _: { + "eww/${name}" = { + source = pkgs.substituteAll ({ + src = ./config/${name}; + inherit (config.colors) backgroundAlpha; + pamixer = lib.getExe pkgs.pamixer; + pactl = "${pkgs.pulseaudio}/bin/pactl"; + jaq = lib.getExe pkgs.jaq; + socat = lib.getExe pkgs.socat; + curl = lib.getExe pkgs.curl; + speakerSink = builtins.toJSON config.programs.eww.speakerSink; + micName = builtins.toJSON config.programs.eww.micName; + fish = lib.getExe pkgs.fish; + pidof = "${pkgs.procps}/bin/pidof"; + xargs = "${pkgs.findutils}/bin/xargs"; + idleInhibit = "${pkgs.wlroots.examples}/bin/wlroots-idle-inhibit"; + # done twice so that it's a string + hyprbinds = builtins.toJSON (builtins.toJSON (splitList 5 (builtins.map (b: { + bind = + if (lib.hasPrefix ", " b.bind) + then (builtins.substring 2 ((builtins.stringLength b.bind) - 2) b.bind) + else b.bind; + keybind = builtins.replaceStrings [", "] [" + "] b.bind; + label = b.comment; + }) (builtins.filter (b: b.comment != null) config.display.binds)))); + } + // colorScheme); + executable = true; + }; + }) + files; }; } diff --git a/home/modules/wayland/hyprland.nix b/home/modules/wayland/hyprland.nix index 035439e..3f3431a 100644 --- a/home/modules/wayland/hyprland.nix +++ b/home/modules/wayland/hyprland.nix @@ -1,10 +1,9 @@ -{self, ... } @ inputs: { +{self, ...} @ inputs: { config, pkgs, lib, ... }: let - inherit inputs; cfg = config.display; @@ -126,6 +125,12 @@ in { }; }; + cursor = { + package = pkgs.catppuccin-cursors.macchiatoPink; + name = "Catppuccin-Macchiato-Pink-Cursors"; + size = 24; + }; + config = mkIf cfg.enable { os = { programs.hyprland = { @@ -135,287 +140,279 @@ in { xdg.portal.wlr.enable = lib.mkForce false; }; - home = let - cursor = { - package = pkgs.catppuccin-cursors.macchiatoPink; - name = "Catppuccin-Macchiato-Pink-Cursors"; - size = 24; - }; - in { - packages = with pkgs; - with inputs.hyprcontrib.packages.${pkgs.system}; - with inputs.shadower.packages.${pkgs.system}; [ - pulseaudio - - wl-clipboard - - hyprpaper - - (wlsunset.overrideAttrs (old: { - src = fetchFromSourcehut { - owner = "~kennylevinsen"; - repo = old.pname; - rev = "81cfb0b4f8e44db9e5ecb36222a24d53a953e6aa"; - sha256 = "sha256-Lxuhsk4/5EHuKPkBbaRtCCQ/LFvIxyc+VQYEoaVT484="; - }; - })) - - hyprpicker - grimblast - - swayidle - - jaq - shadower - - (writeShellScriptBin - "pauseshot" - '' - ${hyprpicker}/bin/hyprpicker -r -z & - picker_proc=$! - - ${grimblast}/bin/grimblast save area - - - kill $picker_proc - '') - ]; - - home.pointerCursor = { - gtk.enable = true; - inherit (cursor) size name package; - x11 = { - defaultCursor = cursor.name; - enable = true; - }; - }; - - xdg.configFile."hypr/hyprpaper.conf".text = '' - preload=${cfg.monitors.main.wallpaper} - ${ - if cfg.monitors.secondary.wallpaper != null - then "preload=${cfg.monitors.secondary.wallpaper}" - else "" - } - - wallpaper = ${cfg.monitors.main.name},${cfg.monitors.main.wallpaper} - ${ - if (cfg.monitors.secondary.name != null && cfg.monitors.secondary.wallpaper != null) - then "wallpaper = ${cfg.monitors.secondary.name},${cfg.monitors.secondary.wallpaper}" - else "" - } - ''; - - wayland.windowManager.hyprland = { - enable = true; + home.packages = with pkgs; + with inputs.hyprcontrib.packages.${pkgs.system}; + with inputs.shadower.packages.${pkgs.system}; [ + pulseaudio - inherit (cfg) package; + wl-clipboard - settings = let - lockSequence = "physlock -ldms && gtklock && physlock -Ld"; - in - lib.mkMerge ([ - { - exec-once = - [ - "dbus-update-activation-environment --systemd --all" - "hyprctl setcursor ${cursor.name} ${toString cursor.size}" - "${lib.getExe pkgs.hyprpaper} & ${pkgs.playerctl}/bin/playerctld & mako" - - "firefox &" - # "schildichat-desktop & webcord &" - # "${lib.getExe pkgs.caprine-bin} &" - - # "${lib.getExe inputs.arrpc.packages.${pkgs.system}.arrpc} &" - - "wlsunset -l 52.2 -L 21 &" - - ''swayidle timeout 300 '${lockSequence}' timeout 360 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 420 'test $(${pkgs.sysstat}/bin/mpstat -o JSON 1 1 | ${lib.getExe pkgs.jaq} -r ".sysstat.hosts[0].statistics[0]["cpu-load"][0].usr | floor") -lt 80 && systemctl suspend' '' - - "systemctl --user restart xdg-desktop-portal xdg-desktop-portal-hyprland" - ] - ++ ["eww daemon && eww open bar && eww open yubikey-state"]; - - monitor = - [ - "${cfg.monitors.main.name},${toString cfg.monitors.main.width}x${toString cfg.monitors.main.height}@144,0x0,1" - "${cfg.monitors.main.name},addreserved,40,0,0,0" - ] - ++ (lib.optionals (cfg.monitors.secondary.name != null) ["monitor=${cfg.monitors.secondary.name},${toString cfg.monitors.secondary.width}x${toString cfg.monitors.secondary.height}@60,2560x0,1"]); - - workspace = - (builtins.map (n: "${toString n},monitor:${cfg.monitors.main.name}") (lib.range 1 10)) - ++ (lib.optionals (cfg.monitors.secondary.name != null) ((builtins.map (n: "${toString n},monitor:${cfg.monitors.secondary.name}") (lib.range 11 20)) ++ ["19,monitor:${cfg.monitors.secondary.name}, default:true, gapsin:0, gapsout:0, bordersize:0, rounding:false"])) - ++ [ - "1,monitor:${cfg.monitors.main.name}, default:true, gapsin:0, gapsout:0, bordersize:1, rounding:false" - "2,monitor:${cfg.monitors.main.name}, default:true" - ]; - input = { - kb_options = "caps:escape"; - - # Mouse speed - accel_profile = "flat"; - sensitivity = toString cfg.mouseSensitivity; - follow_mouse = true; - - touchpad = { - disable_while_typing = false; - drag_lock = true; - clickfinger_behavior = true; - }; - }; + hyprpaper - "device:glorious-model-o-wireless" = { - sensitivity = -0.76; - }; + (wlsunset.overrideAttrs (old: { + src = fetchFromSourcehut { + owner = "~kennylevinsen"; + repo = old.pname; + rev = "81cfb0b4f8e44db9e5ecb36222a24d53a953e6aa"; + sha256 = "sha256-Lxuhsk4/5EHuKPkBbaRtCCQ/LFvIxyc+VQYEoaVT484="; + }; + })) - gestures = { - workspace_swipe = true; - }; + hyprpicker + grimblast - misc = { - disable_hyprland_logo = true; - vfr = true; - vrr = true; - }; + swayidle - "device:ydotoold-virtual-device-1" = { - sensitivity = 0; - }; + jaq + shadower - general = { - gaps_in = 8; - gaps_out = 14; - border_size = 2; - "col.active_border" = "rgb(${config.catppuccin.accent})"; - "col.inactive_border" = "rgb(2B2937)"; + (writeShellScriptBin + "pauseshot" + '' + ${hyprpicker}/bin/hyprpicker -r -z & + picker_proc=$! - layout = "dwindle"; - }; + ${grimblast}/bin/grimblast save area - - decoration = { - rounding = 12; - drop_shadow = false; - shadow_range = 8; - shadow_render_power = 2; - dim_special = 0.6; - "col.shadow" = "rgba(1a1a1aff)"; - blur = { - enabled = true; - size = 6; - passes = 4; - contrast = 1.4; - brightness = 1; - noise = 0.1; - }; - }; + kill $picker_proc + '') + ]; - animations = { - enabled = true; + home.pointerCursor = { + gtk.enable = true; + inherit (cursor) size name package; + x11 = { + defaultCursor = cursor.name; + enable = true; + }; + }; - # https://wiki.hyprland.org/Configuring/Animations/ - animation = [ - "windows, 1, 3, default" - "windowsOut, 1, 3, default, popin 80%" - "border, 1, 3, default" - "fade, 1, 4, default" - "workspaces, 1, 4, default, slide" - ]; + home.xdg.configFile."hypr/hyprpaper.conf".text = '' + preload=${cfg.monitors.main.wallpaper} + ${ + if cfg.monitors.secondary.wallpaper != null + then "preload=${cfg.monitors.secondary.wallpaper}" + else "" + } + + wallpaper = ${cfg.monitors.main.name},${cfg.monitors.main.wallpaper} + ${ + if (cfg.monitors.secondary.name != null && cfg.monitors.secondary.wallpaper != null) + then "wallpaper = ${cfg.monitors.secondary.name},${cfg.monitors.secondary.wallpaper}" + else "" + } + ''; + + wayland.windowManager.hyprland = { + enable = true; + + inherit (cfg) package; + + settings = let + lockSequence = "physlock -ldms && gtklock && physlock -Ld"; + in + lib.mkMerge ([ + { + exec-once = + [ + "dbus-update-activation-environment --systemd --all" + "hyprctl setcursor ${cursor.name} ${toString cursor.size}" + "${lib.getExe pkgs.hyprpaper} & ${pkgs.playerctl}/bin/playerctld & mako" + + "firefox &" + # "schildichat-desktop & webcord &" + # "${lib.getExe pkgs.caprine-bin} &" + + # "${lib.getExe inputs.arrpc.packages.${pkgs.system}.arrpc} &" + + "wlsunset -l 52.2 -L 21 &" + + ''swayidle timeout 300 '${lockSequence}' timeout 360 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 420 'test $(${pkgs.sysstat}/bin/mpstat -o JSON 1 1 | ${lib.getExe pkgs.jaq} -r ".sysstat.hosts[0].statistics[0]["cpu-load"][0].usr | floor") -lt 80 && systemctl suspend' '' + + "systemctl --user restart xdg-desktop-portal xdg-desktop-portal-hyprland" + ] + ++ ["eww daemon && eww open bar && eww open yubikey-state"]; + + monitor = + [ + "${cfg.monitors.main.name},${toString cfg.monitors.main.width}x${toString cfg.monitors.main.height}@144,0x0,1" + "${cfg.monitors.main.name},addreserved,40,0,0,0" + ] + ++ (lib.optionals (cfg.monitors.secondary.name != null) ["monitor=${cfg.monitors.secondary.name},${toString cfg.monitors.secondary.width}x${toString cfg.monitors.secondary.height}@60,2560x0,1"]); + + workspace = + (builtins.map (n: "${toString n},monitor:${cfg.monitors.main.name}") (lib.range 1 10)) + ++ (lib.optionals (cfg.monitors.secondary.name != null) ((builtins.map (n: "${toString n},monitor:${cfg.monitors.secondary.name}") (lib.range 11 20)) ++ ["19,monitor:${cfg.monitors.secondary.name}, default:true, gapsin:0, gapsout:0, bordersize:0, rounding:false"])) + ++ [ + "1,monitor:${cfg.monitors.main.name}, default:true, gapsin:0, gapsout:0, bordersize:1, rounding:false" + "2,monitor:${cfg.monitors.main.name}, default:true" + ]; + input = { + kb_options = "caps:escape"; + + # Mouse speed + accel_profile = "flat"; + sensitivity = toString cfg.mouseSensitivity; + follow_mouse = true; + + touchpad = { + disable_while_typing = false; + drag_lock = true; + clickfinger_behavior = true; }; - - dwindle = { - no_gaps_when_only = true; - pseudotile = true; - preserve_split = true; + }; + + "device:glorious-model-o-wireless" = { + sensitivity = -0.76; + }; + + gestures = { + workspace_swipe = true; + }; + + misc = { + disable_hyprland_logo = true; + vfr = true; + vrr = true; + }; + + "device:ydotoold-virtual-device-1" = { + sensitivity = 0; + }; + + general = { + gaps_in = 8; + gaps_out = 14; + border_size = 2; + "col.active_border" = "rgb(${config.catppuccin.accent})"; + "col.inactive_border" = "rgb(2B2937)"; + + layout = "dwindle"; + }; + + decoration = { + rounding = 12; + drop_shadow = false; + shadow_range = 8; + shadow_render_power = 2; + dim_special = 0.6; + "col.shadow" = "rgba(1a1a1aff)"; + blur = { + enabled = true; + size = 6; + passes = 4; + contrast = 1.4; + brightness = 1; + noise = 0.1; }; - - windowrulev2 = [ - "pin,class:^(ssh-askpass)$" - "float,class:^(ssh-askpass)$" - "idleinhibit focus,title:^(YouTube on TV.*)$" - "idleinhibit fullscreen,class:^(.*)$" - - "workspace 2,class:firefox" - - "workspace ${ - if cfg.monitors.secondary.name != null - then "18" - else "8" - },class:Caprine" - - "workspace ${ - if cfg.monitors.secondary.name != null - then "19" - else "9" - },class:SchildiChat" - - "workspace ${ - if cfg.monitors.secondary.name != null - then "19" - else "9" - },class:WebCord" - - "forceinput,class:^(fusion360.exe)$" - "windowdance,class:^(fusion360.exe)$" - "noanim,title:^(PAUSESHOT)$" - "fullscreen,title:^(PAUSESHOT)$" - - "nomaxsize,class:^(.*)$" - ]; - - # See https://wiki.hyprland.org/Configuring/Keywords/ for more - bindr = [ - "${mainMod}, Super_L, exec, eww update show-which-key=$([ $(eww get show-which-key) == 'true' ] && echo 'false' || echo 'true')" - ]; - - bind = builtins.map (b: b.bind + "," + b.action) cfg.binds; - - binde = - [ - # Volume controls - ", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%" - ", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%" - - # Brightness - - ", XF86KbdBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} --device \"smc::kbd_backlight\" set +5%" - ", XF86KbdBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} --device \"smc::kbd_backlight\" set 5%-" - ", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} --device \"acpi_video0\" set +5%" - ", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} --device \"acpi_video0\" set 5%-" - ] - ++ (lib.optionals (cfg.secondarySink != null) ["ALT, XF86AudioRaiseVolume, exec, pactl set-sink-volume ${cfg.secondarySink} +5%" "ALT, XF86AudioLowerVolume, exec, pactl set-sink-volume ${cfg.secondarySink} -5%"]); - - # Move/resize windows with mainMod + LMB/RMB and dragging - bindm = [ - "${mainMod}, mouse:272, movewindow" - "${mainMod}, mouse:273, resizewindow" - ]; - - layerrule = [ - "blur,gtk-layer-shell" - "ignorezero,gtk-layer-shell" - "blur,anyrun" - "ignorealpha 0.6,anyrun" - "blur,notifications" - "ignorezero,notifications" - - "blur,yubikey-state" - "ignorealpha 0.6,yubikey-state" - - "noanim, ^(selection)$" + }; + + animations = { + enabled = true; + + # https://wiki.hyprland.org/Configuring/Animations/ + animation = [ + "windows, 1, 3, default" + "windowsOut, 1, 3, default, popin 80%" + "border, 1, 3, default" + "fade, 1, 4, default" + "workspaces, 1, 4, default, slide" ]; - - bindl = [",switch:off:Lid Switch, exec, ${lockSequence}"]; - } - ] - ++ (builtins.map (keyboard: { - "device:${keyboard}" = { - kb_layout = "pl"; - kb_model = ""; - kb_rules = ""; - }; - }) - cfg.keyboards)); - }; + }; + + dwindle = { + no_gaps_when_only = true; + pseudotile = true; + preserve_split = true; + }; + + windowrulev2 = [ + "pin,class:^(ssh-askpass)$" + "float,class:^(ssh-askpass)$" + "idleinhibit focus,title:^(YouTube on TV.*)$" + "idleinhibit fullscreen,class:^(.*)$" + + "workspace 2,class:firefox" + + "workspace ${ + if cfg.monitors.secondary.name != null + then "18" + else "8" + },class:Caprine" + + "workspace ${ + if cfg.monitors.secondary.name != null + then "19" + else "9" + },class:SchildiChat" + + "workspace ${ + if cfg.monitors.secondary.name != null + then "19" + else "9" + },class:WebCord" + + "forceinput,class:^(fusion360.exe)$" + "windowdance,class:^(fusion360.exe)$" + "noanim,title:^(PAUSESHOT)$" + "fullscreen,title:^(PAUSESHOT)$" + + "nomaxsize,class:^(.*)$" + ]; + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + bindr = [ + "${mainMod}, Super_L, exec, eww update show-which-key=$([ $(eww get show-which-key) == 'true' ] && echo 'false' || echo 'true')" + ]; + + bind = builtins.map (b: b.bind + "," + b.action) cfg.binds; + + binde = + [ + # Volume controls + ", XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%" + ", XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%" + + # Brightness + + ", XF86KbdBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} --device \"smc::kbd_backlight\" set +5%" + ", XF86KbdBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} --device \"smc::kbd_backlight\" set 5%-" + ", XF86MonBrightnessUp, exec, ${lib.getExe pkgs.brightnessctl} --device \"acpi_video0\" set +5%" + ", XF86MonBrightnessDown, exec, ${lib.getExe pkgs.brightnessctl} --device \"acpi_video0\" set 5%-" + ] + ++ (lib.optionals (cfg.secondarySink != null) ["ALT, XF86AudioRaiseVolume, exec, pactl set-sink-volume ${cfg.secondarySink} +5%" "ALT, XF86AudioLowerVolume, exec, pactl set-sink-volume ${cfg.secondarySink} -5%"]); + + # Move/resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "${mainMod}, mouse:272, movewindow" + "${mainMod}, mouse:273, resizewindow" + ]; + + layerrule = [ + "blur,gtk-layer-shell" + "ignorezero,gtk-layer-shell" + "blur,anyrun" + "ignorealpha 0.6,anyrun" + "blur,notifications" + "ignorezero,notifications" + + "blur,yubikey-state" + "ignorealpha 0.6,yubikey-state" + + "noanim, ^(selection)$" + ]; + + bindl = [",switch:off:Lid Switch, exec, ${lockSequence}"]; + } + ] + ++ (builtins.map (keyboard: { + "device:${keyboard}" = { + kb_layout = "pl"; + kb_model = ""; + kb_rules = ""; + }; + }) + cfg.keyboards)); }; }; } diff --git a/nixos/modules/greetd.nix b/nixos/modules/greetd.nix index fe04a8b..4b6dc05 100644 --- a/nixos/modules/greetd.nix +++ b/nixos/modules/greetd.nix @@ -1,7 +1,4 @@ -{ - self, - ... -}: { +{self, ...}: { config, pkgs, lib,