nixos/programs/gnome-session: update documentation and option visibility

This commit is contained in:
Gabriel Arazas 2024-07-30 18:28:37 +08:00
parent 81dadd8699
commit 9ef3e308f9
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
3 changed files with 14 additions and 13 deletions

View File

@ -12,16 +12,7 @@ let
# at <https://docs.gtk.org/glib/struct.KeyFile.html> for details about the # at <https://docs.gtk.org/glib/struct.KeyFile.html> for details about the
# keyfile formatting and possibly the Desktop Entry specification at # keyfile formatting and possibly the Desktop Entry specification at
# <https://freedesktop.org/wiki/Specifications/desktop-entry-spec>. # <https://freedesktop.org/wiki/Specifications/desktop-entry-spec>.
glibKeyfileFormat = pkgs.formats.ini { glibKeyfileFormat = {
listsAsDuplicateKeys = false;
mkKeyValue = lib.generators.mkKeyValueDefault {
mkValueString = v:
if lib.isList v then
lib.concatStringsSep ";" v
else
lib.generators.mkValueStringDefault { } v;
} "=";
} // {
type = with lib.types; type = with lib.types;
let let
valueType = oneOf [ valueType = oneOf [
@ -31,10 +22,14 @@ let
str str
(listOf valueType) (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 in
attrsOf (attrsOf valueType); 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. # The bulk of the work. Pretty much the main purpose of this module.
@ -43,7 +38,8 @@ let
let let
gnomeSession = glibKeyfileFormat.generate "session-${session.name}" session.settings; 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 = '' displaySession = ''
[Desktop Entry] [Desktop Entry]
Name=${session.fullName} Name=${session.fullName}
@ -53,6 +49,8 @@ let
DesktopNames=${lib.concatStringsSep ";" session.desktopNames} DesktopNames=${lib.concatStringsSep ";" session.desktopNames}
''; '';
# Similarly to the desktop session template, this is also set as a
# static template.
sessionScript = '' sessionScript = ''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell}

View File

@ -14,6 +14,7 @@ let
`restartTriggers`. `restartTriggers`.
::: :::
''; '';
visible = "shallow";
default = null; default = null;
}; };
in in

View File

@ -123,7 +123,7 @@ in
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = with lib.types; listOf str; type = with lib.types; listOf str;
description = '' 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. script.
::: {.note} ::: {.note}
@ -145,6 +145,7 @@ in
Generally, you won't need to set this since the module will set the Generally, you won't need to set this since the module will set the
common settings such as the `RequiredComponents=` key. common settings such as the `RequiredComponents=` key.
''; '';
default = { };
example = lib.literalExpression '' example = lib.literalExpression ''
{ {
"GNOME Session" = { "GNOME Session" = {
@ -211,6 +212,7 @@ in
`reloadTriggers` and `restartTriggers`. `reloadTriggers` and `restartTriggers`.
::: :::
''; '';
visible = "shallow";
defaultText = '' defaultText = ''
{ {
wants = ... # All of the required components as a target unit. wants = ... # All of the required components as a target unit.