diff --git a/README.md b/README.md new file mode 100644 index 0000000..d8c503b --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +```bash +# Setup disks +nix run --experimental-features "nix-common flakes" github:nix-community/disko -- --mode disko --flake .#hades + +# install configs +nixos-install --flake .#hades + +# set password +nixos-enter --root /mnt -- passwd anish +``` diff --git a/home/default.nix b/home/default.nix index 49a3205..b5079e1 100644 --- a/home/default.nix +++ b/home/default.nix @@ -7,5 +7,7 @@ ./brave.nix ]; + xdg.portal.config.common.default = "*"; + home.stateVersion = "26.05"; } diff --git a/home/hypr/hyprland.nix b/home/hypr/hyprland.nix index a354dc8..632e8d9 100644 --- a/home/hypr/hyprland.nix +++ b/home/hypr/hyprland.nix @@ -1,33 +1,86 @@ { pkgs, lib, ... }: let - mod = "SUPER"; - terminal = "foot"; - menu = "rofi -show drun"; - browser = "brave"; + mkLua = lib.generators.mkLuaInline; in { wayland.windowManager.hyprland = { enable = true; configType = "lua"; - package = null; + package = null; # Hyprland package is managed system-wide via NixOS programs.hyprland settings = { # ----------------------------------------------------------------------- - # 1. Variables & Modifiers + # 1. Variables & Modifiers (Rendered as Lua local variables) # ----------------------------------------------------------------------- - "$mod" = mod; - "$terminal" = terminal; - "$menu" = menu; - "$browser" = browser; + mainMod = { _var = "SUPER"; }; + terminal = { _var = "foot"; }; + browser = { _var = "brave"; }; # ----------------------------------------------------------------------- - # 2. Main Config (hl.config) + # 2. Monitors (hl.monitor) + # ----------------------------------------------------------------------- + monitor = [ + { + output = "eDP-2"; + mode = "3840x2160@144"; + position = "0x0"; + scale = 2; + } + { + output = "desc:Dell Inc. DELL U3419W 28DQ5T2"; + mode = "3440x1440@60"; + position = "0x-1440"; + scale = 1; + } + { + output = "desc:Samsung Electric Company Odyssey Ark H1AK500000"; + mode = "3840x2160@144"; + position = "3840x0"; + scale = 1; + } + { + output = ""; + mode = "preferred"; + position = "auto"; + scale = "auto"; + } + ]; + + # ----------------------------------------------------------------------- + # 3. Environment Variables (hl.env) + # ----------------------------------------------------------------------- + env = [ + { _args = [ "XCURSOR_SIZE" "24" ]; } + { _args = [ "LIBVA_DRIVE_NAME" "nvidia" ]; } + { _args = [ "XDG_SESSION_TYPE" "wayland" ]; } + { _args = [ "GBM_BACKEND" "nvidia-drm" ]; } + { _args = [ "WLR_NO_HARDWARE_CURSORS" "1" ]; } + { _args = [ "WLR_DRM_DEVICES" "/dev/dri/card1:/dev/dri/card0" ]; } + ]; + + # ----------------------------------------------------------------------- + # 4. Main Configuration (hl.config) - Strictly validates against Hyprland 0.55+ schema # ----------------------------------------------------------------------- config = { + input = { + kb_layout = "us"; + repeat_delay = 300; + repeat_rate = 50; + follow_mouse = 1; + sensitivity = 0; + touchpad = { + natural_scroll = false; + }; + }; + + cursor = { + inactive_timeout = 3; + }; + general = { - gaps_in = 4; - gaps_out = 8; + gaps_in = 5; + gaps_out = 10; border_size = 2; col = { active_border = { @@ -37,23 +90,43 @@ in inactive_border = "rgba(595959aa)"; }; layout = "dwindle"; - allow_tearing = false; + }; + + group = { + groupbar = { + font_size = 14; + font_family = "SF Pro Display"; + col = { + active = "rgba(33ccff00)"; + inactive = "rgba(59595900)"; + }; + }; + + col = { + border_active = { + colors = [ "rgba(33ccffee)" "rgba(00ff99ee)" ]; + angle = 45; + }; + border_inactive = "rgba(595959aa)"; + }; + }; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; }; decoration = { - rounding = 8; - active_opacity = 1.0; - inactive_opacity = 0.95; + rounding = 10; blur = { - enabled = true; - size = 5; - passes = 2; - new_optimizations = true; + enabled = false; + size = 3; + passes = 1; }; shadow = { - enabled = true; + enabled = false; range = 4; render_power = 3; color = "rgba(1a1a1aee)"; @@ -64,130 +137,234 @@ in enabled = true; }; - input = { - kb_layout = "us"; - follow_mouse = 1; - touchpad = { - natural_scroll = true; - }; - sensitivity = 0; - }; - dwindle = { - pseudotile = true; preserve_split = true; }; - misc = { - force_default_wallpaper = 0; - disable_hyprland_logo = true; + master = { + new_status = "master"; }; }; # ----------------------------------------------------------------------- - # 3. Animation Curves (hl.curve) & Animations + # 5. Curves & Animations (hl.curve & hl.animation) # ----------------------------------------------------------------------- curve = [ { _args = [ - "easeOutQuint" + "myBezier" { type = "bezier"; - points = [ [ 0.23 1 ] [ 0.32 1 ] ]; + points = [ [ 0.05 0.9 ] [ 0.1 1.05 ] ]; } ]; } ]; animation = [ - "windows, 1, 3, easeOutQuint" - "windowsOut, 1, 3, easeOutQuint, popin 80%" - "border, 1, 3, easeOutQuint" - "fade, 1, 3, easeOutQuint" - "workspaces, 1, 3, easeOutQuint" + { leaf = "windows"; enabled = true; speed = 7; bezier = "myBezier"; } + { leaf = "windowsOut"; enabled = true; speed = 7; bezier = "default"; style = "popin 80%"; } + { leaf = "border"; enabled = true; speed = 10; bezier = "default"; } + { leaf = "borderangle"; enabled = true; speed = 8; bezier = "default"; } + { leaf = "fade"; enabled = true; speed = 7; bezier = "default"; } + { leaf = "workspaces"; enabled = true; speed = 6; bezier = "default"; } ]; # ----------------------------------------------------------------------- - # 4. Autostart Daemons & Apps + # 6. Autostart Daemons & Apps (hl.on) # ----------------------------------------------------------------------- - exec-once = [ - "waybar" - "dunst" - "hypridle" - "wl-paste --type text --watch cliphist store" - "wl-paste --type image --watch cliphist store" + on = [ + { + _args = [ + "hyprland.start" + (mkLua ''function() + hl.exec_cmd("waybar") + hl.exec_cmd("hyprpaper") + hl.exec_cmd("swayidle -w") + hl.exec_cmd("swaync") + hl.exec_cmd("/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1") + hl.exec_cmd("hyprlock") + end'') + ]; + } ]; # ----------------------------------------------------------------------- - # 5. Keybindings + # 7. Keybindings (hl.bind) # ----------------------------------------------------------------------- bind = [ - # Launchers & Applications - "$mod, RETURN, exec, $terminal" - "$mod, SPACE, exec, $menu" - "$mod, B, exec, $browser" - "$mod, D, exec, discord" - "$mod, E, exec, $terminal -e yazi" - "$mod, L, exec, hyprlock" + # Launchers & Window Controls + { _args = [ (mkLua "mainMod .. \" + Q\"") (mkLua "hl.dsp.exec_cmd(terminal)") ]; } + { _args = [ (mkLua "mainMod .. \" + C\"") (mkLua "hl.dsp.window.close()") ]; } + { _args = [ (mkLua "mainMod .. \" + N\"") (mkLua "hl.dsp.exec_cmd(\"swaync-client -t -sw\")") ]; } + { _args = [ (mkLua "mainMod .. \" + V\"") (mkLua "hl.dsp.window.float({ action = \"toggle\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + R\"") (mkLua "hl.dsp.exec_cmd(\"rofi -show combi -show-icons\")") ]; } + { _args = [ (mkLua "mainMod .. \" + G\"") (mkLua "hl.dsp.group.toggle()") ]; } + { _args = [ (mkLua "mainMod .. \" + F\"") (mkLua "hl.dsp.window.fullscreen({ fullscreen = 0 })") ]; } - # Window Controls - "$mod SHIFT, Q, killactive," - "$mod, F, fullscreen, 0" - "$mod, V, togglefloating," - "$mod, P, pseudo," - "$mod, J, togglesplit," + # Move focus with mainMod + vim + { _args = [ (mkLua "mainMod .. \" + h\"") (mkLua "hl.dsp.focus({ direction = \"left\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + l\"") (mkLua "hl.dsp.focus({ direction = \"right\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + k\"") (mkLua "hl.dsp.focus({ direction = \"up\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + j\"") (mkLua "hl.dsp.focus({ direction = \"down\" })") ]; } - # Screenshots (Grim + Slurp) - "$mod, PRINT, exec, grim -g \"$(slurp)\" - | wl-copy" - "$mod SHIFT, PRINT, exec, grim ~/Pictures/Screenshot_$(date +'%Y%m%d_%H%M%S').png" + # Move focus within a grouped page + { _args = [ (mkLua "mainMod .. \" + e\"") (mkLua "hl.dsp.group.next()") ]; } + { _args = [ (mkLua "mainMod .. \" + d\"") (mkLua "hl.dsp.group.prev()") ]; } - # Vim Focus Navigation (H, J, K, L & Arrows) - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - "$mod, h, movefocus, l" - "$mod, l, movefocus, r" - "$mod, k, movefocus, u" - "$mod, j, movefocus, d" + # Move window or group with vim keys + { _args = [ (mkLua "mainMod .. \" + SHIFT + h\"") (mkLua "hl.dsp.window.move({ direction = \"left\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + SHIFT + l\"") (mkLua "hl.dsp.window.move({ direction = \"right\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + SHIFT + k\"") (mkLua "hl.dsp.window.move({ direction = \"up\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + SHIFT + j\"") (mkLua "hl.dsp.window.move({ direction = \"down\" })") ]; } - # Vim Window Swapping - "$mod SHIFT, left, swapwindow, l" - "$mod SHIFT, right, swapwindow, r" - "$mod SHIFT, up, swapwindow, u" - "$mod SHIFT, down, swapwindow, d" - "$mod SHIFT, h, swapwindow, l" - "$mod SHIFT, l, swapwindow, r" - "$mod SHIFT, k, swapwindow, u" - "$mod SHIFT, j, swapwindow, d" + # Scroll through existing workspaces with mainMod + scroll + { _args = [ (mkLua "mainMod .. \" + mouse_down\"") (mkLua "hl.dsp.focus({ workspace = \"e+1\" })") ]; } + { _args = [ (mkLua "mainMod .. \" + mouse_up\"") (mkLua "hl.dsp.focus({ workspace = \"e-1\" })") ]; } - # Scratchpad / Special Workspace - "$mod, S, togglespecialworkspace, magic" - "$mod SHIFT, S, movetoworkspace, special:magic" + # Lock shortcut + { _args = [ (mkLua "mainMod .. \" + S\"") (mkLua "hl.dsp.exec_cmd(\"wlogout\")") ]; } + + # Quick access applications + { _args = [ (mkLua "mainMod .. \" + b\"") (mkLua "hl.dsp.exec_cmd(browser)") ]; } + { _args = [ (mkLua "mainMod .. \" + t\"") (mkLua "hl.dsp.exec_cmd(\"thunderbird\")") ]; } + + # Scratch workspace + { _args = [ (mkLua "mainMod .. \" + RETURN\"") (mkLua "hl.dsp.workspace.toggle_special(\"scratch\")") ]; } + { _args = [ (mkLua "mainMod .. \" + SHIFT + RETURN\"") (mkLua "hl.dsp.window.move({ workspace = \"special:scratch\" })") ]; } + + # Messaging workspace + { _args = [ (mkLua "mainMod .. \" + M\"") (mkLua "hl.dsp.workspace.toggle_special(\"messaging\")") ]; } + + # Move/resize windows with mouse and dragging + { + _args = [ + (mkLua "mainMod .. \" + mouse:272\"") + (mkLua "hl.dsp.window.drag()") + { mouse = true; } + ]; + } + { + _args = [ + (mkLua "mainMod .. \" + mouse:273\"") + (mkLua "hl.dsp.window.resize()") + { mouse = true; } + ]; + } + + # Function Row Keys + { + _args = [ + "XF86AudioRaiseVolume" + (mkLua "hl.dsp.exec_cmd(\"pactl -- set-sink-volume @DEFAULT_SINK@ +5%\")") + { repeating = true; } + ]; + } + { + _args = [ + "XF86AudioLowerVolume" + (mkLua "hl.dsp.exec_cmd(\"pactl -- set-sink-volume @DEFAULT_SINK@ -5%\")") + { repeating = true; locked = true; } + ]; + } + { + _args = [ + "XF86AudioMute" + (mkLua "hl.dsp.exec_cmd(\"pactl -- set-sink-mute @DEFAULT_SINK@ toggle\")") + { repeating = true; locked = true; } + ]; + } + { + _args = [ + "XF86MonBrightnessUp" + (mkLua "hl.dsp.exec_cmd(\"brightnessctl -d acpi_video0 set 5%+\")") + { repeating = true; locked = true; } + ]; + } + { + _args = [ + "XF86MonBrightnessDown" + (mkLua "hl.dsp.exec_cmd(\"brightnessctl -d acpi_video0 set 5%-\")") + { repeating = true; locked = true; } + ]; + } + + # Lid switch + { + _args = [ + "switch:off:Lid Switch" + (mkLua "hl.dsp.exec_cmd(\"hyprctl keyword monitor \\\"eDP-2,3840x2160@144,0x0,2\\\"\")") + { locked = true; } + ]; + } + { + _args = [ + "switch:on:Lid Switch" + (mkLua "hl.dsp.exec_cmd(\"hyprctl keyword monitor \\\"eDP-2, disable\\\"\")") + { locked = true; } + ]; + } ] - # Generate Workspace 1-10 switching and moving bindings with a list comprehension - ++ (map (i: "$mod, ${toString i}, workspace, ${toString i}") (lib.range 1 9)) - ++ [ "$mod, 0, workspace, 10" ] - ++ (map (i: "$mod SHIFT, ${toString i}, movetoworkspace, ${toString i}") (lib.range 1 9)) - ++ [ "$mod SHIFT, 0, movetoworkspace, 10" ]; - - # Locked/repeating bindings (Volume, Media, Brightness) - bindle = [ - ", XF86MonBrightnessUp, exec, brightnessctl set +5%" - ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + # Workspace 1-9 switching and moving + ++ (lib.concatMap (i: [ + { + _args = [ + (mkLua "mainMod .. \" + ${toString i}\"") + (mkLua "hl.dsp.focus({ workspace = ${toString i} })") + ]; + } + { + _args = [ + (mkLua "mainMod .. \" + SHIFT + ${toString i}\"") + (mkLua "hl.dsp.window.move({ workspace = ${toString i} })") + ]; + } + ]) (lib.range 1 9)) + # Workspace 10 switching and moving (mapped to key 0) + ++ [ + { + _args = [ + (mkLua "mainMod .. \" + 0\"") + (mkLua "hl.dsp.focus({ workspace = 10 })") + ]; + } + { + _args = [ + (mkLua "mainMod .. \" + SHIFT + 0\"") + (mkLua "hl.dsp.window.move({ workspace = 10 })") + ]; + } ]; - bindl = [ - ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + # ----------------------------------------------------------------------- + # 8. Workspace Rules (hl.workspace_rule) + # ----------------------------------------------------------------------- + workspace_rule = [ + { + workspace = "name:messaging"; + on_created_empty = "[] togglegroup"; + } ]; - # Mouse bindings (move/resize floating windows) - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" + # ----------------------------------------------------------------------- + # 9. Window Rules (hl.window_rule) + # ----------------------------------------------------------------------- + window_rule = [ + { + name = "signal-messaging"; + match = { class = "Signal"; }; + workspace = "special:messaging"; + } + { + name = "webcord-messaging"; + match = { class = "WebCord"; }; + workspace = "special:messaging"; + } + { + name = "ghidra-tile"; + match = { class = "ghidra-Ghidra"; }; + float = false; + } ]; }; }; diff --git a/hosts/hades/display-configuration.nix b/hosts/hades/display-configuration.nix index 2edf7ff..f2237fd 100644 --- a/hosts/hades/display-configuration.nix +++ b/hosts/hades/display-configuration.nix @@ -1,12 +1,5 @@ { ... }: { - home-manager.users.anish.wayland.windowManager.hyprland.settings.monitor = [ - { - output = "HDMI-A-1"; - mode = "3840x2160"; - position = "auto"; - scale = 2; - } - ]; + # Host-specific display configurations can be placed here if needed. }