Add Hyprland WM

This commit is contained in:
Erwin Boskma 2022-10-30 21:11:48 +01:00
parent f558b472f7
commit b07c41205f
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
11 changed files with 225 additions and 22 deletions

View file

@ -10,11 +10,11 @@
]
},
"locked": {
"lastModified": 1666678027,
"narHash": "sha256-TYLiybC/wqJ30PhvzdasULBXvc54tiARF1PopP9puVM=",
"lastModified": 1666957671,
"narHash": "sha256-QmFXa7AToYu1/xyo4jxo7wKpy0Ec6IYWVsQjKz4WqlM=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "6ad04079d54ca9ae6770dc72b51184537c8e768b",
"rev": "c5a67519099ded10354a96c268a9bdef8087161d",
"type": "github"
},
"original": {
@ -76,11 +76,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1666649150,
"narHash": "sha256-kINnLxC0KFalUk4tVO/H5hUU7FVAOYYcUSWrsBpnl+I=",
"lastModified": 1666903647,
"narHash": "sha256-sFI1Gh9DTGzHnBINondupUGYbe+T0wZcpcZjkW0qffM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7dc4e4ebd71280842b4d30975439980baaac9db8",
"rev": "213a06295dff96668a1d673b9fd1c03ce1de6745",
"type": "github"
},
"original": {
@ -89,6 +89,27 @@
"type": "github"
}
},
"hyprland": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"wlroots": "wlroots"
},
"locked": {
"lastModified": 1667132917,
"narHash": "sha256-0b1kVcyDOrkluCSIkKmz3FO/cN4/Amz1uIU3EyvojPA=",
"owner": "Hyprwm",
"repo": "Hyprland",
"rev": "9f1d7f7fc709ae3360f7ec229e9fd1e32b894ace",
"type": "github"
},
"original": {
"owner": "Hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
@ -132,11 +153,11 @@
]
},
"locked": {
"lastModified": 1666016402,
"narHash": "sha256-Cm/nrdUMXwXiFQforG1Mv8OA4o8yhuVx6E1eDFH4rew=",
"lastModified": 1666812839,
"narHash": "sha256-0nBDgjPU+iDsvz89W+cDEyhnFGSwCJmwDl/gMGqYiU0=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "688db42a1eb34853f050267ff65c975f664312f0",
"rev": "41f3518bc194389df22a3d198215eae75e6b5ab9",
"type": "github"
},
"original": {
@ -147,11 +168,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1665987993,
"narHash": "sha256-MvlaIYTRiqefG4dzI5p6vVCfl+9V8A1cPniUjcn6Ngc=",
"lastModified": 1666873549,
"narHash": "sha256-a6Eu1Qv/EndjepSMja5SvcG+4vM5Rl2gzJD7xscRHss=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "0e6593630071440eb89cd97a52921497482b22c6",
"rev": "419dcc0ec767803182ed01a326f134230578bf60",
"type": "github"
},
"original": {
@ -162,11 +183,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1666539104,
"narHash": "sha256-jeuC+d375wHHxMOFLgu7etseCQVJuPNKoEc9X9CsErg=",
"lastModified": 1666869603,
"narHash": "sha256-3V53or4Vpu4+LrGfGSh3T2V8+qf5RP6nRuex9GywkwE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e6df35f39651504249a05191f9a78d251707e22",
"rev": "2001e2b31c565bcdf7bc13062b8d7cfccaca05b8",
"type": "github"
},
"original": {
@ -225,6 +246,7 @@
"flake-utils": "flake-utils",
"ha-now-playing": "ha-now-playing",
"home-manager": "home-manager",
"hyprland": "hyprland",
"naersk": "naersk",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
@ -245,11 +267,11 @@
]
},
"locked": {
"lastModified": 1666667027,
"narHash": "sha256-MUJa0T8j5cy3eE70hoL1KW52VfTcXm4VbwvdF5scs1g=",
"lastModified": 1666925689,
"narHash": "sha256-X2n+i2efiXcniDPDbvMsJVrPd7epu3+6pS/Pwu3OkHg=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "79b6e66bb76537c96707703f08630765e46148d1",
"rev": "4b1fcd5766db910c07c871d1454b1fe296e4547c",
"type": "github"
},
"original": {
@ -317,6 +339,24 @@
"repo": "flake-utils",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1666466001,
"narHash": "sha256-ZjxAnqtcGmHQHKL1Z9sIraDnzIqrJleWcJXfPtzAm74=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "c2d2773df57750081b16d56da13b5015d752cbd7",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
}
},
"root": "root",

View file

@ -40,6 +40,11 @@
inputs.flake-utils.follows = "flake-utils";
};
hyprland = {
url = "github:Hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
ha-now-playing = {
url = "git+https://git.datarift.nl/erwin/ha-now-playing.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -0,0 +1,135 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.eboskma.programs.hyprland;
terminal = "${pkgs.foot}/bin/foot";
dmenu = "${pkgs.rofi}/bin/rofi -show drun -no-lazy-grab";
menu = "${pkgs.rofi}/bin/rofi -show run -no-lazy-grab";
rofiPower = pkgs.writeShellScriptBin "rofi-power" (builtins.readFile ../sway/powermenu.sh);
powerMenu = "${rofiPower}/bin/rofi-power";
wallpapers = {
hd = ./wallpapers/river-1920.png;
qhd = ./wallpapers/river-2560.png;
uhd = ./wallpapers/river-3840.png;
};
swaylockcmd = "${pkgs.swaylock-effects}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --clock --image ${wallpapers.qhd} --fade-in 0.5 --scaling fill";
in
{
options.eboskma.programs.hyprland = { enable = mkEnableOption "Hyprland"; };
config = mkIf (cfg.enable) {
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
monitor = DP-2,2560x1440@165,0x0,1
general {
gaps_out = 10
}
decoration {
rounding = 5
inactive_opacity = 0.9
dim_inactive = true
dim_strength = 0.5
}
input {
kb_layout = us
kb_options = lv3:ralt_switch,eurosign:5
natural_scroll = true
}
misc {
no_vfr = false
focus_on_activate = false
}
binds {
workspace_back_and_forth = true
}
$mod = Mod4
bind = $mod,Return,exec,${terminal}
bind = $mod_SHIFT,Q,killactive
bind = $mod,S,exec,${dmenu}
bind = $mod_SHIFT,S,exec,${menu}
bind = $mod,N,movefocus,l
bind = $mod,E,movefocus,d
bind = $mod,I,movefocus,u
bind = $mod,O,movefocus,r
bind = $mod_SHIFT,N,movewindow,l
bind = $mod_SHIFT,E,movewindow,d
bind = $mod_SHIFT,O,movewindow,r
bind = $mod_SHIFT,I,movewindow,u
bind = $mod_SHIFT,Space,togglefloating,active
bind = $mod,T,togglefullscreen,0
bind = $mod_SHIFT,T,togglefullscreen,1
bind = $mod,1,workspace,1
bind = $mod,2,workspace,2
bind = $mod,3,workspace,3
bind = $mod,4,workspace,4
bind = $mod,5,workspace,5
bind = $mod,6,workspace,6
bind = $mod,7,workspace,7
bind = $mod,8,workspace,8
bind = $mod,9,workspace,9
bind = $mod,0,workspace,10
bind = $mod_SHIFT,1,movetoworkspacesilent,1
bind = $mod_SHIFT,2,movetoworkspacesilent,2
bind = $mod_SHIFT,3,movetoworkspacesilent,3
bind = $mod_SHIFT,4,movetoworkspacesilent,4
bind = $mod_SHIFT,5,movetoworkspacesilent,5
bind = $mod_SHIFT,6,movetoworkspacesilent,6
bind = $mod_SHIFT,7,movetoworkspacesilent,7
bind = $mod_SHIFT,8,movetoworkspacesilent,8
bind = $mod_SHIFT,9,movetoworkspacesilent,9
bind = $mod_SHIFT,0,movetoworkspacesilent,10
bind = $mod_SHIFT,Minus,movetoworkspacesilent,special
bind = $mod,Minus,togglespecialworkspace
bind = $mod_SHIFT,C,exec,hyprctl reload
bind = $mod_SHIFT,F,exec,${powerMenu}
bind = $mod,L,exec,${swaylockcmd}
bind = $mod,Print,exec,${pkgs.grim}/bin/grim
bind = $mod_SHIFT,Print,exec,${pkgs.grim}/bin/grim | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png -f
bind = ,XF86AudioRaiseVolume,exec,${pkgs.pamedia}/bin/pamedia up
bind = ,XF86AudioLowerVolume,exec,${pkgs.pamedia}/bin/pamedia down
bind = ,XF86AudioMute,exec,${pkgs.pamedia}/bin/pamedia mute
bind = ,XF86Calculator,exec,${pkgs.gnome.gnome-calculator}/bin/gnome-calculator
bind = $mod,D,exec,${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw
bind = $mod,W,togglegroup
bindm = ALT,mouse:272,movewindow
bindm = ALT,mouse:273,resizewindow
windowrulev2 = workspace 1,^(firefox)$
windowrulev2 = workspace 2,^(foot)$
windowrulev2 = workspace 3,^(emacs)$
exec = ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator
exec-once = ${pkgs.swaybg}/bin/swaybg -i ${wallpapers.qhd} -m fill
exec-once = ${cfg.package}/bin/hyprctl setcursor Nordzy-cursors 24
'' +
(lib.optionalString config.eboskma.programs.emacs.enable "bind = $mod,C,exec,${config.eboskma.programs.emacs.package}/bin/emacsclient -c");
};
};
}

View file

@ -111,7 +111,7 @@ in
};
"DP-2" = {
bg = "${wallpapers.qhd} fill";
mode = "2560x1440@144Hz";
mode = "2560x1440@165Hz";
adaptive_sync = "on";
max_render_time = "2";
};

View file

@ -1,5 +1,3 @@
#!/bin/bash
confirm() {
rofi -dmenu \
-i \

View file

@ -1,4 +1,4 @@
{ self, nixpkgs, nixos-hardware, ... }:
{ self, nixpkgs, nixos-hardware, hyprland, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
@ -9,6 +9,8 @@ in
nixos-hardware.nixosModules.common-gpu-amd
nixos-hardware.nixosModules.common-pc-ssd
hyprland.nixosModules.default
./hardware-configuration.nix
../../users/erwin
../../users/root

View file

@ -40,6 +40,14 @@ in
swaynotificationcenter
];
};
hyprland = {
enable = true;
# Required when also using the Home Manager module
# See the wiki: https://wiki.hyprland.org/Nix/#modules-mixnmatch
package = null;
};
};
xdg = {

View file

@ -45,6 +45,7 @@ in
"greetd/environments" = {
text = ''
${pkgs.sway}/bin/sway
${hyprland}/bin/Hyprland
${pkgs.bash}/bin/bash
'';
user = "greeter";

View file

@ -51,11 +51,13 @@ in
substituters = [
"https://nix-community.cachix.org"
"https://marcus7070.cachix.org"
"https://hyprland.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"marcus7070.cachix.org-1:JawxHSgnYsgNYJmNqZwvLjI4NcOwrcEZDToWlT3WwXw="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};

View file

@ -17,4 +17,15 @@ final: prev: rec {
});
bl3auto = prev.pkgs.callPackage ../pkgs/bl3auto { inherit (prev.pkgs) lib buildGoModule fetchFromGitHub; };
waybar = prev.pkgs.waybar.overrideAttrs (prevAttrs: {
src = prev.fetchFromGitHub {
owner = "Alexays";
repo = "Waybar";
rev = "ebdf575d45c0e4f8c6f6ce484fbbf5375ed8dbba";
sha256 = "WTdy9zGhidk56CjmSuFDigfa64O9ZNd5GpfpCVrL8i0=";
};
buildInputs = prevAttrs.buildInputs ++ [ prev.wayland-protocols prev.libappindicator-gtk3 prev.libinput prev.jack2 ];
mesonFlags = prevAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
});
}

View file

@ -226,6 +226,7 @@ in
inputs.emacs-overlay.overlay
];
}
inputs.hyprland.homeManagerModules.default
] ++ (map (mod: (../../home-manager/modules + "/${mod}")) (builtins.attrNames (builtins.readDir ../../home-manager/modules)));
};