From 67c4b00b5db645421cc851488fd9a66800ff0d92 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 5 May 2024 14:01:33 +0200 Subject: [PATCH] working hyprland --- flake.lock | 286 +++++++++++++++++++++++++- flake.nix | 10 + hosts/vali/mars/configuration.nix | 1 + hosts/vali/mars/hyprland/hyprland.nix | 184 ++++++++++++++++- hosts/vali/mars/programs.nix | 2 + modules/gui/anyrun.nix | 38 ++++ modules/gui/default.nix | 1 + modules/gui/stylix.nix | 2 + modules/other/xdg.nix | 10 +- 9 files changed, 514 insertions(+), 20 deletions(-) create mode 100644 modules/gui/anyrun.nix diff --git a/flake.lock b/flake.lock index bfc1380..41cba8a 100644 --- a/flake.lock +++ b/flake.lock @@ -296,7 +296,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1710146030, @@ -429,6 +429,160 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1713612213, + "narHash": "sha256-zJboXgWNpNhKyNF8H/3UYzWkx7w00TOCGKi3cwi+tsw=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "cab4746180f210a3c1dd3d53e45c510e309e90e1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs_2", + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1714822562, + "narHash": "sha256-1rSle8rxT6sf6vFa5HYIp5y/S187R7Uxwr5Wd0/kh3Q=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "25964e5a2b633aed191915efa0de0489bf94dbb9", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-plugins": { + "inputs": { + "hyprland": [ + "hyprland" + ], + "systems": [ + "hyprland-plugins", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1714613493, + "narHash": "sha256-OhEh+iBiDRMnMNTWz5cHhfg+63+F71DKM2Xj9a21rw0=", + "owner": "hyprwm", + "repo": "hyprland-plugins", + "rev": "18daf37b7c4e6e51ca2bf8953ce4cff1c38ca725", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-plugins", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1713121246, + "narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1714755542, + "narHash": "sha256-D0pg+ZRwrt4lavZ97Ca8clsgbPA3duLj8iEM7riaIFY=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "1270ebaa539e56d61b708c24b072b09cbbd3a828", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", @@ -459,7 +613,7 @@ "flake-parts": "flake-parts_2", "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1713657840, @@ -475,6 +629,21 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1693833173, + "narHash": "sha256-hlMABKrGbEiJD5dwUSfnw1CQ3bG7KKwDV+Nx3bEZd7U=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "ac030bd9ba98e318e1f4c4328d60766ade8ebe8b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1703013332, @@ -492,6 +661,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1714253743, + "narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1713596654, "narHash": "sha256-LJbHQQ5aX1LVth2ST+Kkse/DRzgxlVhTL1rxthvyhZc=", @@ -507,7 +692,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1713537308, "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", @@ -523,7 +708,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1713596654, "narHash": "sha256-LJbHQQ5aX1LVth2ST+Kkse/DRzgxlVhTL1rxthvyhZc=", @@ -560,9 +745,12 @@ "anyrun": "anyrun", "fenix": "fenix", "home-manager": "home-manager_2", + "hyprland": "hyprland", + "hyprland-plugins": "hyprland-plugins", "neovim-nightly-overlay": "neovim-nightly-overlay", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nur": "nur", + "split-monitor-workspaces": "split-monitor-workspaces", "stylix": "stylix" } }, @@ -583,6 +771,27 @@ "type": "github" } }, + "split-monitor-workspaces": { + "inputs": { + "hyprland": [ + "hyprland" + ], + "nix-filter": "nix-filter" + }, + "locked": { + "lastModified": 1714562723, + "narHash": "sha256-eQi3ha6UCoLm8ioYpu191uqU9+/CnEO73Q/2Vn1h1Z4=", + "owner": "Duckonaut", + "repo": "split-monitor-workspaces", + "rev": "d5754698402b6016035e75348a86169587980c96", + "type": "github" + }, + "original": { + "owner": "Duckonaut", + "repo": "split-monitor-workspaces", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -595,7 +804,7 @@ "flake-compat": "flake-compat_2", "gnome-shell": "gnome-shell", "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1714555012, @@ -627,6 +836,21 @@ } }, "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -640,6 +864,56 @@ "repo": "default", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "lastModified": 1713731601, + "narHash": "sha256-bdcKdtLkusvv85DNuJsajZLFeq7bXp+x5AGP1Sd4wD8=", + "owner": "hyprwm", + "repo": "wlroots-hyprland", + "rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "wlroots-hyprland", + "rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1714060055, + "narHash": "sha256-j43TS9wv9luaAlpxcxw0sjxkbcc2mGANVR2RYgo3RCw=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "0fe840441e43da12cd7865ed9aa8cdc35a8da85a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f12ff28..1a656a2 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,16 @@ }; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + hyprland.url = "github:hyprwm/Hyprland"; + + hyprland-plugins = { + url = "github:hyprwm/hyprland-plugins"; + inputs.hyprland.follows = "hyprland"; + }; + split-monitor-workspaces = { + url = "github:Duckonaut/split-monitor-workspaces"; + inputs.hyprland.follows = "hyprland"; + }; anyrun = { url = "github:Kirottu/anyrun"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/vali/mars/configuration.nix b/hosts/vali/mars/configuration.nix index 5a8205b..e75dde8 100644 --- a/hosts/vali/mars/configuration.nix +++ b/hosts/vali/mars/configuration.nix @@ -104,6 +104,7 @@ emacs.enable = true; fish.enable = true; stylix.enable = true; + anyrun.enable = true; }; services = { pipewire.enable = true; diff --git a/hosts/vali/mars/hyprland/hyprland.nix b/hosts/vali/mars/hyprland/hyprland.nix index 08551be..27eb565 100644 --- a/hosts/vali/mars/hyprland/hyprland.nix +++ b/hosts/vali/mars/hyprland/hyprland.nix @@ -1,19 +1,184 @@ -{ config, pkgs, lib, ... }: - +{ config, pkgs, lib, inputs, ... }: with lib; let - username = config.modules.other.system.username; cfg = config.modules.programs.hyprland; + username = config.modules.other.system.username; + inherit (inputs.hyprland.packages.${pkgs.system}) hyprland; + inherit (inputs.anyrun.packages.${pkgs.system}) anyrun; in { options.modules.programs.hyprland.enable = mkEnableOption "hyprland"; config = mkIf cfg.enable { - programs.hyprland = { - enable = true; - xwayland.enable = true; - }; + + environment.sessionVariables = { + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + XDG_SESSION_DESKTOP = "Hyprland"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + GDK_BACKEND = "wayland"; + QT_QPA_PLATFORM = "wayland"; + LIBSEAT_BACKEND = "logind"; + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland + ]; + config.common.default = "*"; + }; + home-manager.users.${username} = { + wayland.windowManager.hyprland = { + enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; + plugins = [ + inputs.split-monitor-workspaces.packages.${pkgs.system}.split-monitor-workspaces + ]; + settings = { + "$mainMod" = "SUPER"; + + monitor = [ + "DP-2,1920x1080,0x0,1" + "HDMI-A-2,1920x1080,1920x0,1" + "DP-1,1920x1080,3480x0,1" + ]; + workspace = [ + + ]; + input = { + kb_layout = "de"; + kb_variant = ""; + kb_model = ""; + kb_options = ""; + kb_rules = ""; + + follow_mouse = true; + repeat_rate = 50; + repeat_delay = 250; + tablet = { + output = "HDMI-A-2"; + }; + }; + + general = { + sensitivity = 1.0; + gaps_in = 0; + gaps_out = 0; + border_size = 2; + #"col.active_border" = "0xFFF5C2E7"; + #"col.inactive_border" = "0xFF45475A"; + }; + decoration = { + rounding = 0; + blur = { + enabled = true; + size = 3; + passes = 2; + }; + drop_shadow = 1; + shadow_range = 15; + shadow_render_power = 2; + shadow_ignore_window = 1; + shadow_offset = "2 4"; + shadow_scale = 1; + + #"col.shadow" = "0xAF1E1E2E"; + }; + bezier = [ + "dupa, 0.1, 0..9, 0.1, 1.05" + ]; + animations = { + enabled = true; + animation = [ + "windows, 1, 4, dupa, popin" + "windowsOut, 1, 7, dupa, slide" + "border, 1, 15, default" + "fade, 1, 10, default" + "workspaces, 1, 5, dupa, slidevert" + ]; + }; + dwindle = { + no_gaps_when_only = true; + }; + misc = { + enable_swallow = false; + swallow_regex = "kitty"; + focus_on_activate = true; + vrr = 1; + vfr = true; + animate_manual_resizes = false; + animate_mouse_windowdragging = false; + force_default_wallpaper = 0; + }; + bind = [ + "$mainMod, RETURN, exec, ${pkgs.kitty}/bin/kitty" + "$mainMod, Q, killactive" + "$mainMod, D, exec, ${pkgs.procps}/bin/pkill anyrun || ${anyrun}/bin/anyrun" + "$mainMod, SPACE, togglefloating, active" + # workspaces + "$mainMod, 1, split-workspace, 1" + "$mainMod, 2, split-workspace, 2" + "$mainMod, 3, split-workspace, 3" + "$mainMod, 4, split-workspace, 4" + "$mainMod, 5, split-workspace, 5" + "$mainMod, 6, split-workspace, 6" + "$mainMod, 7, split-workspace, 7" + "$mainMod, 8, split-workspace, 8" + "$mainMod, 9, split-workspace, 9" + "$mainMod, 10, split-workspace, 10" + "$mainMod SHIFT, 1, split-movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, split-movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, split-movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, split-movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, split-movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, split-movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, split-movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, split-movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, split-movetoworkspacesilent, 9" + "$mainMod SHIFT, 10, split-movetoworkspacesilent, 10" + ]; + binde = [ + # window focus + "$mainMod, H, movefocus, l" + "$mainMod, J, movefocus, d" + "$mainMod, K, movefocus, k" + "$mainMod, L, movefocus, r" + + ]; + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + binds = { + pass_mouse_when_bound = false; + movefocus_cycles_fullscreen = false; + }; + plugin = { + split-monitor-workspaces = { + count = 10; + keep_focused = true; + }; + }; + }; + }; + }; environment.sessionVariables = { - WLR_NO_HARDWARE_CURSORS = "1"; - NIXOS_OZONE_WL = "1"; + /* LIBVA_DRIVER_NAME = "nvidia"; + XDG_SESSION_TYPE = "wayland"; + GBM_BACKEND = "nvidia-drm"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + SDL_VIDEODRIVER = "wayland"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + CLUTTER_BACKEND = "wayland"; + WLR_RENDERER = "vulkan"; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + GTK_USE_PORTAL = "1"; + NIXOS_XDG_OPEN_USE_PORTAL = "1"; + */ }; hardware = { opengl.enable = true; @@ -26,6 +191,7 @@ in { dunst libnotify hyprpaper + rofi-wayland ]; }; } diff --git a/hosts/vali/mars/programs.nix b/hosts/vali/mars/programs.nix index e81b26c..bb3f228 100644 --- a/hosts/vali/mars/programs.nix +++ b/hosts/vali/mars/programs.nix @@ -29,6 +29,7 @@ in { ]) ffmpeg-full fftw flameshot + grimblast heroic imv gcc @@ -79,6 +80,7 @@ in { spotube steam strawberry + teamspeak_client telegram-desktop texliveFull trilium-desktop diff --git a/modules/gui/anyrun.nix b/modules/gui/anyrun.nix new file mode 100644 index 0000000..a728c9b --- /dev/null +++ b/modules/gui/anyrun.nix @@ -0,0 +1,38 @@ +{ config, pkgs, lib, inputs, ... }: + +with lib; +let + username = config.modules.other.system.username; + cfg = config.modules.programs.anyrun; +in { + options.modules.programs.anyrun.enable = mkEnableOption "anyrun"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + imports = [ inputs.anyrun.homeManagerModules.default ]; + + programs.anyrun = { + enable = true; + config = { + plugins = with inputs.anyrun.packages.${pkgs.system}; [ + applications + dictionary + kidex + rink + symbols + translate + ]; + hideIcons = false; + ignoreExclusiveZones = false; + layer = "overlay"; + hidePluginInfo = false; + closeOnClick = true; + showResultsImmediately = true; + maxEntries = 50; + width.fraction = 0.3; + y.absolute = 15; + }; + }; + }; + }; +} + diff --git a/modules/gui/default.nix b/modules/gui/default.nix index ca4f998..50427e0 100644 --- a/modules/gui/default.nix +++ b/modules/gui/default.nix @@ -7,6 +7,7 @@ _: { ./qt.nix ./zathura.nix ./stylix.nix + ./anyrun.nix ./rofi.nix ./kitty.nix ./vivado.nix diff --git a/modules/gui/stylix.nix b/modules/gui/stylix.nix index 8f512fd..a902d53 100644 --- a/modules/gui/stylix.nix +++ b/modules/gui/stylix.nix @@ -23,6 +23,7 @@ in { vim.enable = true; zathura.enable = true; gtk.enable = true; + hyprland.enable = true; }; opacity = { @@ -54,6 +55,7 @@ in { }; }; stylix = { + polarity = "dark"; image = ../../hosts/vali/mars/2024-04-21-14-50.png; cursor = { package = pkgs.bibata-cursors; diff --git a/modules/other/xdg.nix b/modules/other/xdg.nix index a246ef3..f272013 100644 --- a/modules/other/xdg.nix +++ b/modules/other/xdg.nix @@ -12,11 +12,11 @@ let terminal = "kitty.desktop"; in { - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - config.common.default = "gtk"; - }; +# xdg.portal = { +# enable = true; +# extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; +# config.common.default = "gtk"; +# }; environment.sessionVariables = { TERMINAL = "${terminal}"; };