diff options
author | Patrick Chilton <chpatrick@gmail.com> | 2021-02-21 23:17:27 +0100 |
---|---|---|
committer | Patrick Chilton <chpatrick@gmail.com> | 2021-05-28 13:10:17 +0200 |
commit | 424cd7d999bb9a35ec3a545883530f9c7c9fd6c1 (patch) | |
tree | d73f58e8fee07b622ca4ebe376aec9b8dcfb2da4 /nixos | |
parent | 572eb44019605daee52760585084d2f31a1ec1ba (diff) |
gnome-flashback: add option to remove gnome-panel, auto-generate wmName
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/x11/desktop-managers/gnome.nix | 61 | ||||
-rw-r--r-- | nixos/modules/services/x11/desktop-managers/gnome.xml | 1 |
2 files changed, 41 insertions, 21 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/gnome.nix b/nixos/modules/services/x11/desktop-managers/gnome.nix index bacada9cbe74c..c5e6caeea9027 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome.nix @@ -56,6 +56,12 @@ let ''; flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0; + flashbackWms = optional cfg.flashback.enableMetacity { + wmName = "metacity"; + wmLabel = "Metacity"; + wmCommand = "${pkgs.gnome.metacity}/bin/metacity"; + enableGnomePanel = true; + } ++ cfg.flashback.customSessions; notExcluded = pkg: mkDefault (!(lib.elem pkg config.environment.gnome.excludePackages)); @@ -216,20 +222,25 @@ in debug = mkEnableOption "gnome-session debug messages"; flashback = { - enableMetacity = mkEnableOption "the standard GNOME Flashback session with Metacity"; + enableMetacity = mkOption { + type = types.bool; + default = true; + example = "false"; + description = "Whether to enable the standard Metacity GNOME flashback session."; + }; customSessions = mkOption { type = types.listOf (types.submodule { options = { wmName = mkOption { - type = types.str; - description = "The filename-compatible name of the window manager to use."; + type = types.strMatching "[a-zA-Z0-9_-]+"; + description = "A unique identifier for the window manager."; example = "xmonad"; }; wmLabel = mkOption { type = types.str; - description = "The pretty name of the window manager to use."; + description = "The name of the window manager to show in the session chooser."; example = "XMonad"; }; @@ -238,6 +249,13 @@ in description = "The executable of the window manager to use."; example = "\${pkgs.haskellPackages.xmonad}/bin/xmonad"; }; + + enableGnomePanel = mkOption { + type = types.bool; + default = true; + example = "false"; + description = "Whether to enable the GNOME panel in this session."; + }; }; }); default = []; @@ -295,14 +313,18 @@ in }) (mkIf flashbackEnabled { - services.xserver.displayManager.sessionPackages = map - (wm: pkgs.gnome.gnome-flashback.mkSessionForWm { - inherit (wm) wmName wmLabel wmCommand; - }) (optional cfg.flashback.enableMetacity { - wmName = "metacity"; - wmLabel = "Metacity"; - wmCommand = "${pkgs.gnome.metacity}/bin/metacity"; - } ++ cfg.flashback.customSessions); + services.xserver.displayManager.sessionPackages = + let + wmNames = map (wm: wm.wmName) flashbackWms; + namesAreUnique = lib.unique wmNames == wmNames; + in + assert (assertMsg namesAreUnique "Flashback WM names must be unique."); + map + (wm: + pkgs.gnome.gnome-flashback.mkSessionForWm { + inherit (wm) wmName wmLabel wmCommand enableGnomePanel; + } + ) flashbackWms; security.pam.services.gnome-flashback = { enableGnomeKeyring = true; @@ -310,15 +332,12 @@ in systemd.packages = with pkgs.gnome; [ gnome-flashback - ] ++ (map - (wm: gnome-flashback.mkSystemdTargetForWm { - inherit (wm) wmName; - }) cfg.flashback.customSessions); - - # gnome-panel needs these for menu applet - environment.sessionVariables.XDG_DATA_DIRS = [ "${pkgs.gnome.gnome-flashback}/share" ]; - # TODO: switch to sessionVariables (resolve conflict) - environment.variables.XDG_CONFIG_DIRS = [ "${pkgs.gnome.gnome-flashback}/etc/xdg" ]; + ] ++ map gnome-flashback.mkSystemdTargetForWm flashbackWms; + + # gnome-panel needs these for menu applet + environment.sessionVariables.XDG_DATA_DIRS = [ "${pkgs.gnome.gnome-flashback}/share" ]; + # TODO: switch to sessionVariables (resolve conflict) + environment.variables.XDG_CONFIG_DIRS = [ "${pkgs.gnome.gnome-flashback}/etc/xdg" ]; }) (mkIf serviceCfg.core-os-services.enable { diff --git a/nixos/modules/services/x11/desktop-managers/gnome.xml b/nixos/modules/services/x11/desktop-managers/gnome.xml index 624d5c894e74c..6c53bacacb322 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome.xml +++ b/nixos/modules/services/x11/desktop-managers/gnome.xml @@ -120,6 +120,7 @@ wmName = "xmonad"; wmLabel = "XMonad"; wmCommand = "${pkgs.haskellPackages.xmonad}/bin/xmonad"; + enableGnomePanel = false; } ]; </programlisting> |