mirror of
https://github.com/ItsDrike/nixdots
synced 2024-12-26 04:54:35 +00:00
Add various system-wide wayland settings
This commit is contained in:
parent
df09ddc1b4
commit
12ae728903
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
hyprPkgs = (import ./packages {inherit pkgs;});
|
hyprPkgs = (import ./packages {inherit pkgs;});
|
||||||
|
|
||||||
|
# TODO: Switch to flake
|
||||||
|
hyprlandPkg = pkgs.hyprland;
|
||||||
|
xdgDesktopPortalHyprlandPkg = pkgs.xdg-desktop-portal-hyprland;
|
||||||
|
|
||||||
cfg = osConfig.myOptions.home-manager.wms.hyprland;
|
cfg = osConfig.myOptions.home-manager.wms.hyprland;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -30,10 +34,19 @@ in {
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
enable = true;
|
enable = true;
|
||||||
xwayland.enable = true;
|
xwayland.enable = true;
|
||||||
|
package = hyprlandPkg;
|
||||||
systemd = {
|
systemd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
variables = ["--all"];
|
variables = ["--all"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
configPackages = [hyprlandPkg];
|
||||||
|
extraPortals = [
|
||||||
|
xdgDesktopPortalHyprlandPkg
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
./programs
|
./programs
|
||||||
./fonts.nix
|
./fonts.nix
|
||||||
./runners.nix
|
./runners.nix
|
||||||
|
./display
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
5
system/roles/workstation/display/default.nix
Normal file
5
system/roles/workstation/display/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./wayland
|
||||||
|
];
|
||||||
|
}
|
8
system/roles/workstation/display/wayland/default.nix
Normal file
8
system/roles/workstation/display/wayland/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./wms
|
||||||
|
./xdg-portals.nix
|
||||||
|
./xwayland.nix
|
||||||
|
./services.nix
|
||||||
|
];
|
||||||
|
}
|
29
system/roles/workstation/display/wayland/services.nix
Normal file
29
system/roles/workstation/display/wayland/services.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf getExe;
|
||||||
|
|
||||||
|
cfgEnabled = config.myOptions.home-manager.wms.isWayland;
|
||||||
|
in {
|
||||||
|
config = mkIf cfgEnabled {
|
||||||
|
systemd.services = {
|
||||||
|
# Seat management daemon
|
||||||
|
# (Takes care of mediating access to shared devices (graphics, input), without requiring
|
||||||
|
# applications like Wayland compositors being granted root privileges)
|
||||||
|
seatd = {
|
||||||
|
enable = true;
|
||||||
|
description = "Seat management daemon";
|
||||||
|
script = "${getExe pkgs.seatd} -g wheel";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "1";
|
||||||
|
};
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
5
system/roles/workstation/display/wayland/wms/default.nix
Normal file
5
system/roles/workstation/display/wayland/wms/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hyprland
|
||||||
|
];
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
|
cfgEnabled = config.myOptions.home-manager.wms.hyprland.enable;
|
||||||
|
|
||||||
|
# TODO: Switch to flake
|
||||||
|
hyprlandPkg = pkgs.hyprland;
|
||||||
|
xdgDesktopPortalHyprlandPkg = pkgs.xdg-desktop-portal-hyprland;
|
||||||
|
in {
|
||||||
|
config = mkIf cfgEnabled {
|
||||||
|
services.displayManager.sessionPackages = [hyprlandPkg];
|
||||||
|
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
configPackages = [hyprlandPkg];
|
||||||
|
extraPortals = [xdgDesktopPortalHyprlandPkg];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
package = hyprlandPkg;
|
||||||
|
portalPackage = xdgDesktopPortalHyprlandPkg;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
37
system/roles/workstation/display/wayland/xdg-portals.nix
Normal file
37
system/roles/workstation/display/wayland/xdg-portals.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
|
cfgEnabled = config.myOptions.home-manager.wms.isWayland;
|
||||||
|
cfgHyprlandEnabled = config.myOptions.home-manager.wms.hyprland.enable;
|
||||||
|
in {
|
||||||
|
config = mkIf cfgEnabled {
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
extraPortals = with pkgs; [
|
||||||
|
xdg-desktop-portal-gtk
|
||||||
|
];
|
||||||
|
|
||||||
|
# Specify which portals should be used by the individual interfaces
|
||||||
|
# see: <https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in>
|
||||||
|
config.common = let
|
||||||
|
# Note: this assumes a wlroots based compositor if it's not hyprland
|
||||||
|
# which may not always actually be the case, however, I can't be bothered to handle
|
||||||
|
# everything here and I don't plan on moving WMs any time soon.
|
||||||
|
portal = if cfgHyprlandEnabled then "hyprland" else "wlr";
|
||||||
|
in {
|
||||||
|
# Use this portal for every interface, unless a specific override is present
|
||||||
|
default = ["gtk"];
|
||||||
|
|
||||||
|
# Fix flameshot on hyprland / wlroots compositors
|
||||||
|
"org.freedesktop.impl.portal.Screencast" = [portal];
|
||||||
|
"org.freedesktop.impl.portal.Screenshot" = [portal];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
13
system/roles/workstation/display/wayland/xwayland.nix
Normal file
13
system/roles/workstation/display/wayland/xwayland.nix
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
|
cfgEnabled = config.myOptions.home-manager.wms.isWayland;
|
||||||
|
in {
|
||||||
|
config = mkIf cfgEnabled {
|
||||||
|
programs.xwayland.enable = true;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue