Merge pull request #335115 from SuperSandro2000/graphical-desktop

nixos/graphical-desktop: add enable option, nixos/wayland-session: use graphical-desktop option and remove implicit defaults
This commit is contained in:
Masum Reza 2024-08-18 17:20:55 +05:30 committed by GitHub
commit 94c30e543d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 20 additions and 17 deletions

View file

@ -19,6 +19,6 @@ in
# To make a cardboard session available for certain DMs like SDDM # To make a cardboard session available for certain DMs like SDDM
services.displayManager.sessionPackages = [ cfg.package ]; services.displayManager.sessionPackages = [ cfg.package ];
} }
(import ./wayland-session.nix { inherit lib pkgs; }) (import ./wayland-session.nix { inherit lib; })
]); ]);
} }

View file

@ -70,7 +70,7 @@ in
} }
(import ./wayland-session.nix { (import ./wayland-session.nix {
inherit lib pkgs; inherit lib;
enableXWayland = cfg.xwayland.enable; enableXWayland = cfg.xwayland.enable;
enableWlrPortal = lib.mkDefault false; # Hyprland has its own portal, wlr is not needed enableWlrPortal = lib.mkDefault false; # Hyprland has its own portal, wlr is not needed
}) })

View file

@ -20,6 +20,6 @@ in
# To make a labwc session available for certain DMs like SDDM # To make a labwc session available for certain DMs like SDDM
services.displayManager.sessionPackages = [ cfg.package ]; services.displayManager.sessionPackages = [ cfg.package ];
} }
(import ./wayland-session.nix { inherit lib pkgs; }) (import ./wayland-session.nix { inherit lib; })
]); ]);
} }

View file

@ -30,7 +30,7 @@ in
} }
(import ./wayland-session.nix { (import ./wayland-session.nix {
inherit lib pkgs; inherit lib;
# Hardcoded path in Mir, not really possible to disable # Hardcoded path in Mir, not really possible to disable
enableXWayland = true; enableXWayland = true;
# No portal support yet: https://github.com/mattkae/miracle-wm/issues/164 # No portal support yet: https://github.com/mattkae/miracle-wm/issues/164

View file

@ -56,7 +56,7 @@ in
} }
(import ./wayland-session.nix { (import ./wayland-session.nix {
inherit lib pkgs; inherit lib;
enableXWayland = cfg.xwayland.enable; enableXWayland = cfg.xwayland.enable;
}) })
]); ]);

View file

@ -129,8 +129,6 @@ in
}; };
}; };
programs.gnupg.agent.pinentryPackage = lib.mkDefault pkgs.pinentry-gnome3;
# To make a Sway session available if a display manager like SDDM is enabled: # To make a Sway session available if a display manager like SDDM is enabled:
services.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package; services.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
@ -139,7 +137,7 @@ in
} }
(import ./wayland-session.nix { (import ./wayland-session.nix {
inherit lib pkgs; inherit lib;
enableXWayland = cfg.xwayland.enable; enableXWayland = cfg.xwayland.enable;
}) })
]); ]);

View file

@ -52,8 +52,6 @@ in
services.displayManager.sessionPackages = [ finalPackage ]; services.displayManager.sessionPackages = [ finalPackage ];
xdg.icons.enable = true;
xdg.portal = { xdg.portal = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
wlr.enable = lib.mkDefault true; wlr.enable = lib.mkDefault true;
@ -65,7 +63,7 @@ in
}; };
} }
(import ./wayland-session.nix { (import ./wayland-session.nix {
inherit lib pkgs; inherit lib;
enableXWayland = cfg.xwayland.enable; enableXWayland = cfg.xwayland.enable;
}) })
] ]

View file

@ -1,6 +1,5 @@
{ {
lib, lib,
pkgs,
enableXWayland ? true, enableXWayland ? true,
enableWlrPortal ? true, enableWlrPortal ? true,
}: }:
@ -11,15 +10,12 @@
pam.services.swaylock = {}; pam.services.swaylock = {};
}; };
hardware.graphics.enable = lib.mkDefault true;
fonts.enableDefaultPackages = lib.mkDefault true;
programs = { programs = {
dconf.enable = lib.mkDefault true; dconf.enable = lib.mkDefault true;
xwayland.enable = lib.mkDefault enableXWayland; xwayland.enable = lib.mkDefault enableXWayland;
}; };
xdg.icons.enable = true; services.graphical-desktop.enable = true;
xdg.portal.wlr.enable = enableWlrPortal; xdg.portal.wlr.enable = enableWlrPortal;

View file

@ -5,11 +5,22 @@
... ...
}: }:
let let
cfg = config.services.graphical-desktop;
xcfg = config.services.xserver; xcfg = config.services.xserver;
dmcfg = config.services.displayManager; dmcfg = config.services.displayManager;
in in
{ {
config = lib.mkIf (xcfg.enable || dmcfg.enable) { options = {
services.graphical-desktop.enable =
lib.mkEnableOption "bits and pieces required for a graphical desktop session"
// {
default = xcfg.enable || dmcfg.enable;
defaultText = lib.literalExpression "(config.services.xserver.enable || config.services.displayManager.enable)";
internal = true;
};
};
config = lib.mkIf cfg.enable {
# The default max inotify watches is 8192. # The default max inotify watches is 8192.
# Nowadays most apps require a good number of inotify watches, # Nowadays most apps require a good number of inotify watches,
# the value below is used by default on several other distros. # the value below is used by default on several other distros.