From 21481c10e61f5728d5dafffb87fac9074ecdf7c4 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Mon, 25 Sep 2023 20:20:43 -0500 Subject: [PATCH] initial hyprland work --- flake.lock | 145 +++++++++++++++++++++++++++-- flake.nix | 3 + home/features/desktop/hyprland.nix | 26 ++++++ home/pixnix.nix | 2 + hosts/common/optional/gnome.nix | 8 -- hosts/common/optional/hyprland.nix | 14 +++ hosts/common/optional/xserver.nix | 12 +++ hosts/pixnix/default.nix | 4 +- 8 files changed, 196 insertions(+), 18 deletions(-) create mode 100644 home/features/desktop/hyprland.nix create mode 100644 hosts/common/optional/hyprland.nix create mode 100644 hosts/common/optional/xserver.nix diff --git a/flake.lock b/flake.lock index ca2b67b..6b37631 100644 --- a/flake.lock +++ b/flake.lock @@ -74,18 +74,65 @@ "type": "github" } }, - "nixpkgs": { + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, "locked": { - "lastModified": 1695346609, - "narHash": "sha256-jur+AjgRvablLA2oBvC4FD89zCXttVQDwi6OXk5x/14=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e9b4b56e5a20ac322c0c01ccab7ec697ab076ea0", + "lastModified": 1695650428, + "narHash": "sha256-gAUMixbeGqRjmh1IK3N6ffEcLiG5NxQNvxBjTVbpbFA=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "ffacd2efd1ca7fdf364a519c9d8d8644da28412b", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-23.05", + "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" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1694767346, + "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -106,14 +153,94 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1695346609, + "narHash": "sha256-jur+AjgRvablLA2oBvC4FD89zCXttVQDwi6OXk5x/14=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e9b4b56e5a20ac322c0c01ccab7ec697ab076ea0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "firefox-addons": "firefox-addons", "hardware": "hardware", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1695277534, + "narHash": "sha256-LEIUGXvKR5DYFQUTavC3yifcObvG4XZUUHfxXmu8nEM=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "98a745d926d8048bc30aef11b421df207a01c279", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "98a745d926d8048bc30aef11b421df207a01c279", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1694628480, + "narHash": "sha256-Qg9hstRw0pvjGu5hStkr2UX1D73RYcQ9Ns/KnZMIm9w=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "8f45a6435069b9e24ebd3160eda736d7a391cbf2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index aa63f52..b993446 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # Hyprland + hyprland.url = "github:hyprwm/Hyprland"; + # Hardware hardware.url = "github:nixos/nixos-hardware"; diff --git a/home/features/desktop/hyprland.nix b/home/features/desktop/hyprland.nix new file mode 100644 index 0000000..ec05165 --- /dev/null +++ b/home/features/desktop/hyprland.nix @@ -0,0 +1,26 @@ +{config, pkgs, ... }: { + wayland.windowManager.hyprland.extraConfig = '' + $mod = SUPER + + bind = $mod, F, exec, firefox + bind = , Print, exec, grimblast copy area + bind = $mod, Q, exec, kitty + + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + ${builtins.concatStringsSep "\n" (builtins.genList ( + x: let + ws = let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in '' + bind = $mod, ${ws}, workspace, ${toString (x + 1)} + bind = $mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)} + '' + ) + 10)} + + # ... + ''; +} \ No newline at end of file diff --git a/home/pixnix.nix b/home/pixnix.nix index 277e25f..a929a49 100644 --- a/home/pixnix.nix +++ b/home/pixnix.nix @@ -3,10 +3,12 @@ ./global ./features/cli/extras ./features/desktop + ./features/desktop/hyprland.nix ]; # packages home.packages = with pkgs; [ + kitty vagrant ]; } diff --git a/hosts/common/optional/gnome.nix b/hosts/common/optional/gnome.nix index bce4bbf..f46ad63 100644 --- a/hosts/common/optional/gnome.nix +++ b/hosts/common/optional/gnome.nix @@ -1,20 +1,12 @@ { services = { xserver = { - enable = true; - displayManager = { - gdm = { - enable = true; - autoSuspend = false; - }; - }; desktopManager = { gnome.enable = true; }; layout = "us"; xkbVariant = ""; }; - logind.lidSwitch = "ignore"; }; security.polkit.extraConfig = '' polkit.addRule(function(action, subject) { diff --git a/hosts/common/optional/hyprland.nix b/hosts/common/optional/hyprland.nix new file mode 100644 index 0000000..6316a95 --- /dev/null +++ b/hosts/common/optional/hyprland.nix @@ -0,0 +1,14 @@ +{pkgs, ... }: { + + services.xserver = { + displayManager.gdm = { + wayland = true; + }; + }; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + +} diff --git a/hosts/common/optional/xserver.nix b/hosts/common/optional/xserver.nix new file mode 100644 index 0000000..5a3204f --- /dev/null +++ b/hosts/common/optional/xserver.nix @@ -0,0 +1,12 @@ +{ + services = { + xserver = { + enable = true; + displayManager.gdm = { + enable = true; + autoSuspend = false; + }; + }; + logind.lidSwitch = "ignore"; + }; +} \ No newline at end of file diff --git a/hosts/pixnix/default.nix b/hosts/pixnix/default.nix index bfa20e3..c2009c7 100644 --- a/hosts/pixnix/default.nix +++ b/hosts/pixnix/default.nix @@ -9,11 +9,13 @@ ../common/users/john ../common/optional/docker.nix - ../common/optional/gnome.nix + #../common/optional/gnome.nix + # ../common/optional/hyprland.nix ../common/optional/libvirtd.nix ../common/optional/pipewire.nix ../common/optional/printing.nix ../common/optional/sshd.nix + ../common/optional/xserver.nix ]; networking = {