modules/window-manager: add hyprland

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-22 23:43:16 +03:00
parent c93ef62b37
commit 629c9e995c
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
11 changed files with 186 additions and 22 deletions

View file

@ -492,11 +492,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1711593151, "lastModified": 1713714268,
"narHash": "sha256-/9NCoPI7fqJIN8viONsY9X0fAeq8jc3GslFCO0ky6TQ=", "narHash": "sha256-ZJGnom7YthvNxUZLdUzy5VePTwYgDYcnnPpyHT4n9lY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "bb2b73df7bcfbd2dd55ff39b944d70547d53c267", "rev": "69ee1d82f1fa4c70a3dc9a64111e7eef3b8e4527",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,4 +1,4 @@
{ globalData, ... }: { ... }:
{ {
imports = [ imports = [
@ -8,15 +8,12 @@
]; ];
################################################################################ ################################################################################
# Programs # Window manager
################################################################################ ################################################################################
local.programs.browsers.tor-browser = {
enable = true; local.window-manager = {
container = { xmonad.enable = false;
enable = true; hyprland.enable = true;
externalInterface = "wg0";
sshAuthorizedKeys = globalData.publicKeys.users.jan;
};
}; };
################################################################################ ################################################################################
@ -24,7 +21,7 @@
################################################################################ ################################################################################
# Enable the Docker # Enable the Docker
virtualisation.docker.enable = true; # virtualisation.docker.enable = true;
# Torrent # Torrent
# services.transmission.enable = true; # services.transmission.enable = true;

View file

@ -9,12 +9,18 @@ in
home-manager.users.jan = { home-manager.users.jan = {
local.window-manager = { local.window-manager = {
hyprland.enable = true;
polybar.enable = false;
xmonad.enable = false;
xmonad.projects = import ./xmonad-projects.secret.nix; xmonad.projects = import ./xmonad-projects.secret.nix;
}; };
local.programs.terminals.wezterm.enable = false;
# local.programs.dev-tools.k8s.enable = true; # local.programs.dev-tools.k8s.enable = true;
local.programs.libreoffice.enable = true; local.programs.libreoffice.enable = false;
local.services.lan-mouse.settings = { local.services.lan-mouse.settings = {
port = asusData.lan-mouse.port; port = asusData.lan-mouse.port;

View file

@ -3,6 +3,7 @@
{ {
imports = [ imports = [
./xmonad.nix ./xmonad.nix
./hyprland.nix
./polybar.nix ./polybar.nix
]; ];
} }

View file

@ -0,0 +1,131 @@
{ config, pkgs, lib, ... }:
let
cfg = config.local.window-manager.hyprland;
in
{
options.local.window-manager.hyprland = with lib; {
enable = mkEnableOption "hyperland window manager";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [
foot
wl-clipboard
wlsunset
swaybg
dmenu-wayland
];
wayland.windowManager.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
systemd.enable = true;
xwayland.enable = true;
settings = {
# monitors
monitor = ",preferred,auto,auto";
# env
env = [
"XCURSOR_SIZE,24"
"HYPRCURSOR_SIZE,24"
];
# look and feel
general = {
gaps_in = 5;
gaps_out = 20;
border_size = 2;
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 5;
active_opacity = 1.0;
inactive_opacity = 1.0;
drop_shadow = false;
blur = {
enabled = false;
};
};
animations = {
enabled = false;
};
master = {
orientation = "top";
new_is_master = false;
};
gestures = {
workspace_swipe = false;
};
"$terminal" = "foot";
"$browser" = "librewolf";
"$fileManager" = "vifm";
"$menu" = "dmenu-wl_run";
"$mod" = "ALT_L";
bind = lib.flatten [
# programs
"$mod SHIFT, Return, exec, $terminal"
"$mod SHIFT, S, exec, flameshot gui"
"$mod SHIFT, B, exec, $browser"
"$mod, p, exec, $menu"
# Move focus
(lib.flip lib.mapAttrsToList { L = "r"; H = "l"; J = "d"; K = "u"; } (k: d:
"$mod, ${k}, movefocus, ${d}"
))
(lib.flip map [ 1 2 3 4 5 6 7 8 9 0 ] (i:
let wid = if i == 0 then 10 else i; in
[
# switch warkspaces with mod + [0-9]
"$mod, ${toString i}, workspace, ${toString wid}"
# move active window to a workspace with mod + shift + [0-9]
"$mod SHIFT, ${toString i}, movetoworkspace, ${toString wid}"
]
))
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
input = let kb = config.home.keyboard; in {
kb_model = kb.model;
kb_layout = kb.layout;
kb_variant = kb.variant;
kb_options = lib.head kb.options;
};
};
};
};
}

View file

@ -15,7 +15,7 @@
local.fonts.enable = lib.mkDefault true; local.fonts.enable = lib.mkDefault true;
local.sound.enable = lib.mkDefault true; local.sound.enable = lib.mkDefault true;
local.window-manager.enable = lib.mkDefault true; local.window-manager.xmonad.enable = lib.mkDefault true;
################################################################################ ################################################################################
# Services # Services

View file

@ -7,6 +7,6 @@
./nix.nix ./nix.nix
./sound.nix ./sound.nix
./system.nix ./system.nix
./window-manager.nix ./window-manager
]; ];
} }

View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./hyprland.nix
./xmonad.nix
];
}

View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
let
cfg = config.local.window-manager.hyprland;
in
{
options.local.window-manager.hyprland = with lib; {
enable = mkEnableOption "hyperland window manager";
};
config = lib.mkIf cfg.enable {
programs.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
};
programs.gnupg.agent.pinentryFlavor = "gtk2";
};
}

View file

@ -1,9 +1,10 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let cfg = config.local.window-manager.xmonad; in
{ {
options.local.window-manager.enable = lib.mkEnableOption "window-manager"; options.local.window-manager.xmonad.enable = lib.mkEnableOption "window-manager";
config = lib.mkIf config.local.window-manager.enable { config = lib.mkIf cfg.enable {
services.dbus = { services.dbus = {
enable = true; enable = true;
packages = [ pkgs.dconf ]; packages = [ pkgs.dconf ];

View file

@ -52,13 +52,13 @@
}; };
local.window-manager = { local.window-manager = {
xmonad.enable = true; xmonad.enable = lib.mkDefault true;
polybar.enable = true; polybar.enable = lib.mkDefault true;
}; };
xdg.enable = true; xdg.enable = lib.mkDefault true;
local.shell.enable = true; local.shell.enable = lib.mkDefault true;
################################################################################ ################################################################################