From 21c329e9c8248a5d001f26a75f63866b59f30079 Mon Sep 17 00:00:00 2001 From: winston Date: Mon, 22 Apr 2024 12:34:00 +0200 Subject: [PATCH] feat(hyprland): re-init for the 3rd time --- flake.lock | 184 +++++++++++++++--------------- home/apps/default.nix | 1 + home/apps/discord.nix | 9 +- home/apps/gpg.nix | 14 ++- home/apps/hyprland.nix | 141 +++++++++++++++++++++++ home/apps/sway.nix | 4 +- machines/common/linux/boot.nix | 8 +- machines/common/linux/greeter.nix | 2 +- machines/common/linux/sway.nix | 17 ++- pkgs/overlays.nix | 4 +- 10 files changed, 268 insertions(+), 116 deletions(-) create mode 100644 home/apps/hyprland.nix diff --git a/flake.lock b/flake.lock index d77e02e..d2b7f0e 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ ] }, "locked": { - "lastModified": 1712625686, - "narHash": "sha256-gQtnKMfEkzocMA9D9tZjbhwYywo+3QpIeKui4sFDEhY=", + "lastModified": 1713405367, + "narHash": "sha256-HZfBEaZM1KxHLJwGSuCwjDA+EWJpMZl0kUpltaM0ZeU=", "owner": "caarlos0", "repo": "nur", - "rev": "a331639906c5b9919f36bccb2cd3194cae7230a6", + "rev": "89b16b80f3f3a0944a86605e3a6ac4ecebff45b0", "type": "github" }, "original": { @@ -57,11 +57,11 @@ ] }, "locked": { - "lastModified": 1712774858, - "narHash": "sha256-0en4GPb0ztX2Sf5Zvzj+TIx3ycCHvjGU5KxoD+XZo58=", + "lastModified": 1713283909, + "narHash": "sha256-2kcINN2FM9Pqo4ipoInCf+wU3rCJcvAc+mFSaM/KQe8=", "owner": "catppuccin", "repo": "toolbox", - "rev": "25acb3419de05614fa972f14a0bc452df59c0491", + "rev": "6148435e940b82f3edfa65c02cb9e20a48cb7de5", "type": "github" }, "original": { @@ -77,11 +77,11 @@ ] }, "locked": { - "lastModified": 1710544781, - "narHash": "sha256-nkxihb3D85k1nZV1CzlB3seMKtTEeKb688sblIGp/Bs=", + "lastModified": 1713403580, + "narHash": "sha256-VP3AiTLL40Zhr+99SwKjIE+ifRy/elhvGIF5W92J+fs=", "owner": "catppuccin", "repo": "vscode", - "rev": "d7b96ccac36fd29929bd97bc9357413cc4e0240c", + "rev": "4dd5fa89173bc931e882f21da0de1609f1db9f39", "type": "github" }, "original": { @@ -97,11 +97,11 @@ ] }, "locked": { - "lastModified": 1711763326, - "narHash": "sha256-sXcesZWKXFlEQ8oyGHnfk4xc9f2Ip0X/+YZOq3sKviI=", + "lastModified": 1713543876, + "narHash": "sha256-olEWxacm1xZhAtpq+ZkEyQgR4zgfE7ddpNtZNvubi3g=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "36524adc31566655f2f4d55ad6b875fb5c1a4083", + "rev": "9e7c20ffd056e406ddd0276ee9d89f09c5e5f4ed", "type": "github" }, "original": { @@ -110,6 +110,30 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nekowinston-nur", + "nixpkgs" + ], + "rust-analyzer-src": [ + "nekowinston-nur" + ] + }, + "locked": { + "lastModified": 1713680591, + "narHash": "sha256-3pbv7UgAgetwz9YdjzIT/lZ6Rgj6wj6MR4mphBLyDjU=", + "owner": "nix-community", + "repo": "fenix", + "rev": "19aaa94a73cc670a4d87e84f0909966cd8f8cd79", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -148,24 +172,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -194,11 +200,11 @@ ] }, "locked": { - "lastModified": 1712759992, - "narHash": "sha256-2APpO3ZW4idlgtlb8hB04u/rmIcKA8O7pYqxF66xbNY=", + "lastModified": 1713732794, + "narHash": "sha256-AYCofb8Zu4Mbc1lHDtju/uxeARawRijmOueAqEMEfMU=", "owner": "nix-community", "repo": "home-manager", - "rev": "31357486b0ef6f4e161e002b6893eeb4fafc3ca9", + "rev": "670d9ecc3e46a6e3265c203c2d136031a3d3548e", "type": "github" }, "original": { @@ -209,16 +215,15 @@ }, "nekowinston-nur": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" + "fenix": "fenix", + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1712819001, - "narHash": "sha256-of0junzhgepG+0YdzoMSzuR6/2USwQ55TP/2iuCNE/Q=", + "lastModified": 1713683280, + "narHash": "sha256-6ll6cjXdrJ8jPT6C4ZSLAt2opdOCb3ezW2SHtUCAG8g=", "owner": "nekowinston", "repo": "nur", - "rev": "ef6456b6263fc2b0854943a94bb25e00c0c0f430", + "rev": "2fac00c44699317fc3dff89aa5c1def9767f72b1", "type": "github" }, "original": { @@ -254,11 +259,11 @@ ] }, "locked": { - "lastModified": 1712459390, - "narHash": "sha256-e12bNDottaGoBgd0AdH/bQvk854xunlWAdZwr/oHO1c=", + "lastModified": 1713668931, + "narHash": "sha256-rVlwWQlgFGGK3aPVcKmtYqWgjYnPah5FOIsYAqrMN2w=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "4676d72d872459e1e3a248d049609f110c570e9a", + "rev": "07ece11b22217b8459df589f858e92212b74f1a1", "type": "github" }, "original": { @@ -278,11 +283,11 @@ ] }, "locked": { - "lastModified": 1712908241, - "narHash": "sha256-437eFtdwo79m4oPKqTrfhag79hnliG/HkW3CcAL7pdY=", + "lastModified": 1713662650, + "narHash": "sha256-pAAXTH3bUBELrXFGgRjzy/67Lm5trkFB2SXp6epMxX0=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "203c54546c1768f3d0341b5d26932e9a7e865709", + "rev": "03c7d19b4fbf7dd0f9890c310e809ca04da76c4e", "type": "github" }, "original": { @@ -293,11 +298,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "type": "github" }, "original": { @@ -309,11 +314,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1712791164, - "narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=", + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "type": "github" }, "original": { @@ -323,13 +328,29 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1713128889, + "narHash": "sha256-aB90ZqzosyRDpBh+rILIcyP5lao8SKz8Sr2PSWvZrzk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2748d22b45a99fb2deafa5f11c7531c212b2cefa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "locked": { - "lastModified": 1712935599, - "narHash": "sha256-raHWckCSlGolfqvkqKpJfzyOcSWuIGmuVsOTWMxkssQ=", + "lastModified": 1713732355, + "narHash": "sha256-7dtWxV9O1ujFcZcYmaiBVdL3Snk0Y7AFL6pufM31alk=", "owner": "nix-community", "repo": "nur", - "rev": "e5d7288700dab849d2f2261b4a4ef383df1adbb5", + "rev": "9982d9ed76f4b0335d8e016fe7c71f21fd4ef5eb", "type": "github" }, "original": { @@ -388,28 +409,21 @@ "wsl": "wsl" } }, - "rust-overlay": { + "scenefx": { "inputs": { - "flake-utils": [ - "nekowinston-nur", - "flake-utils" - ], - "nixpkgs": [ - "nekowinston-nur", - "nixpkgs" - ] + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1712456031, - "narHash": "sha256-vPM+DLCyiT3eKGdDBIxqsgBrbbB7lL0TR6R7FLhX1v8=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "0e5eaa43f116d798c289b0bb831320a353efc905", + "lastModified": 1713495445, + "narHash": "sha256-dMvGkhjt72NznwI57HLR+Oc6QMctf16W4zI1XYuwnZI=", + "owner": "wlrfx", + "repo": "scenefx", + "rev": "5ada125a56012923c47fcf3d049fab32eb7104ff", "type": "github" }, "original": { - "owner": "oxalica", - "repo": "rust-overlay", + "owner": "wlrfx", + "repo": "scenefx", "type": "github" } }, @@ -417,14 +431,15 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ] + ], + "scenefx": "scenefx" }, "locked": { - "lastModified": 1712764522, - "narHash": "sha256-nLrg/congNWRJ75KtW/Oz35TgaYQ2T5sl4ZsQADn6q4=", + "lastModified": 1713498711, + "narHash": "sha256-VxTnCdx+17tASYxsOiqKCAAda22P9eV7IFxnXl3wZh8=", "owner": "willpower3309", "repo": "swayfx", - "rev": "167a4ea0aec93d51e4c606ffdbe3a195d12da6e3", + "rev": "4b954d5a05d986afcaaf488e744c5566a2d031ef", "type": "github" }, "original": { @@ -448,21 +463,6 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "vscode-server": { "inputs": { "flake-utils": [ @@ -497,11 +497,11 @@ ] }, "locked": { - "lastModified": 1710519878, - "narHash": "sha256-0dbc10OBFUVYyXC+C+N6vRUd8xyBSRxkcZ4Egipbx0M=", + "lastModified": 1713528946, + "narHash": "sha256-IBQta+xrEaI2S5UmYrXcgV7Tu7rGLQu2V3TeJseLPSg=", "owner": "nix-community", "repo": "nixos-wsl", - "rev": "aef95bdb6800a3a2af7aa7083d6df03067da6592", + "rev": "63c1247e12f269396ed2df8cdec3aed1f0f3928c", "type": "github" }, "original": { diff --git a/home/apps/default.nix b/home/apps/default.nix index 032a3b3..67da071 100644 --- a/home/apps/default.nix +++ b/home/apps/default.nix @@ -8,6 +8,7 @@ ./gnome.nix ./gpg.nix ./gtk.nix + ./hyprland.nix ./kubernetes.nix ./mail.nix ./media.nix diff --git a/home/apps/discord.nix b/home/apps/discord.nix index 2418cff..604b1e4 100644 --- a/home/apps/discord.nix +++ b/home/apps/discord.nix @@ -7,7 +7,14 @@ inherit (pkgs.stdenv) isDarwin isLinux; in { config = lib.mkIf config.isGraphical { - home.packages = [(pkgs.discord.override {withOpenASAR = true;})]; + home.packages = + [] + ++ (lib.optionals isDarwin [ + (pkgs.discord.override {withOpenASAR = true;}) + ]) + ++ (lib.optionals isLinux [ + pkgs.vesktop + ]); home.activation.discordSettings = let json = pkgs.writeTextFile { name = "discord-settings.json"; diff --git a/home/apps/gpg.nix b/home/apps/gpg.nix index 1710413..620b487 100644 --- a/home/apps/gpg.nix +++ b/home/apps/gpg.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: let +{ + config, + pkgs, + ... +}: let inherit (pkgs.stdenv.hostPlatform) isLinux isDarwin; key = "0x0B89BC45007EE9CC"; mailvelopeConfig = builtins.toJSON { @@ -97,9 +101,9 @@ in { enable = isLinux; enableExtraSocket = true; enableSshSupport = true; - # pinentryPackage = - # if config.isGraphical - # then pkgs.pinentry-gnome3 - # else pkgs.pinentry-curses; + pinentryPackage = + if config.isGraphical + then pkgs.pinentry-gnome3 + else pkgs.pinentry-curses; }; } diff --git a/home/apps/hyprland.nix b/home/apps/hyprland.nix new file mode 100644 index 0000000..c60b529 --- /dev/null +++ b/home/apps/hyprland.nix @@ -0,0 +1,141 @@ +{ + config, + lib, + pkgs, + osConfig, + ... +}: { + config = lib.mkIf (config.isGraphical && pkgs.stdenv.isLinux && (osConfig.dotfiles.desktop == "sway")) { + home = { + packages = with pkgs; [ + blueberry + kooha + libnotify + pavucontrol + swayosd + wl-clipboard + swaybg + hyprpicker + grimblast + ]; + }; + + services = { + clipman.enable = true; + gnome-keyring = { + enable = true; + components = ["secrets"]; + }; + wlsunset = { + enable = true; + latitude = toString config.location.latitude; + longitude = toString config.location.longitude; + }; + udiskie.enable = true; + }; + + wayland.windowManager.hyprland = let + mod = "SUPER"; + modFocus = "${mod}_CTRL"; + modMove = "${mod}_SHIFT"; + hyper = "SUPER_CTRL_SHIFT_ALT"; + swayosd = pkgs.swayosd + "/bin/swayosd-client"; + playerctl = "${pkgs.playerctl}/bin/playerctl"; + in { + enable = true; + settings = { + monitor = ",preferred,auto,2"; + input.follow_mouse = 1; + env = [ + "MOZ_ENABLE_WAYLAND, 1" + "NIXOS_OZONE_WL, 1" + "QT_QPA_PLATFORM, wayland" + "QT_QPA_PLATFORMTHEME, qt5ct" + "SDL_VIDEODRIVER, wayland" + "GDK_SCALE, 2" + "XCURSOR_SIZE, 24" + "XDG_CURRENT_DESKTOP, hyprland" + "XDG_SESSION_DESKTOP, hyprland" + "XDG_SESSION_TYPE, wayland" + "_JAVA_AWT_WM_NONREPARENTING, 1" + ]; + general = { + gaps_in = 2; + gaps_out = 5; + border_size = 2; + "col.active_border" = "0xfff5c2e7"; + "col.inactive_border" = "0x80cba6f7"; + }; + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + decoration.rounding = 5; + dwindle.preserve_split = true; + windowrulev2 = ["suppressevent maximize, class:.*"]; + bind = [ + "${modMove}, return, exec, foot" + "${modMove}, q, killactive," + "${modMove}, m, exit," + "${modMove}, d, togglefloating," + "${mod}, space, exec, rofi -show drun" + "${modMove}, space, exec, 1password --quick-access" + "${hyper}, p, exec, grimblast --notify --freeze copy area" + + "${modFocus}, h, movefocus, l" + "${modFocus}, j, movefocus, d" + "${modFocus}, k, movefocus, u" + "${modFocus}, l, movefocus, r" + "${modMove}, h, movewindow, l" + "${modMove}, j, movewindow, u" + "${modMove}, k, movewindow, d" + "${modMove}, l, movewindow, r" + + "${modFocus}, 1, workspace, 1" + "${modFocus}, 2, workspace, 2" + "${modFocus}, 3, workspace, 3" + "${modFocus}, 4, workspace, 4" + "${modFocus}, 5, workspace, 5" + "${modFocus}, 6, workspace, 6" + "${modFocus}, 7, workspace, 7" + "${modFocus}, 8, workspace, 8" + "${modFocus}, 9, workspace, 9" + "${modFocus}, 0, workspace, 10" + + "${modMove}, 1, movetoworkspace, 1" + "${modMove}, 2, movetoworkspace, 2" + "${modMove}, 3, movetoworkspace, 3" + "${modMove}, 4, movetoworkspace, 4" + "${modMove}, 5, movetoworkspace, 5" + "${modMove}, 6, movetoworkspace, 6" + "${modMove}, 7, movetoworkspace, 7" + "${modMove}, 8, movetoworkspace, 8" + "${modMove}, 9, movetoworkspace, 9" + "${modMove}, 0, movetoworkspace, 10" + "${mod}, tab, togglespecialworkspace, magic" + "${modMove}, tab, movetoworkspace, special:magic" + + ", XF86AudioMute, exec, ${swayosd} --output-volume mute-toggle" + ", XF86AudioNext, exec, ${playerctl} next" + ", XF86AudioPrev, exec, ${playerctl} previous" + ", XF86AudioPause, exec, ${playerctl} play-pause" + ]; + binde = [ + ", XF86AudioRaiseVolume, exec, ${swayosd} --output-volume 5" + ", XF86AudioLowerVolume, exec, ${swayosd} --output-volume -5" + ]; + bindm = [ + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + ]; + exec = [ + "${pkgs.swayosd}/bin/swayosd-server" + "${pkgs.swaybg}/bin/swaybg -o '*' -m fill -i ${../wallpapers/dhm_1610.png}" + ]; + exec-once = [ + "${pkgs.xorg.xprop}/bin/xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2" + ]; + }; + }; + }; +} diff --git a/home/apps/sway.nix b/home/apps/sway.nix index 64da09c..ddff3f9 100644 --- a/home/apps/sway.nix +++ b/home/apps/sway.nix @@ -1,6 +1,5 @@ { config, - flakePath, lib, osConfig, pkgs, @@ -54,6 +53,7 @@ in { in { enable = true; package = null; + checkConfig = false; config = rec { inherit modifier; focus.wrapping = "no"; @@ -91,7 +91,7 @@ in { input."type:keyboard".xkb_options = "ctrl:nocaps,compose:ralt"; output."*" = { scale = "2"; - bg = "${flakePath}/home/wallpapers/dhm_1610.png fill #171320"; + bg = "${../wallpapers/dhm_1610.png} fill #171320"; }; keybindings = let mod = modifier; diff --git a/machines/common/linux/boot.nix b/machines/common/linux/boot.nix index c316aa1..b274df8 100644 --- a/machines/common/linux/boot.nix +++ b/machines/common/linux/boot.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{ boot = { loader.efi.canTouchEfiVariables = true; loader.systemd-boot.enable = true; @@ -6,10 +6,6 @@ supportedFilesystems = ["ntfs"]; - plymouth = { - enable = true; - theme = "catppuccin-mocha"; - themePackages = [pkgs.nur.repos.nekowinston.plymouth-theme-catppuccin]; - }; + plymouth.enable = true; }; } diff --git a/machines/common/linux/greeter.nix b/machines/common/linux/greeter.nix index ebc018a..d6f94b6 100644 --- a/machines/common/linux/greeter.nix +++ b/machines/common/linux/greeter.nix @@ -12,7 +12,7 @@ "${pkgs.greetd.tuigreet}/bin/tuigreet" "--remember" "--remember-user-session" - "--sessions=${config.programs.sway.package}/share/wayland-sessions" + "--sessions=${config.programs.sway.package}/share/wayland-sessions:${config.programs.hyprland.package}/share/wayland-sessions" ]; user = "greeter"; }; diff --git a/machines/common/linux/sway.nix b/machines/common/linux/sway.nix index 2e5dbe1..eae1364 100644 --- a/machines/common/linux/sway.nix +++ b/machines/common/linux/sway.nix @@ -25,6 +25,8 @@ environment.pathsToLink = ["/share/nautilus-python/extensions"]; environment.sessionVariables.NAUTILUS_4_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-4"; + programs.hyprland.enable = true; + programs.sway = { enable = true; package = pkgs.swayfx; @@ -57,12 +59,15 @@ # gcr needed for gnome3 pinentry, managed in Home-Manager gcr ]; - xdg.portal.enable = true; - xdg.portal.wlr.enable = true; - xdg.portal.extraPortals = with pkgs; [ - darkman - xdg-desktop-portal-gtk - ]; + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs; [ + darkman + xdg-desktop-portal-gtk + ]; + xdgOpenUsePortal = true; + }; services = { # mounting diff --git a/pkgs/overlays.nix b/pkgs/overlays.nix index 285733d..98d9ba6 100644 --- a/pkgs/overlays.nix +++ b/pkgs/overlays.nix @@ -6,6 +6,7 @@ (final: prev: let srcs = prev.callPackages ../_sources/generated.nix {}; in { + inherit (inputs.swayfx.packages.${prev.system}) swayfx-unwrapped; starship = prev.starship.overrideAttrs (old: { patches = [ (prev.fetchpatch { @@ -14,9 +15,6 @@ }) ]; }); - swayfx-unwrapped = inputs.swayfx.packages.${prev.system}.swayfx-unwrapped.overrideAttrs (old: { - buildInputs = (prev.lib.remove prev.wlroots old.buildInputs) ++ [prev.wlroots_0_16]; - }); yabai = prev.yabai.overrideAttrs (_: { inherit (srcs.yabai) version src; });