diff --git a/flake.lock b/flake.lock index 68f335b..9b990c7 100644 --- a/flake.lock +++ b/flake.lock @@ -319,7 +319,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1694529238, @@ -337,7 +337,7 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_7" + "systems": "systems_8" }, "locked": { "lastModified": 1681202837, @@ -355,7 +355,7 @@ }, "flake-utils_6": { "inputs": { - "systems": "systems_8" + "systems": "systems_9" }, "locked": { "lastModified": 1710146030, @@ -413,6 +413,137 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716576411, + "narHash": "sha256-FIN1wMoyePBTtibCbaeJaoKNLuAYIGwLCWAYC1DJanw=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "57298fc4f13c807e50ada2c986a3114b7fc2e621", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprlang": "hyprlang", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_4", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1717605046, + "narHash": "sha256-zzdMmUNJCPY1KqVjzpukHOecae1AiAzwmBN5hq7jM2U=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "c95845b1488b4bd63e901cbdc4cb68c27a45971b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "xdph", + "nixpkgs" + ], + "systems": [ + "hyprland", + "xdph", + "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": 1716473782, + "narHash": "sha256-+qLn4lsHU6iL3+HTo1gTQ1tWzet8K9h+IfVemzEQZj8=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "87d5d984109c839482b88b4795db073eb9ed446f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716058375, + "narHash": "sha256-CwjWoVnBZE5SBpRx9dgSQGCr4Goxyfcyv3zZbOhVqzk=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "3afed4364790aebe0426077631af1e164a9650cc", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -640,6 +771,7 @@ "dhist": "dhist", "dzgui-nix": "dzgui-nix", "home-manager": "home-manager_2", + "hyprland": "hyprland", "nix-index-database": "nix-index-database", "nix-software-center": "nix-software-center", "nixos-conf-editor": "nixos-conf-editor", @@ -765,16 +897,16 @@ }, "systems_4": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", "type": "github" } }, @@ -838,6 +970,21 @@ "type": "github" } }, + "systems_9": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tlauncher": { "inputs": { "flake-utils": "flake-utils_5", @@ -861,7 +1008,7 @@ }, "utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1689068808, @@ -879,7 +1026,7 @@ }, "utils_2": { "inputs": { - "systems": "systems_6" + "systems": "systems_7" }, "locked": { "lastModified": 1709126324, @@ -915,6 +1062,36 @@ "repo": "wl-crosshair", "type": "github" } + }, + "xdph": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1716290197, + "narHash": "sha256-1u9Exrc7yx9qtES2brDh7/DDZ8w8ap1nboIOAtCgeuM=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "91e48d6acd8a5a611d26f925e51559ab743bc438", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ae7eea7..fd2fc09 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + ranger-icons.url = "github:alexanderjeurissen/ranger_devicons"; ranger-icons.flake = false; @@ -83,10 +88,12 @@ ./system/secrets.nix ./system/specialisation.nix ./system/greetd.nix - { login-manager.greetd.enable = desktop == "sway"; } + { login-manager.greetd.enable = desktop == "sway" || desktop == "hyprland"; } inputs.agenix.nixosModules.default + inputs.hyprland.nixosModules.default inputs.dzgui-nix.nixosModules.default + { programs.hyprland.enable = (desktop == "hyprland"); } inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/overlays/default.nix b/overlays/default.nix index e83ed4c..3de7b1a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -2,6 +2,7 @@ rec { all = [ scripts + sway themes new-packages patches @@ -10,6 +11,8 @@ rec { scripts = (import ../scripts); + sway = (import ./sway.nix); + themes = ( final: prev: { papirus_red = (final.papirus-icon-theme.override { color = "red"; }); diff --git a/overlays/sway.nix b/overlays/sway.nix new file mode 100644 index 0000000..c6d8d5e --- /dev/null +++ b/overlays/sway.nix @@ -0,0 +1,19 @@ +(pkgs: _: { + # bash script to let dbus know about important env variables and + # propogate them to relevent services run at the end of sway config + # see + # https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist + # note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts + # some user services to make sure they have the correct environment variables + dbus-sway-environment = pkgs.writeTextFile { + name = "dbus-sway-environment"; + destination = "/bin/dbus-sway-environment"; + executable = true; + text = '' + systemctl --user import-environment + dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway SWAYSOCK + # systemctl --user stop pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr + # systemctl --user start pipewire wireplumber xdg-desktop-portal xdg-desktop-portal-wlr + ''; + }; +}) diff --git a/system/greetd.nix b/system/greetd.nix index 2b5f22f..b152c72 100644 --- a/system/greetd.nix +++ b/system/greetd.nix @@ -45,6 +45,7 @@ in services.greetd = let greetd_main_script = pkgs.writeShellScriptBin "main" '' + ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment export XDG_CURRENT_DESKTOP=sway GTK_THEME="${theme.gtk_theme}" XCURSOR_THEME="${theme.cursor_theme}" ${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c ${desktop} swaymsg exit diff --git a/system/nix.nix b/system/nix.nix index c91e362..ac8a8be 100644 --- a/system/nix.nix +++ b/system/nix.nix @@ -30,6 +30,7 @@ in "https://cache.nixos.org" "https://nix-community.cachix.org" # "http://nixcache.lelgenio.1337.cx:5000" + "https://hyprland.cachix.org" "https://lelgenio.cachix.org" "https://wegank.cachix.org" "https://snowflakeos.cachix.org/" @@ -38,6 +39,7 @@ in "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" # "nixcache.lelgenio.1337.cx:zxCfx7S658llDgAUG0JVyNrlAdFVvPniSdDOkvfTPS8=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "lelgenio.cachix.org-1:W8tMlmDFLU/V+6DlChXjekxoHZpjgVHZpmusC4cueBc=" "wegank.cachix.org-1:xHignps7GtkPP/gYK5LvA/6UFyz98+sgaxBSy7qK0Vs=" "snowflakeos.cachix.org-1:gXb32BL86r9bw1kBiw9AJuIkqN49xBvPd1ZW8YlqO70=" diff --git a/user/home.nix b/user/home.nix index 0fe2422..4efdd01 100644 --- a/user/home.nix +++ b/user/home.nix @@ -15,6 +15,7 @@ ./vscode ./fish ./firefox.nix + ./hyprland.nix ./alacritty.nix ./git.nix ./ssh.nix @@ -40,6 +41,7 @@ ./gnome.nix ./thunar.nix ./xdg-dirs.nix + inputs.hyprland.homeManagerModules.default inputs.nix-index-database.hmModules.nix-index ../settings ]; diff --git a/user/hyprland.nix b/user/hyprland.nix new file mode 100644 index 0000000..721e14b --- /dev/null +++ b/user/hyprland.nix @@ -0,0 +1,136 @@ +{ + config, + pkgs, + lib, + ... +}: +{ + config = lib.mkIf (config.my.desktop == "hyprland") { + wayland.windowManager.hyprland = { + enable = false; + extraConfig = '' + monitor=,preferred,auto,1 + + input { + kb_file= + kb_layout=us(colemak) + kb_variant= + kb_model= + kb_options= + kb_rules= + + follow_mouse=1 + + touchpad { + natural_scroll=no + } + } + + general { + sensitivity=1.0 # for mouse cursor + main_mod=SUPER + + gaps_in=5 + gaps_out=10 + border_size=2 + col.active_border=0xffF44336 + col.inactive_border=0x66333333 + + apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse) + + damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer + } + + decoration { + rounding=5 + blur=1 + blur_size=3 # minimum 1 + blur_passes=1 # minimum 1, more passes = more resource intensive. + # Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts. + # if you want heavy blur, you need to up the blur_passes. + # the more passes, the more you can up the blur_size without noticing artifacts. + } + + animations { + enabled=1 + animation=windows,1,7,default + animation=border,1,10,default + animation=fade,1,10,default + animation=workspaces,1,6,default + } + + dwindle { + pseudotile=0 # enable pseudotiling on dwindle + } + + gestures { + workspace_swipe=no + } + + # example window rules + # for windows named/classed as abc and xyz + #windowrule=move 69 420,abc + #windowrule=size 420 69,abc + #windowrule=tile,xyz + #windowrule=float,abc + #windowrule=pseudo,abc + #windowrule=monitor 0,xyz + + # example binds + bind=SUPER,Q,exec,kitty + bind=SUPER,RETURN,exec,alacritty + bind=SUPER,x,killactive, + bind=SUPER,M,exit, + # bind=SUPER,E,exec,dolphin + bind=SUPER,V,togglefloating, + bind=SUPER,s,exec,wlauncher + bind=SUPER,P,pseudo, + + bind=SUPER,f,fullscreen + + bind=SUPER,n,movefocus,l + bind=SUPER,o,movefocus,r + bind=SUPER,i,movefocus,u + bind=SUPER,e,movefocus,d + + bind=SUPER,left,movefocus,l + bind=SUPER,right,movefocus,r + bind=SUPER,up,movefocus,u + bind=SUPER,down,movefocus,d + + bind=SUPER,1,workspace,1 + bind=SUPER,2,workspace,2 + bind=SUPER,3,workspace,3 + bind=SUPER,4,workspace,4 + bind=SUPER,5,workspace,5 + bind=SUPER,6,workspace,6 + bind=SUPER,7,workspace,7 + bind=SUPER,8,workspace,8 + bind=SUPER,9,workspace,9 + bind=SUPER,0,workspace,10 + + bind=ALT,1,movetoworkspace,1 + bind=ALT,2,movetoworkspace,2 + bind=ALT,3,movetoworkspace,3 + bind=ALT,4,movetoworkspace,4 + bind=ALT,5,movetoworkspace,5 + bind=ALT,6,movetoworkspace,6 + bind=ALT,7,movetoworkspace,7 + bind=ALT,8,movetoworkspace,8 + bind=ALT,9,movetoworkspace,9 + bind=ALT,0,movetoworkspace,10 + + bind=SUPER,u,workspace,e-1 + bind=SUPER,y,workspace,e+1 + + bind=SUPER,mouse_down,workspace,e-1 + bind=SUPER,mouse_up,workspace,e+1 + ''; + }; + home.file.".config/eww".source = ./eww; + home.packages = with pkgs; [ + eww-wayland + jq + ]; + }; +} diff --git a/user/sway/default.nix b/user/sway/default.nix index 988453d..0ad5a6b 100644 --- a/user/sway/default.nix +++ b/user/sway/default.nix @@ -101,6 +101,7 @@ in }; extraConfig = '' for_window [title=.*] inhibit_idle fullscreen + exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment exec swaymsg workspace 2 exec_always systemctl --user restart waybar.service exec corectrl --minimize-systray