diff --git a/common/hypridle.nix b/common/hypridle.nix deleted file mode 100644 index 648f782..0000000 --- a/common/hypridle.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - services.hypridle = { - enable = true; - # TODO: find commands to turn on/off monitors - }; -} diff --git a/common/hyprland-vnc.nix b/common/hyprland-vnc.nix deleted file mode 100644 index 26afcbe..0000000 --- a/common/hyprland-vnc.nix +++ /dev/null @@ -1,115 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - # these are necessary for the config to function correctly - imports = [ - ./kitty.nix - ./waybar-vnc.nix - ./wofi.nix - ]; - home.packages = with pkgs; [ - hyprland - - # I always want these with hyprland anyways - dunst - wl-clipboard - - slurp - grim - ]; - wayland.windowManager.hyprland = { - enable = true; - settings = { - monitor = [ - "DP-3,2560x1440@144,0x0,1" - "DP-2,disable" - ]; - windowrulev2 = [ - "opacity 0.8 0.8,class:^(kitty)$" - "stayfocused,class:^(wofi)$" - ]; - env = [ - "WLR_NO_HARDWARE_CURSORS,1" - ]; - exec-once = [ - "waybar" - "wayvnc --output=DP-3 0.0.0.0 5909" - "dunst" - "hyprctl dispatcher focusmonitor 1" - ]; - general = { - sensitivity = "1.2"; - gaps_in = "2"; - gaps_out = "3"; - border_size = "3"; - "col.active_border"="0xff950fad"; - "col.inactive_border"="0xff26052e"; - }; - decoration = { - rounding = "6"; - active_opacity = "1"; - inactive_opacity = "1"; - }; - workspace = [ - "HEADLESS-2,1" - ]; - animations = { - enabled = "1"; - animation = [ - "windows,1,2,default" - "border,1,10,default" - "fade,0,5,default" - "workspaces,1,4,default" - ]; - }; - "$mod" = "SUPER"; - bind = [ - "$mod,Return,exec,kitty" - "$mod,tab,cyclenext" - "SUPERSHIFT,Q,killactive" - "$mod,SPACE,exec,wofi-launch" - "$mod,P,exec,wofi-power" - "SUPERSHIFT,m,exit" - "$mod,H,movefocus,l" - "$mod,J,movefocus,u" - "$mod,K,movefocus,d" - "$mod,L,movefocus,r" - "SUPERSHIFT,H,movewindow,l" - "SUPERSHIFT,J,movewindow,u" - "SUPERSHIFT,K,movewindow,d" - "SUPERSHIFT,L,movewindow,r" - "$mod,F,togglefloating" - "$mod,X,togglespecialworkspace" - "SUPERSHIFT,X,movetoworkspace,special" - "$mod,Print,exec,grim - | wl-copy && notify-send 'Screenshot Copied to Clipboard'" - "SUPERSHIFT,S,exec,slurp | grim -g - /tmp/photo && wl-copy < /tmp/photo && notify-send 'Screenshot Copied to Clipboard'" - "$mod,f11,fullscreen,0" - ",XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%-" - ",XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%+" - ",XF86AudioMute,exec,wpctl set-mute @DEFAULT_SINK@ toggle" - ",XF86AudioPlay,exec,playerctl play-pause" - ",XF86AudioPrev,exec,playerctl previous" - ",XF86AudioNext,exec,playerctl next" - ] - ++ ( - builtins.concatLists (builtins.genList ( - x: let - ws = let - c = (x+1); - in - builtins.toString (x); - in [ - "$mod,${ws},workspace,${ws}" - "ALT,${ws},movetoworkspace,${ws}" - ] - ) - 10) - ); - bindm = [ - "$mod,mouse:272,movewindow" - "$mod,mouse:273,resizewindow" - ]; - }; - }; - -} diff --git a/common/hyprland.nix b/common/hyprland.nix index 49638fe..fd1bebe 100644 --- a/common/hyprland.nix +++ b/common/hyprland.nix @@ -1,18 +1,16 @@ { config, pkgs, inputs, ... }: - +let + hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; +in { # these are necessary for the config to function correctly imports = [ ./kitty.nix ./waybar.nix ./wofi.nix - # ./hypridle.nix # TODO: find out why these bitches not work - # ./hyprlock.nix ./dunst.nix ]; home.packages = with pkgs; [ - hyprland - # I always want these with hyprland anyways libnotify # to enable the notify-send command wl-clipboard @@ -24,9 +22,13 @@ playerctl ]; + + xdg.portal.configPackages = [ hyprland ]; + services.playerctld.enable = true; wayland.windowManager.hyprland = { enable = true; + package = hyprland; settings = { monitor = [ "DP-3,2560x1440@360,2560x0,1" @@ -122,5 +124,4 @@ ]; }; }; - } diff --git a/common/hyprlock.nix b/common/hyprlock.nix deleted file mode 100644 index 076f805..0000000 --- a/common/hyprlock.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - programs.hyprlock = { - enable = true; - # TODO: find commands to turn on/off monitors - }; -} diff --git a/common/waybar-vnc.nix b/common/waybar-vnc.nix deleted file mode 100644 index 78d4e40..0000000 --- a/common/waybar-vnc.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - home.packages = with pkgs; [ - waybar - font-awesome - ]; - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 28; - output = [ - "HEADLESS-2" - ]; - modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "custom/spotify" ]; - modules-center = [ "hyprland/window" "clock" ]; - modules-right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; - "clock" = { - tooltip-format = "{:%Y %B}\n\n{calendar}"; - interval = 1; - format = "{:%H:%M:%S}"; - format-alt = ":%Y-%m-%d %H:%M:%S}"; - on-click-middle = "gnome-clocks"; - calendar = { - weeks-pos = "left"; - format = { - today = "{}"; - weeks = "{}"; - }; - }; - }; - "tray".spacing = 10; - "cpu" = { - format = "cpu: {usage}%"; - tooltip = false; - }; - "memory" = { - format = "mem: {}%"; - }; - "wireplumber" = { - format = "{volume}%"; - }; - "custom/vpn" = { - format = "VPN"; - exec = "echo '{\"class\": \"connected\"}'"; - exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; - return-type = "json"; - interval = 5; - }; - "temperature" = { - thermal-zone = 2; - hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; - critical-threshold = 80; - format = "{temperatureC}°C {icon}"; - format-icons = ["" "" ""]; - }; - "custom/poweroff" = { - format = ""; - on-click = "wofi-power"; - on-click-right = "swaylock"; - }; - "network" = { - format-wifi = "{essid} ({signalStrength}%) 󰖩"; - format-ethernet = "{ipaddr}/{cidr} 󰛳"; - tooltip-format = "{ifname} via {gwaddr} 󰛳"; - format-linked = "{ifname} (No IP) 󰛳"; - format-disconnected = "Disconnected "; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "custom/pronouns" = { - format = "{}"; - exec = "${config.xdg.configHome}/waybar/pronouns"; - interval = 5; - }; - "hyprland/workspaces" = { - format = "{name}"; - on-click = "activate"; - sort-by = "id"; - }; - }; - }; - style = ../styles/waybar.css; - }; - -} diff --git a/common/waybar.nix b/common/waybar.nix index fc50528..4abf1c4 100644 --- a/common/waybar.nix +++ b/common/waybar.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ config, pkgs, lib, ... }: { home.packages = with pkgs; [ @@ -6,7 +6,7 @@ font-awesome ]; programs.waybar = { - enable = true; + enable = lib.mkDefault true; settings = { mainBar = { layer = "top"; diff --git a/common/wofi.nix b/common/wofi.nix index afd3999..13b2458 100644 --- a/common/wofi.nix +++ b/common/wofi.nix @@ -10,21 +10,16 @@ '') (writeShellScriptBin "wofi-power" '' lock="Lock" - logout="Logout" poweroff="Poweroff" reboot="Reboot" sleep="Suspend" - selected_option=$(echo -e "$lock\n$logout\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") + selected_option=$(echo -e "$lock\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") if [ "$selected_option" == "$lock" ] then echo "lock" swaylock - elif [ "$selected_option" == "$logout" ] - then - echo "logout" - loginctl terminate-user `whoami` elif [ "$selected_option" == "$poweroff" ] then echo "poweroff" diff --git a/flake.lock b/flake.lock index 06146aa..43623ed 100644 --- a/flake.lock +++ b/flake.lock @@ -131,7 +131,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1701680307, @@ -149,7 +149,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_5" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -228,41 +228,98 @@ "type": "github" } }, - "hypridle": { + "hyprcursor": { "inputs": { "hyprlang": "hyprlang", "nixpkgs": [ + "hyprland", "nixpkgs" ], - "systems": "systems" + "systems": [ + "hyprland", + "systems" + ] }, "locked": { - "lastModified": 1710180874, - "narHash": "sha256-ZSn3wXQuRz36Ta/L+UCFKuUVG6QpwK2QmRkPjpQprU4=", + "lastModified": 1711466786, + "narHash": "sha256-sArxGyUBiCA1in+q6t0QqT+ZJiZ1PyBp7cNPKLmREM0=", "owner": "hyprwm", - "repo": "hypridle", - "rev": "4395339a2dc410bcf49f3e24f9ed3024fdb25b0a", + "repo": "hyprcursor", + "rev": "d3876f34779cc03ee51e4aafc0d00a4f187c7544", "type": "github" }, "original": { "owner": "hyprwm", - "repo": "hypridle", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang_2", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1712160491, + "narHash": "sha256-OQmbZnMPex/66HmyD7SKN5eKcyLR6ZCzHn/i/YF61qE=", + "owner": "hyprwm", + "repo": "hyprland", + "rev": "93915502d2677b70382b7cba09620b445f6b832e", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland", + "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": [ - "hypridle", + "hyprland", + "hyprcursor", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1708212860, - "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", "type": "github" }, "original": { @@ -274,10 +331,13 @@ "hyprlang_2": { "inputs": { "nixpkgs": [ - "hyprlock", + "hyprland", "nixpkgs" ], - "systems": "systems_2" + "systems": [ + "hyprland", + "systems" + ] }, "locked": { "lastModified": 1711250455, @@ -293,28 +353,6 @@ "type": "github" } }, - "hyprlock": { - "inputs": { - "hyprlang": "hyprlang_2", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_3" - }, - "locked": { - "lastModified": 1711884603, - "narHash": "sha256-y1Om75muuJcEoLd/FOYGIZ5/ja/Mc4iBX/9S7vWF0C8=", - "owner": "hyprwm", - "repo": "hyprlock", - "rev": "071ebcefb9070e4397d75103f5f535b58dacf250", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprlock", - "type": "github" - } - }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -445,8 +483,7 @@ "automapaper": "automapaper", "disko": "disko", "home-manager": "home-manager", - "hypridle": "hypridle", - "hyprlock": "hyprlock", + "hyprland": "hyprland", "nix-colors": "nix-colors", "nixpkgs": "nixpkgs", "nixvim": "nixvim" @@ -484,16 +521,16 @@ }, "systems_3": { "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default-linux", + "repo": "default", "type": "github" } }, @@ -512,18 +549,55 @@ "type": "github" } }, - "systems_5": { + "wlroots": { + "flake": false, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "host": "gitlab.freedesktop.org", + "lastModified": 1709983277, + "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1709299639, + "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "2d2fb547178ec025da643db57d40a971507b82fe", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", "type": "github" } } diff --git a/flake.nix b/flake.nix index e10e03d..5a7c802 100644 --- a/flake.nix +++ b/flake.nix @@ -25,14 +25,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - hypridle = { - url = "github:hyprwm/hypridle"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - hyprlock = { - url = "github:hyprwm/hyprlock"; - inputs.nixpkgs.follows = "nixpkgs"; + hyprland = { + url = "github:hyprwm/hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; }; disko = { @@ -42,7 +37,7 @@ }; - outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, ... }@inputs: + outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, ... }@inputs: { nixosConfigurations = { default = nixpkgs.lib.nixosSystem { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 8648b59..000e77d 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -62,17 +62,22 @@ }; services.xserver = { - enable = true; - displayManager = { - sddm.enable = true; - defaultSession = "hyprland"; - }; xkb = { layout = "us"; variant = "intl"; }; }; + services.greetd = { + enable = true; + settings = rec { + initial_session = { + command = "${pkgs.hyprland}/bin/Hyprland"; + user = "noa"; + }; + default_session = initial_session; + }; + }; # Configure console keymap console.keyMap = "us-acentos"; @@ -108,7 +113,6 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - sddm git zsh ]; @@ -135,6 +139,7 @@ programs.hyprland = { enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; portalPackage = pkgs.xdg-desktop-portal-hyprland; }; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 40b8b52..f98be27 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -5,7 +5,7 @@ [ inputs.nixvim.homeManagerModules.nixvim ../../common/zsh.nix - ../../common/hyprland.nix + ../../modules/hyprland.nix ../../common/git.nix ../../common/nvim/nvim.nix ../../common/discord/discord.nix @@ -29,6 +29,8 @@ nixpkgs.config.allowUnfree = true; + modules.hyprland.enable = true; + # The home.packages option allows you to install Nix packages into your # environment. home.packages = with pkgs; [ @@ -107,7 +109,6 @@ xdg.portal = { enable = true; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - configPackages = [ pkgs.hyprland ]; }; dconf = { diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..310a8c9 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,141 @@ +{ config, lib, pkgs, inputs, ... }: +let + hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; + cfg = config.modules.hyprland; +in +{ + options = { + cfg.enable = lib.mkEnableOption "enable hyprland"; + # TODO: make custom terminal support work better + # cfg.terminal = lib.mkOption { + # type = lib.types.package; + # default = pkgs.kitty; + # description = "What terminal emulator should be used in hyprland"; + # }; + }; + + config = lib.mkIf cfg.enable { + # these are necessary for the config to function correctly + imports = [ + ./kitty.nix + ./waybar.nix + ./wofi.nix + ./dunst.nix + ]; + home.packages = with pkgs; [ + # I always want these with hyprland anyways + libnotify # to enable the notify-send command + wl-clipboard + + slurp + grim + + hypridle # TODO: remove when fixed with config + playerctl + ]; + + programs.waybar.enable = true; + + xdg.portal.configPackages = [ hyprland ]; + + services.playerctld.enable = true; + wayland.windowManager.hyprland = { + enable = true; + package = hyprland; + settings = { + monitor = [ + "DP-3,2560x1440@360,2560x0,1" + "DP-2,2560x1440@144,0x0,1" + ]; + windowrulev2 = [ + "opacity 1.0 0.6,class:^(kitty)$" + "stayfocused,class:^(wofi)$" + ]; + env = [ + "WLR_NO_HARDWARE_CURSORS,1" + ]; + exec-once = [ + "waybar" + "dunst" + "automapaper -C ${config.xdg.configHome}/automapaper/config.toml" + "automapaper -C ${config.xdg.configHome}/automapaper/config2nd.toml" + "hyprctl dispatcher focusmonitor 1" + "hypridle" + ]; + general = { + sensitivity = "1.2"; + gaps_in = "2"; + gaps_out = "3"; + border_size = "3"; + "col.active_border"="0xff950fad"; + "col.inactive_border"="0xff26052e"; + }; + misc = { + key_press_enables_dpms = true; + }; + decoration = { + rounding = "6"; + active_opacity = "1"; + inactive_opacity = "1"; + }; + workspace = [ + "DP-3,1" + "DP-2,2" + ]; + animations = { + enabled = "1"; + animation = [ + "windows,1,2,default" + "border,1,10,default" + "fade,0,5,default" + "workspaces,1,4,default" + ]; + }; + "$mod" = "SUPER"; + bind = [ + "$mod,Return,exec,${pkgs.kitty.pname}" + "$mod,tab,cyclenext" + "SUPERSHIFT,Q,killactive" + "$mod,SPACE,exec,wofi-launch" + "$mod,P,exec,wofi-power" + "SUPERSHIFT,m,exit" + "$mod,H,movefocus,l" + "$mod,J,movefocus,u" + "$mod,K,movefocus,d" + "$mod,L,movefocus,r" + "SUPERSHIFT,H,movewindow,l" + "SUPERSHIFT,J,movewindow,u" + "SUPERSHIFT,K,movewindow,d" + "SUPERSHIFT,L,movewindow,r" + "$mod,F,togglefloating" + "$mod,X,togglespecialworkspace" + "SUPERSHIFT,X,movetoworkspace,special" + "$mod,Print,exec,grim - | wl-copy && notify-send 'Screenshot Copied to Clipboard'" + "SUPERSHIFT,S,exec,slurp | grim -g - /tmp/photo && wl-copy < /tmp/photo && notify-send 'Screenshot Copied to Clipboard'" + "$mod,f11,fullscreen,0" + ",XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%-" + ",XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%+" + ",XF86AudioMute,exec,wpctl set-mute @DEFAULT_SINK@ toggle" + ",XF86AudioPlay,exec,playerctl play-pause" + ",XF86AudioPrev,exec,playerctl previous" + ",XF86AudioNext,exec,playerctl next" + ] + ++ ( + builtins.concatLists (builtins.genList ( + x: let + ws = builtins.toString (x); + in [ + "$mod,${ws},workspace,${ws}" + "ALT,${ws},movetoworkspace,${ws}" + ] + ) + 10) + ); + bindm = [ + "$mod,mouse:272,movewindow" + "$mod,mouse:273,resizewindow" + ]; + }; + }; + }; +}