mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 06:19:00 +00:00
nixos/programs/gnome-session: refactor and update comments
This commit is contained in:
parent
07510b2257
commit
e5d0f3279b
@ -1,4 +1,23 @@
|
|||||||
{ name, config, lib, utils, session, ... }: {
|
{ name, config, lib, utils, session, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
optionalSystemdUnitOption = type: systemdModuleAttribute:
|
||||||
|
lib.mkOption {
|
||||||
|
description = ''
|
||||||
|
An optional systemd ${type} configuration to be generated. This should
|
||||||
|
be configured if the session is managed by systemd.
|
||||||
|
|
||||||
|
:::{.note}
|
||||||
|
This has the same options as
|
||||||
|
{option}`systemd.user.${systemdModuleAttribute}.<name>` but without
|
||||||
|
certain options from stage 2 counterparts such as `reloadTriggers` and
|
||||||
|
`restartTriggers`.
|
||||||
|
:::
|
||||||
|
'';
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
description = lib.mkOption {
|
description = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
@ -99,7 +118,7 @@
|
|||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
timerUnit = lib.mkOption {
|
timerUnit = optionalSystemdUnitOption "timer" "timers" // {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
inherit (utils.systemdUtils.unitOptions) timerOptions commonUnitOptions;
|
inherit (utils.systemdUtils.unitOptions) timerOptions commonUnitOptions;
|
||||||
@ -110,20 +129,9 @@
|
|||||||
timerOptions
|
timerOptions
|
||||||
unitConfig
|
unitConfig
|
||||||
]);
|
]);
|
||||||
description = ''
|
|
||||||
An optional systemd timer configuration to be generated. This should
|
|
||||||
be configured if the session is managed by systemd.
|
|
||||||
|
|
||||||
:::{.note}
|
|
||||||
This has the same options as {option}`systemd.user.timers.<name>`
|
|
||||||
but without certain options from stage 2 counterparts such as
|
|
||||||
`reloadTriggers` and `restartTriggers`.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
socketUnit = lib.mkOption {
|
socketUnit = optionalSystemdUnitOption "socket" "sockets" // {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
inherit (utils.systemdUtils.unitOptions) socketOptions commonUnitOptions;
|
inherit (utils.systemdUtils.unitOptions) socketOptions commonUnitOptions;
|
||||||
@ -134,20 +142,9 @@
|
|||||||
socketOptions
|
socketOptions
|
||||||
unitConfig
|
unitConfig
|
||||||
]);
|
]);
|
||||||
description = ''
|
};
|
||||||
An optional systemd socket configuration to be generated. This should
|
|
||||||
be configured if the session is managed by systemd.
|
|
||||||
|
|
||||||
:::{.note}
|
pathUnit = optionalSystemdUnitOption "path" "paths" // {
|
||||||
This has the same options as {option}`systemd.user.sockets.<name>`
|
|
||||||
but without certain options from stage 2 counterparts such as
|
|
||||||
`reloadTriggers` and `restartTriggers`.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
pathUnit = lib.mkOption {
|
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
inherit (utils.systemdUtils.unitOptions) pathOptions commonUnitOptions;
|
inherit (utils.systemdUtils.unitOptions) pathOptions commonUnitOptions;
|
||||||
@ -158,17 +155,6 @@
|
|||||||
pathOptions
|
pathOptions
|
||||||
unitConfig
|
unitConfig
|
||||||
]);
|
]);
|
||||||
description = ''
|
|
||||||
An optional systemd path configuration to be generated. This should
|
|
||||||
be configured if the session is managed by systemd.
|
|
||||||
|
|
||||||
:::{.note}
|
|
||||||
This has the same options as {option}`systemd.user.paths.<name>`
|
|
||||||
but without certain options from stage 2 counterparts such as
|
|
||||||
`reloadTriggers` and `restartTriggers`.
|
|
||||||
:::
|
|
||||||
'';
|
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
id = lib.mkOption {
|
id = lib.mkOption {
|
||||||
@ -229,14 +215,6 @@
|
|||||||
* Most sandboxing options. Aside from the fact we're dealing with a
|
* Most sandboxing options. Aside from the fact we're dealing with a
|
||||||
systemd user unit, much of them are unnecessary and rarely needed (if
|
systemd user unit, much of them are unnecessary and rarely needed (if
|
||||||
ever like `Service.PrivateTmp=`?) so we didn't set such defaults here.
|
ever like `Service.PrivateTmp=`?) so we didn't set such defaults here.
|
||||||
|
|
||||||
As you can tell, this module does not provide a framework for the user
|
|
||||||
to easily compose their own desktop environment. THIS MODULE ALREADY
|
|
||||||
DOES A LOT, ALRIGHT! CUT ME SOME SLACK!
|
|
||||||
|
|
||||||
Take note that the default service configuration is leaning on the
|
|
||||||
desktop component being a simple type of service like how most NixOS
|
|
||||||
service modules are deployed.
|
|
||||||
*/
|
*/
|
||||||
serviceUnit = {
|
serviceUnit = {
|
||||||
script = lib.mkAfter config.script;
|
script = lib.mkAfter config.script;
|
||||||
@ -270,14 +248,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Similarly, there are things that COULD make it here but didn't for a
|
Take note the session target unit already has `Wants=$COMPONENT.target`
|
||||||
variety of reasons.
|
so no need to set dependency ordering directives here.
|
||||||
|
|
||||||
* `Unit.PartOf=`, `Unit.Requisite=`, and the like since some components
|
|
||||||
require starting up earlier than the others. We could include it here
|
|
||||||
if we make it clear in the documentation or if it proves to be a
|
|
||||||
painful experience to configure this by a first-timer. For now, this is
|
|
||||||
on the user to know.
|
|
||||||
*/
|
*/
|
||||||
targetUnit = {
|
targetUnit = {
|
||||||
wants = [ "${config.id}.service" ];
|
wants = [ "${config.id}.service" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user