From 9ef3e308f9ef78bda85e083787b411a1dd16557b Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Tue, 30 Jul 2024 18:28:37 +0800 Subject: [PATCH] nixos/programs/gnome-session: update documentation and option visibility --- .../nixos/programs/gnome-session/default.nix | 22 +++++++++---------- .../submodules/component-type.nix | 1 + .../gnome-session/submodules/session-type.nix | 4 +++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/nixos/programs/gnome-session/default.nix b/modules/nixos/programs/gnome-session/default.nix index 53ed27fb..21080ef1 100644 --- a/modules/nixos/programs/gnome-session/default.nix +++ b/modules/nixos/programs/gnome-session/default.nix @@ -12,16 +12,7 @@ let # at for details about the # keyfile formatting and possibly the Desktop Entry specification at # . - glibKeyfileFormat = pkgs.formats.ini { - listsAsDuplicateKeys = false; - mkKeyValue = lib.generators.mkKeyValueDefault { - mkValueString = v: - if lib.isList v then - lib.concatStringsSep ";" v - else - lib.generators.mkValueStringDefault { } v; - } "="; - } // { + glibKeyfileFormat = { type = with lib.types; let valueType = oneOf [ @@ -31,10 +22,14 @@ let str (listOf valueType) ] // { - description = "GLib keyfile atom (null, bool, int, float, string, or a list of the previous atoms)"; + description = "GLib keyfile atom (bool, int, float, string, or a list of the previous atoms)"; }; in attrsOf (attrsOf valueType); + + generate = name: value: + pkgs.callPackage ({ writeText }: + writeText name (lib.generators.toDconfINI value)); }; # The bulk of the work. Pretty much the main purpose of this module. @@ -43,7 +38,8 @@ let let gnomeSession = glibKeyfileFormat.generate "session-${session.name}" session.settings; - # For now, we set this as a + # For now, we set this as a static template since there's not much + # things to configure especially for a desktop session anyways. displaySession = '' [Desktop Entry] Name=${session.fullName} @@ -53,6 +49,8 @@ let DesktopNames=${lib.concatStringsSep ";" session.desktopNames} ''; + # Similarly to the desktop session template, this is also set as a + # static template. sessionScript = '' #!${pkgs.runtimeShell} diff --git a/modules/nixos/programs/gnome-session/submodules/component-type.nix b/modules/nixos/programs/gnome-session/submodules/component-type.nix index 77b7a5bd..fda99823 100644 --- a/modules/nixos/programs/gnome-session/submodules/component-type.nix +++ b/modules/nixos/programs/gnome-session/submodules/component-type.nix @@ -14,6 +14,7 @@ let `restartTriggers`. ::: ''; + visible = "shallow"; default = null; }; in diff --git a/modules/nixos/programs/gnome-session/submodules/session-type.nix b/modules/nixos/programs/gnome-session/submodules/session-type.nix index 7a0a1d57..1f90817c 100644 --- a/modules/nixos/programs/gnome-session/submodules/session-type.nix +++ b/modules/nixos/programs/gnome-session/submodules/session-type.nix @@ -123,7 +123,7 @@ in extraArgs = lib.mkOption { type = with lib.types; listOf str; description = '' - A list of arguments from {program}`gnome-session` to be added for the session + A list of arguments from {command}`gnome-session` to be added for the session script. ::: {.note} @@ -145,6 +145,7 @@ in Generally, you won't need to set this since the module will set the common settings such as the `RequiredComponents=` key. ''; + default = { }; example = lib.literalExpression '' { "GNOME Session" = { @@ -211,6 +212,7 @@ in `reloadTriggers` and `restartTriggers`. ::: ''; + visible = "shallow"; defaultText = '' { wants = ... # All of the required components as a target unit.