add: desktop xdg integration
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{ lib
|
||||
, pkgs
|
||||
, userName
|
||||
, isNixOS ? true
|
||||
, ...
|
||||
}: let
|
||||
# Have a file sturcture that holds all the configuration files that can't be configured by Nix
|
||||
@@ -31,19 +30,6 @@ in
|
||||
stateVersion = "24.11";
|
||||
}
|
||||
|
||||
(lib.mkIf isNixOS {
|
||||
sessionVariables = {
|
||||
XDG_CURRENT_DESKTOP = "sway";
|
||||
XDG_SESSION_TYPE = "wayland";
|
||||
XDG_SESSION_DESKTOP = "sway";
|
||||
XDG_CONFIG_HOME = "$HOME/.config";
|
||||
XDG_CACHE_HOME = "$HOME/.cache";
|
||||
XDG_DATA_HOME = "$HOME/.local/share";
|
||||
XDG_STATE_HOME = "$HOME/.local/state";
|
||||
NIXOS_OZONE_WL = "1";
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf pkgs.stdenv.isLinux {
|
||||
pointerCursor = {
|
||||
gtk.enable = true;
|
||||
|
||||
+1
-1
@@ -153,6 +153,6 @@ in {
|
||||
|
||||
programs.waybar = {
|
||||
enable = pkgs.stdenv.isLinux;
|
||||
systemd.enable = true;
|
||||
systemd.enable = false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
then "lightdm"
|
||||
else "none";
|
||||
in {
|
||||
imports = [./xdg.nix];
|
||||
|
||||
options.desktop = {
|
||||
displayManager = lib.mkOption {
|
||||
type = lib.types.enum ["auto" "none" "gdm" "lightdm" "ly"];
|
||||
@@ -141,6 +143,11 @@ in {
|
||||
enable = true;
|
||||
wrapperFeatures.gtk = true;
|
||||
extraPackages = cfg.sway.extraPackages;
|
||||
extraSessionCommands = ''
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
export XDG_SESSION_DESKTOP=sway
|
||||
export NIXOS_OZONE_WL=1
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.desktop;
|
||||
needsGtkPortal = cfg.xfce.enable || cfg.hyprland.enable;
|
||||
usesPortal = cfg.gnome.enable || cfg.xfce.enable || cfg.sway.enable || cfg.hyprland.enable;
|
||||
in {
|
||||
config = lib.mkMerge [
|
||||
# GNOME and Sway configure their own portals in NixOS. XFCE needs a
|
||||
# portal; Hyprland benefits from GTK as a fallback to its native one.
|
||||
(lib.mkIf needsGtkPortal {
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
extraPortals = [pkgs.xdg-desktop-portal-gtk];
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.sway.enable || needsGtkPortal) {
|
||||
xdg.portal.config.common.default = ["gtk"];
|
||||
})
|
||||
|
||||
(lib.mkIf (usesPortal && config.services.gnome.gnome-keyring.enable) {
|
||||
xdg.portal.config.common."org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.sway.enable && config.services.gnome.gnome-keyring.enable) {
|
||||
xdg.portal.config.sway."org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||
})
|
||||
|
||||
# A per-desktop config takes precedence over Hyprland's packaged config,
|
||||
# so include its native portal whenever adding a Secret preference.
|
||||
(lib.mkIf (cfg.hyprland.enable && config.services.gnome.gnome-keyring.enable) {
|
||||
xdg.portal.config.hyprland = {
|
||||
default = ["hyprland" "gtk"];
|
||||
"org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -22,6 +22,7 @@ in {
|
||||
})
|
||||
../../apps/gaming.nix
|
||||
../../apps/appimage.nix
|
||||
../../desktop
|
||||
../../graphics
|
||||
../../pwrMgmt
|
||||
../../networking/core.nix
|
||||
@@ -74,7 +75,6 @@ in {
|
||||
brightnessctl
|
||||
wttrbar
|
||||
cliphist
|
||||
xdg-desktop-portal-gtk
|
||||
xdg-utils
|
||||
flatpak-xdg-utils
|
||||
desktop-file-utils
|
||||
@@ -89,6 +89,10 @@ in {
|
||||
# Enable Polkit
|
||||
security.polkit.enable = true;
|
||||
|
||||
# Enable desktop support (sway)
|
||||
desktop.sway.enable = true;
|
||||
desktop.displayManager = "ly";
|
||||
|
||||
# Graphics module (../../graphics/default.nix)
|
||||
graphics = {
|
||||
enable = true;
|
||||
@@ -189,27 +193,6 @@ in {
|
||||
# AppImage support
|
||||
appimage.enable = true;
|
||||
|
||||
# XDG stuff
|
||||
xdg = {
|
||||
portal = {
|
||||
enable = true;
|
||||
config = {
|
||||
sway = {
|
||||
default = ["wlr" "gtk"];
|
||||
"org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||
};
|
||||
common = {
|
||||
default = ["gtk"];
|
||||
"org.freedesktop.impl.portal.Secret" = ["gnome-keyring"];
|
||||
};
|
||||
};
|
||||
extraPortals = with pkgs; [
|
||||
xdg-desktop-portal-wlr
|
||||
xdg-desktop-portal-gtk
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# sched_ext userspace CPU scheduling stuff - idk
|
||||
services.scx = {
|
||||
enable = true;
|
||||
|
||||
Reference in New Issue
Block a user