diff --git a/flake.lock b/flake.lock index 3dc1f6a..aa2983a 100644 --- a/flake.lock +++ b/flake.lock @@ -32,6 +32,22 @@ "url": "ssh://forgejo@mizuki.guru/imnyang/api.git" } }, + "arch-hyprland": { + "flake": false, + "locked": { + "lastModified": 1754196291, + "narHash": "sha256-3mhT1GI0onAL/jX/To2Qe2yaybIIX0b/KWq5M0YHFW8=", + "owner": "binnewbs", + "repo": "arch-hyprland", + "rev": "d4b5dd30347607b66e291bb0c41295f563f05941", + "type": "github" + }, + "original": { + "owner": "binnewbs", + "repo": "arch-hyprland", + "type": "github" + } + }, "brew-src": { "flake": false, "locked": { @@ -300,6 +316,26 @@ "type": "github" } }, + "hyprmod": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1787844471, + "narHash": "sha256-AKnBFjkZs4UGZqMT3yIkaCdpvM2fVccU1dVuK5AVZBk=", + "owner": "BlueManCZ", + "repo": "hyprmod", + "rev": "ffd47d804d8996cf3852dbb7ca1c949c424a57fb", + "type": "github" + }, + "original": { + "owner": "BlueManCZ", + "repo": "hyprmod", + "type": "github" + } + }, "imnyang": { "inputs": { "nixpkgs": "nixpkgs_4" @@ -870,12 +906,14 @@ "inputs": { "amiaBot": "amiaBot", "api": "api", + "arch-hyprland": "arch-hyprland", "catppuccin": "catppuccin", "cfwithoutincident": "cfwithoutincident", "codex-app": "codex-app", "concord": "concord", "darwin": "darwin", "home-manager": "home-manager", + "hyprmod": "hyprmod", "imnyang": "imnyang", "millennium": "millennium", "mizuki-nc": "mizuki-nc", diff --git a/flake.nix b/flake.nix index e4fd518..2eab3f2 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,16 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + arch-hyprland = { + url = "github:binnewbs/arch-hyprland"; + flake = false; + }; + + hyprmod = { + url = "github:BlueManCZ/hyprmod"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; codex-app = { diff --git a/hosts/machine/ena/configuration.nix b/hosts/machine/ena/configuration.nix index e479846..a9c4b9a 100644 --- a/hosts/machine/ena/configuration.nix +++ b/hosts/machine/ena/configuration.nix @@ -20,6 +20,7 @@ "${inputs.self}/modules/mizukios/features/system/graphics.nix" "${inputs.self}/modules/mizukios/features/steam.nix" "${inputs.self}/modules/mizukios/features/_1password.nix" + "${inputs.self}/modules/mizukios/features/hyprland.nix" ]; catppuccin.flavor = lib.mkForce "mocha"; diff --git a/hosts/machine/ena/home/config/hyprland.nix b/hosts/machine/ena/home/config/hyprland.nix new file mode 100644 index 0000000..314e1f6 --- /dev/null +++ b/hosts/machine/ena/home/config/hyprland.nix @@ -0,0 +1,261 @@ +{ inputs, lib, pkgs, ... }: +let + assets = "${inputs.self}/assets"; + upstream = "${inputs.arch-hyprland}/.config"; + wallpaper = "${assets}/wallpaper/wallpaper5.png"; + + wallpaperPicker = pkgs.writeShellScript "ena-wallpaper-picker" '' + set -eu + wallpaper="$(${lib.getExe pkgs.rofi} -dmenu -p Wallpaper < <(find "$HOME/Pictures/wallpapers" -maxdepth 1 -type f))" + [ -n "$wallpaper" ] || exit 0 + ${pkgs.awww}/bin/awww img "$wallpaper" --transition-type any + ln -sfn "$wallpaper" "$HOME/.config/hypr/current_wallpaper" + ''; + + hyprlandConfig = '' + source = colors.conf + + monitor = eDP-1, 1920x1080@60, 0x0, 1 + + $terminal = ${pkgs.ghostty}/bin/ghostty + $fileManager = ${pkgs.nautilus}/bin/nautilus + $menu = ${pkgs.vicinae}/bin/vicinae toggle + + exec-once = ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator + exec-once = ${pkgs.waybar}/bin/waybar + exec-once = ${pkgs.awww}/bin/awww-daemon + exec-once = ${pkgs.blueman}/bin/blueman-applet + exec-once = ${pkgs.swaynotificationcenter}/bin/swaync + exec-once = ${pkgs.hyprpolkitagent}/bin/hyprpolkitagent + exec-once = ln -sfn ${wallpaper} ~/.config/hypr/current_wallpaper + exec-once = sleep 1 && ${pkgs.awww}/bin/awww img ${wallpaper} --transition-type any + + env = XCURSOR_SIZE,24 + env = HYPRCURSOR_SIZE,24 + env = XCURSOR_THEME,pjsk-cursor-n25-ena-ani + + source = ~/.config/hypr/configs/tags.conf + source = ~/.config/hypr/configs/looknfeel.conf + source = ~/.config/hypr/configs/UserAnimations.conf + source = ~/.config/hypr/configs/windowrules.conf + source = ~/.config/hypr/configs/keybinds.conf + + dwindle { + pseudotile = true + preserve_split = true + } + + master { + new_status = master + } + + misc { + force_default_wallpaper = 0 + disable_hyprland_logo = true + vfr = true + } + + render { + new_render_scheduling = true + } + + source = ~/.config/hypr/configs/input.conf + source = hyprland-gui.conf + ''; + + keybinds = '' + $mainMod = SUPER + + bind = $mainMod, Return, exec, $terminal + bind = $mainMod SHIFT, Return, exec, [float; size 800 550] $terminal + bind = $mainMod, Q, killactive + bind = CTRL ALT, Delete, exec, hyprctl dispatch exit 0 + bind = $mainMod, E, exec, $fileManager + bind = $mainMod, Space, togglefloating + bind = $mainMod, D, exec, $menu + bind = $mainMod, P, pseudo + bind = $mainMod, J, togglesplit + bind = $mainMod, L, exec, ${pkgs.hyprlock}/bin/hyprlock + bind = $mainMod SHIFT, F, fullscreen + bind = $mainMod SHIFT, S, exec, mkdir -p "$HOME/Pictures/Screenshots" && ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" "$HOME/Pictures/Screenshots/$(date +%Y-%m-%d-%H%M%S).png" + bind = $mainMod, W, exec, ${wallpaperPicker} + bind = $mainMod, H, exec, pkill -SIGUSR1 waybar + bind = $mainMod SHIFT, E, exec, $terminal -e ${pkgs.yazi}/bin/yazi + bind = $mainMod CTRL, G, exec, ${inputs.hyprmod.packages.${pkgs.system}.default}/bin/hyprmod + + bind = $mainMod, left, movefocus, l + bind = $mainMod, right, movefocus, r + bind = $mainMod, up, movefocus, u + bind = $mainMod, down, movefocus, d + + bind = $mainMod CTRL, left, movewindow, l + bind = $mainMod CTRL, right, movewindow, r + bind = $mainMod CTRL, up, movewindow, u + bind = $mainMod CTRL, down, movewindow, d + + binde = $mainMod SHIFT, left, resizeactive, -50 0 + binde = $mainMod SHIFT, right, resizeactive, 50 0 + binde = $mainMod SHIFT, up, resizeactive, 0 -50 + binde = $mainMod SHIFT, down, resizeactive, 0 50 + + bind = $mainMod, 1, workspace, 1 + bind = $mainMod, 2, workspace, 2 + bind = $mainMod, 3, workspace, 3 + bind = $mainMod, 4, workspace, 4 + bind = $mainMod, 5, workspace, 5 + bind = $mainMod, 6, workspace, 6 + bind = $mainMod, 7, workspace, 7 + bind = $mainMod, 8, workspace, 8 + bind = $mainMod, 9, workspace, 9 + bind = $mainMod, 0, workspace, 10 + + bind = $mainMod SHIFT, 1, movetoworkspace, 1 + bind = $mainMod SHIFT, 2, movetoworkspace, 2 + bind = $mainMod SHIFT, 3, movetoworkspace, 3 + bind = $mainMod SHIFT, 4, movetoworkspace, 4 + bind = $mainMod SHIFT, 5, movetoworkspace, 5 + bind = $mainMod SHIFT, 6, movetoworkspace, 6 + bind = $mainMod SHIFT, 7, movetoworkspace, 7 + bind = $mainMod SHIFT, 8, movetoworkspace, 8 + bind = $mainMod SHIFT, 9, movetoworkspace, 9 + bind = $mainMod SHIFT, 0, movetoworkspace, 10 + + bind = $mainMod, mouse_down, workspace, e+1 + bind = $mainMod, mouse_up, workspace, e-1 + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + + bindel = , XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ + bindel = , XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + bindel = , XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + bindel = , XF86AudioMicMute, exec, ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle + bindel = , XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%+ + bindel = , XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl set 10%- + + bindl = , XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next + bindl = , XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause + bindl = , XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause + bindl = , XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous + ''; + + # ponytail: keep the upstream core rice only; add Matugen/extra Waybar modules when needed. + waybarConfig = builtins.toJSON { + layer = "top"; + position = "top"; + spacing = 3; + margin-top = 3; + margin-left = 8; + margin-right = 8; + modules-left = [ "clock" "tray" ]; + modules-center = [ "hyprland/workspaces" ]; + modules-right = [ "network" "pulseaudio" "battery" "custom/power" ]; + clock = { + interval = 1; + format = " {:%I:%M %p}"; + format-alt = " {:%H:%M  %Y, %d %B, %A}"; + tooltip-format = "{calendar}"; + }; + network = { + format-wifi = " {essid}"; + format-ethernet = "󰈀 {ifname}"; + format-disconnected = "󰤮"; + tooltip-format = "{ifname}: {ipaddr}/{cidr}"; + }; + pulseaudio = { + format = "{icon} {volume}%"; + format-muted = "󰖁 muted"; + format-icons = [ "" "" "" ]; + on-click = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + }; + battery = { + states = { warning = 30; critical = 15; }; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-icons = [ "󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; + }; + "custom/power" = { + format = "⏻"; + on-click = "${pkgs.wlogout}/bin/wlogout"; + tooltip = true; + tooltip-format = "Logout Menu"; + }; + }; +in +{ + home.packages = with pkgs; [ + awww + blueman + brightnessctl + grim + hyprpolkitagent + libnotify + nautilus + networkmanagerapplet + playerctl + rofi + slurp + swaynotificationcenter + waybar + wireplumber + wlogout + yazi + ]; + + home.file."Pictures/wallpapers" = { + source = "${assets}/wallpaper"; + recursive = true; + }; + + xdg.configFile = { + "hypr/hyprland.conf".text = hyprlandConfig; + "hypr/colors.conf".source = "${upstream}/hypr/colors.conf"; + "hypr/configs/tags.conf".source = "${upstream}/hypr/configs/tags.conf"; + "hypr/configs/looknfeel.conf".source = "${upstream}/hypr/configs/looknfeel.conf"; + "hypr/configs/UserAnimations.conf".source = "${upstream}/hypr/configs/UserAnimations.conf"; + "hypr/configs/windowrules.conf".source = "${upstream}/hypr/configs/windowrules.conf"; + "hypr/configs/input.conf".source = "${upstream}/hypr/configs/input.conf"; + "hypr/configs/keybinds.conf".text = keybinds; + "hypr/hypridle.conf".source = "${upstream}/hypr/hypridle.conf"; + "hypr/hyprlock.conf".source = "${upstream}/hypr/hyprlock.conf"; + "waybar/config".text = waybarConfig; + "waybar/colors.css".source = "${upstream}/waybar/colors.css"; + "waybar/style.css".source = "${upstream}/waybar/style/bintang default.css"; + "wlogout/layout".text = '' + { + "label" : "lock", + "action" : "${pkgs.hyprlock}/bin/hyprlock", + "text" : "Lock", + "keybind" : "l" + } + { + "label" : "reboot", + "action" : "systemctl reboot", + "text" : "Reboot", + "keybind" : "r" + } + { + "label" : "shutdown", + "action" : "systemctl poweroff", + "text" : "Shutdown", + "keybind" : "s" + } + { + "label" : "logout", + "action" : "loginctl kill-session $XDG_SESSION_ID", + "text" : "Logout", + "keybind" : "e" + } + { + "label" : "suspend", + "action" : "systemctl suspend", + "text" : "Suspend", + "keybind" : "u" + } + ''; + "wlogout/style.css".source = "${upstream}/wlogout/style.css"; + "wlogout/icons" = { + source = "${upstream}/wlogout/icons"; + recursive = true; + }; + }; +} diff --git a/hosts/machine/ena/home/config/plasma.nix b/hosts/machine/ena/home/config/plasma.nix deleted file mode 100644 index 9bb9f7b..0000000 --- a/hosts/machine/ena/home/config/plasma.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ inputs, lib, ... }: -let - assets = "${inputs.self}/assets"; -in -{ - imports = [ "${inputs.self}/modules/home/plasma.nix" ]; - - programs.plasma.workspace.cursor = { - theme = "pjsk-cursor-n25-ena-ani"; - }; - - programs.plasma.workspace.colorScheme = lib.mkForce "KawaDark"; - - programs.plasma.workspace.wallpaper = "${assets}/wallpaper/wallpaper5.png"; - - programs.plasma.kscreenlocker.appearance.wallpaper = "${assets}/wallpaper/wallpaper3.png"; -} diff --git a/hosts/machine/ena/home/default.nix b/hosts/machine/ena/home/default.nix index 8a38cd3..e2f8861 100644 --- a/hosts/machine/ena/home/default.nix +++ b/hosts/machine/ena/home/default.nix @@ -35,7 +35,7 @@ "${inputs.self}/modules/home/vicinae.nix" ./config/shell.nix - ./config/plasma.nix + ./config/hyprland.nix ]; programs.btop.settings.color_theme = lib.mkForce "Mizuki Dark"; diff --git a/hosts/machine/ena/home/packages.nix b/hosts/machine/ena/home/packages.nix index 738d708..29f5555 100644 --- a/hosts/machine/ena/home/packages.nix +++ b/hosts/machine/ena/home/packages.nix @@ -9,6 +9,6 @@ with pkgs; # inputs.waterfox.packages.${pkgs.system}.waterfox gnome-network-displays element-desktop - inputs.imnyang.packages.${pkgs.system}.figma-linux + inputs.hyprmod.packages.${pkgs.system}.default # hoffice ] diff --git a/modules/mizukios/features/hyprland.nix b/modules/mizukios/features/hyprland.nix new file mode 100644 index 0000000..c94a629 --- /dev/null +++ b/modules/mizukios/features/hyprland.nix @@ -0,0 +1,15 @@ +{ lib, ... }: +{ + programs.hyprland = { + enable = true; + withUWSM = true; + }; + + programs.hyprlock.enable = true; + + services.displayManager.defaultSession = "hyprland-uwsm"; + + # desktop.nix enables Plasma for the other machines; ena uses Hyprland. + services.desktopManager.plasma6.enable = lib.mkForce false; + xdg.portal.config.common.default = lib.mkForce "hyprland"; +}