mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 06:19:00 +00:00
programs/gnome-session: add requiredComponents
for session
This is to make requiring desktop components from other packages easier.
This commit is contained in:
parent
03cf7914ff
commit
da5a938a8a
@ -408,6 +408,30 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
requiredComponents = lib.mkOption {
|
||||||
|
type = with lib.types; listOf str;
|
||||||
|
description = ''
|
||||||
|
A list of desktop components as part of `RequiredComponents=` for the
|
||||||
|
gnome-session configuration.
|
||||||
|
|
||||||
|
::: {.note}
|
||||||
|
For the most part, this shouldn't require manually configuring it if
|
||||||
|
you set {option}`<session>.components` as this module already sets
|
||||||
|
them for you.
|
||||||
|
|
||||||
|
The only time you manually set this if you want to require components
|
||||||
|
from other desktop such as when creating a customized version of
|
||||||
|
GNOME.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
example = [
|
||||||
|
"org.gnome.Shell"
|
||||||
|
"org.gnome.SettingsDaemon.A11ySettings"
|
||||||
|
"org.gnome.SettingsDaemon.Power"
|
||||||
|
"org.gnome.SettingsDaemon.Wacom"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
targetUnit = lib.mkOption {
|
targetUnit = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
@ -419,10 +443,16 @@ let
|
|||||||
unitConfig
|
unitConfig
|
||||||
];
|
];
|
||||||
description = ''
|
description = ''
|
||||||
systemd target configuration to be generated. This should be
|
systemd target configuration to be generated for
|
||||||
configured if the session is managed by systemd and you want to
|
`gnome-session@<name>.target`. This should be configured if the
|
||||||
control the session further (which is recommended since this module
|
session is managed by systemd and you want to control the session
|
||||||
don't know what components are more important, etc.).
|
further (which is recommended since this module don't know what
|
||||||
|
components are more important, etc.).
|
||||||
|
|
||||||
|
By default, the session target will have all of its components from
|
||||||
|
{option}`<session>.requiredComponents` under `Wants=` directive. It
|
||||||
|
also assumes all of them have a target unit at
|
||||||
|
`''${requiredComponent}.target`.
|
||||||
|
|
||||||
:::{.note}
|
:::{.note}
|
||||||
This has the same options as {option}`systemd.user.targets.<name>`
|
This has the same options as {option}`systemd.user.targets.<name>`
|
||||||
@ -432,7 +462,7 @@ let
|
|||||||
'';
|
'';
|
||||||
defaultText = ''
|
defaultText = ''
|
||||||
{
|
{
|
||||||
wants = ... # All of the components.
|
wants = ... # All of the required components as a target unit.
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@ -495,21 +525,22 @@ let
|
|||||||
"gnome-session@${name}.target" = targetToUnit "gnome-session@${name}" config.targetUnit;
|
"gnome-session@${name}.target" = targetToUnit "gnome-session@${name}" config.targetUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# By default. set the required components from the given desktop
|
||||||
|
# components.
|
||||||
|
requiredComponents = lib.mapAttrsToList (_: component: component.id) config.components;
|
||||||
|
|
||||||
targetUnit = {
|
targetUnit = {
|
||||||
overrideStrategy = lib.mkForce "asDropin";
|
overrideStrategy = lib.mkForce "asDropin";
|
||||||
wants = lib.mkDefault (lib.mapAttrsToList (_: component: "${component.id}.target") config.components);
|
wants = lib.mkDefault (builtins.map (c: "${c}.target") config.requiredComponents);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# The bulk of the work. Pretty much the main purpose of this module.
|
||||||
sessionPackage =
|
sessionPackage =
|
||||||
let
|
let
|
||||||
requiredComponents = lib.mapAttrsToList
|
|
||||||
(_: component: component.id)
|
|
||||||
config.components;
|
|
||||||
|
|
||||||
gnomeSession = ''
|
gnomeSession = ''
|
||||||
[GNOME Session]
|
[GNOME Session]
|
||||||
Name=${config.fullName} session
|
Name=${config.fullName} session
|
||||||
RequiredComponents=${lib.concatStringsSep ";" requiredComponents};
|
RequiredComponents=${lib.concatStringsSep ";" config.requiredComponents};
|
||||||
'';
|
'';
|
||||||
|
|
||||||
displaySession = ''
|
displaySession = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user