From 57507a521a6ed57ec0161a2ec03f9d131bda2115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 16 Aug 2024 15:09:49 +0200 Subject: [PATCH 1/2] nixos/graphical-desktop: add enable option --- nixos/modules/services/misc/graphical-desktop.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/graphical-desktop.nix b/nixos/modules/services/misc/graphical-desktop.nix index 246310195edc..0b5ef033e38b 100644 --- a/nixos/modules/services/misc/graphical-desktop.nix +++ b/nixos/modules/services/misc/graphical-desktop.nix @@ -5,11 +5,22 @@ ... }: let + cfg = config.services.graphical-desktop; xcfg = config.services.xserver; dmcfg = config.services.displayManager; 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. # Nowadays most apps require a good number of inotify watches, # the value below is used by default on several other distros. From 4f34325b2b289d6382a66e43087456b4dc3e5a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 16 Aug 2024 15:11:13 +0200 Subject: [PATCH 2/2] nixos/wayland-session: use graphical-desktop option and remove implicit defaults --- nixos/modules/programs/wayland/cardboard.nix | 2 +- nixos/modules/programs/wayland/hyprland.nix | 2 +- nixos/modules/programs/wayland/labwc.nix | 2 +- nixos/modules/programs/wayland/miracle-wm.nix | 2 +- nixos/modules/programs/wayland/river.nix | 2 +- nixos/modules/programs/wayland/sway.nix | 4 +--- nixos/modules/programs/wayland/wayfire.nix | 4 +--- nixos/modules/programs/wayland/wayland-session.nix | 6 +----- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/nixos/modules/programs/wayland/cardboard.nix b/nixos/modules/programs/wayland/cardboard.nix index 96089bdf94ed..5a25b5359c24 100644 --- a/nixos/modules/programs/wayland/cardboard.nix +++ b/nixos/modules/programs/wayland/cardboard.nix @@ -19,6 +19,6 @@ in # To make a cardboard session available for certain DMs like SDDM services.displayManager.sessionPackages = [ cfg.package ]; } - (import ./wayland-session.nix { inherit lib pkgs; }) + (import ./wayland-session.nix { inherit lib; }) ]); } diff --git a/nixos/modules/programs/wayland/hyprland.nix b/nixos/modules/programs/wayland/hyprland.nix index 6e69c1730e57..f8b70af40600 100644 --- a/nixos/modules/programs/wayland/hyprland.nix +++ b/nixos/modules/programs/wayland/hyprland.nix @@ -70,7 +70,7 @@ in } (import ./wayland-session.nix { - inherit lib pkgs; + inherit lib; enableXWayland = cfg.xwayland.enable; enableWlrPortal = lib.mkDefault false; # Hyprland has its own portal, wlr is not needed }) diff --git a/nixos/modules/programs/wayland/labwc.nix b/nixos/modules/programs/wayland/labwc.nix index c09ab8240d9f..4c74b45bb4a3 100644 --- a/nixos/modules/programs/wayland/labwc.nix +++ b/nixos/modules/programs/wayland/labwc.nix @@ -20,6 +20,6 @@ in # To make a labwc session available for certain DMs like SDDM services.displayManager.sessionPackages = [ cfg.package ]; } - (import ./wayland-session.nix { inherit lib pkgs; }) + (import ./wayland-session.nix { inherit lib; }) ]); } diff --git a/nixos/modules/programs/wayland/miracle-wm.nix b/nixos/modules/programs/wayland/miracle-wm.nix index a4c843523dc4..e20b62acb462 100644 --- a/nixos/modules/programs/wayland/miracle-wm.nix +++ b/nixos/modules/programs/wayland/miracle-wm.nix @@ -30,7 +30,7 @@ in } (import ./wayland-session.nix { - inherit lib pkgs; + inherit lib; # Hardcoded path in Mir, not really possible to disable enableXWayland = true; # No portal support yet: https://github.com/mattkae/miracle-wm/issues/164 diff --git a/nixos/modules/programs/wayland/river.nix b/nixos/modules/programs/wayland/river.nix index 6391f00e2f62..da793a9ff344 100644 --- a/nixos/modules/programs/wayland/river.nix +++ b/nixos/modules/programs/wayland/river.nix @@ -56,7 +56,7 @@ in } (import ./wayland-session.nix { - inherit lib pkgs; + inherit lib; enableXWayland = cfg.xwayland.enable; }) ]); diff --git a/nixos/modules/programs/wayland/sway.nix b/nixos/modules/programs/wayland/sway.nix index e3e32aa7a56a..8d43a3329f41 100644 --- a/nixos/modules/programs/wayland/sway.nix +++ b/nixos/modules/programs/wayland/sway.nix @@ -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: services.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package; @@ -139,7 +137,7 @@ in } (import ./wayland-session.nix { - inherit lib pkgs; + inherit lib; enableXWayland = cfg.xwayland.enable; }) ]); diff --git a/nixos/modules/programs/wayland/wayfire.nix b/nixos/modules/programs/wayland/wayfire.nix index 381d14fb8e21..726300ce5381 100644 --- a/nixos/modules/programs/wayland/wayfire.nix +++ b/nixos/modules/programs/wayland/wayfire.nix @@ -52,8 +52,6 @@ in services.displayManager.sessionPackages = [ finalPackage ]; - xdg.icons.enable = true; - xdg.portal = { enable = lib.mkDefault true; wlr.enable = lib.mkDefault true; @@ -65,7 +63,7 @@ in }; } (import ./wayland-session.nix { - inherit lib pkgs; + inherit lib; enableXWayland = cfg.xwayland.enable; }) ] diff --git a/nixos/modules/programs/wayland/wayland-session.nix b/nixos/modules/programs/wayland/wayland-session.nix index 18c252794563..b3d6cc368b20 100644 --- a/nixos/modules/programs/wayland/wayland-session.nix +++ b/nixos/modules/programs/wayland/wayland-session.nix @@ -1,6 +1,5 @@ { lib, - pkgs, enableXWayland ? true, enableWlrPortal ? true, }: @@ -11,15 +10,12 @@ pam.services.swaylock = {}; }; - hardware.graphics.enable = lib.mkDefault true; - fonts.enableDefaultPackages = lib.mkDefault true; - programs = { dconf.enable = lib.mkDefault true; xwayland.enable = lib.mkDefault enableXWayland; }; - xdg.icons.enable = true; + services.graphical-desktop.enable = true; xdg.portal.wlr.enable = enableWlrPortal;