From 01d509ad199c00ad29172dc1a7f6eaeabb0c486c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Gro=C3=9Fmann?= Date: Wed, 8 Mar 2023 22:11:46 +0900 Subject: [PATCH] WIP: Started Hyprland impl --- configuration.nix | 9 ++- data/hyprland/config | 18 +++++ flake.lock | 114 ++++++++++++++++++++++++++-- flake.nix | 5 ++ modules/hyprland.nix | 8 ++ modules/nix.nix | 2 + users/common/default.nix | 1 + users/common/graphical/hyprland.nix | 7 ++ users/common/touchegg-settings.nix | 2 +- users/default.nix | 1 - users/patrick.nix | 2 +- 11 files changed, 156 insertions(+), 13 deletions(-) create mode 100644 data/hyprland/config create mode 100644 modules/hyprland.nix create mode 100644 users/common/graphical/hyprland.nix diff --git a/configuration.nix b/configuration.nix index 4a3ca20..de13b00 100644 --- a/configuration.nix +++ b/configuration.nix @@ -20,6 +20,7 @@ in { ./modules/networking.nix ./modules/nix.nix ./modules/xserver.nix + ./modules/hyprland.nix ]; # Use the systemd-boot EFI boot loader. @@ -95,6 +96,8 @@ in { # xournalpp needs this or else it will crash gnome3.adwaita-icon-theme ]; + # HM zsh needs this or else the startup order is fucked + # and env variables will be loaded incorrectly programs.zsh.enable = true; programs.steam = { @@ -108,8 +111,6 @@ in { }; }; - # List services that you want to enable: - # Enable the OpenSSH daemon. services.openssh = { enable = true; @@ -137,8 +138,8 @@ in { services.udev.packages = with pkgs; [yubikey-personalization libu2f-host]; environment.shellInit = '' - gpg-connect-agent /bye - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + gpg-connect-agent /bye + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) umask 077 ''; } diff --git a/data/hyprland/config b/data/hyprland/config new file mode 100644 index 0000000..6ed5060 --- /dev/null +++ b/data/hyprland/config @@ -0,0 +1,18 @@ +general { + gaps_in = 1 + gaps_out = 0 +} + +input { + sensitivity = -0.7 + kb_layout = de + kb_variant = bone + repeat_rate = 60 + repeat_delay = 235 + # Only change focus on mouse click + follow_mouse = 2 +} + +bind=SUPER,b,exec,firefox +bind=SUPER,t,exec,kitty +bind=SUPER + Shift,esc,exit diff --git a/flake.lock b/flake.lock index 76cdc1e..65b079d 100644 --- a/flake.lock +++ b/flake.lock @@ -116,13 +116,55 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1678199050, + "narHash": "sha256-4U0UDjSKcFgThNDY3JRf0D98sB4dqOiqqlbTGpKJ6hE=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "a85a6fa6c8ff9e51ba774cec112b408bce601451", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671839510, + "narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1677932085, - "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", + "lastModified": 1677676435, + "narHash": "sha256-6FxdcmQr5JeZqsQvfinIMr0XcTyTuR7EXX0H3ANShpQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", + "rev": "a08d6979dd7c82c4cef0dcc6ac45ab16051c1169", "type": "github" }, "original": { @@ -148,6 +190,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1677932085, + "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -179,7 +237,8 @@ "agenix": "agenix", "flake-utils": "flake-utils", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2", "pre-commit-hooks": "pre-commit-hooks", "templates": "templates" } @@ -188,11 +247,11 @@ "locked": { "lastModified": 1, "narHash": "sha256-b3t2blYgmHf/HXc152Fa7+YKJSS05vRnrs8i+H6SWA8=", - "path": "/nix/store/axiwqih4d53vp06qkw1z07j3zf3rhs4z-source/templates", + "path": "/nix/store/6cailc9k9kxxl017qk9gsczwjrclla13-source/templates", "type": "path" }, "original": { - "path": "/nix/store/axiwqih4d53vp06qkw1z07j3zf3rhs4z-source/templates", + "path": "/nix/store/6cailc9k9kxxl017qk9gsczwjrclla13-source/templates", "type": "path" } }, @@ -210,6 +269,49 @@ "repo": "flake-utils", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1677789111, + "narHash": "sha256-dWrk+Q3bLdtFe5rkyaAKWCQJCeE/KFNllcu1DvBC38c=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5ae17de23f5fd9bb252a698f3771c840280e2c05", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673116118, + "narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 325f65e..ff13ff1 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,8 @@ templates = { url = "./templates"; }; + + hyprland.url = "github:hyprwm/Hyprland"; }; outputs = { @@ -31,6 +33,7 @@ agenix, flake-utils, templates, + hyprland, ... } @ inputs: let system = "x86_64-linux"; @@ -45,6 +48,7 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; } + {home-manager.users.patrick.imports = [hyprland.homeManagerModules.default];} agenix.nixosModules.default { nix.registry = { @@ -54,6 +58,7 @@ templates.flake = templates; }; } + hyprland.nixosModules.default ]; }; } diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..4865ca0 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + programs.hyprland = { + enable = true; + # Users should provide their own package + package = null; + }; + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr]; +} diff --git a/modules/nix.nix b/modules/nix.nix index ecfb0aa..f870187 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -8,10 +8,12 @@ substituters = [ "https://nix-config.cachix.org" "https://nix-community.cachix.org" + "https://hyprland.cachix.org" ]; trusted-public-keys = [ "nix-config.cachix.org-1:Vd6raEuldeIZpttVQfrUbLvXJHzzzkS0pezXCVVjDG4=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; cores = 0; max-jobs = "auto"; diff --git a/users/common/default.nix b/users/common/default.nix index 6dbbd3e..96ce4b1 100644 --- a/users/common/default.nix +++ b/users/common/default.nix @@ -9,6 +9,7 @@ ./programs/htop.nix ./shells/alias.nix ]; + home.stateVersion = "23.05"; home.packages = with pkgs; [ sqlite diff --git a/users/common/graphical/hyprland.nix b/users/common/graphical/hyprland.nix new file mode 100644 index 0000000..736e551 --- /dev/null +++ b/users/common/graphical/hyprland.nix @@ -0,0 +1,7 @@ +_: { + wayland.windowManager.hyprland = { + enable = true; + nvidiaPatches = true; + extraConfig = builtins.readFile ../../../data/hyprland/config; + }; +} diff --git a/users/common/touchegg-settings.nix b/users/common/touchegg-settings.nix index 1733d4d..d7e0304 100644 --- a/users/common/touchegg-settings.nix +++ b/users/common/touchegg-settings.nix @@ -2,5 +2,5 @@ # # MY Config # - programs.touchegg.enable = true; + programs.touchegg.enable = false; } diff --git a/users/default.nix b/users/default.nix index 286fc3e..d7a659f 100644 --- a/users/default.nix +++ b/users/default.nix @@ -10,6 +10,5 @@ home-manager.users.root = { imports = [./common]; - home.stateVersion = "23.05"; }; } diff --git a/users/patrick.nix b/users/patrick.nix index 1274537..83232b4 100644 --- a/users/patrick.nix +++ b/users/patrick.nix @@ -6,6 +6,7 @@ imports = [ common/programs/kitty.nix common/graphical/herbstluftwm.nix + common/graphical/hyprland.nix common/graphical/autorandr.nix common/programs/polybar.nix common/programs/rofi.nix @@ -14,7 +15,6 @@ ]; home = { - stateVersion = "23.05"; packages = with pkgs; [ thunderbird discord