mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
nixos/programs/sessiond: add session example
This commit is contained in:
parent
537f4910f5
commit
952fde19cf
@ -89,6 +89,84 @@ in
|
||||
};
|
||||
modules = [ ./submodules/session-type.nix ];
|
||||
});
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
"com.example.Beepeedobolyuessemm" = {
|
||||
description = "Simple desktop environment featuring bspwm";
|
||||
desktopNames = [ "Beepeedobolyuessemm" ];
|
||||
|
||||
settings = {
|
||||
Idle = {
|
||||
Inputs = [ "motion" "button-press" "key-press" ];
|
||||
IdleSec = 120;
|
||||
};
|
||||
|
||||
Lock = {
|
||||
OnIdle = true;
|
||||
OnSleep = true;
|
||||
MuteAudio = true;
|
||||
};
|
||||
|
||||
Hook = [
|
||||
{
|
||||
Trigger = "Idle";
|
||||
ExecStart = "''${lib.getExe' pkgs.betterlockscreen "betterlockscreen"} --off 240";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
components = {
|
||||
window-manager = {
|
||||
description = "Window manager";
|
||||
|
||||
serviceUnit = {
|
||||
# This is required for sessiond to recognize which unit is the
|
||||
# window manager.
|
||||
aliases = [ "window-manager.service" ];
|
||||
|
||||
script = '''
|
||||
''${lib.getExe' pkgs.bspwm "bspwm"} -c ''${./config/bspwm/bspwmrc}
|
||||
''';
|
||||
|
||||
serviceConfig = {
|
||||
ExecStopPost = "''${lib.getExe' sessiondPkg "sessionctl"} stop";
|
||||
OOMScoreAdjust = -1000;
|
||||
};
|
||||
};
|
||||
|
||||
targetUnit = {
|
||||
requires = [ "sessiond-session.target" ];
|
||||
partOf = [ "sessiond-session.target" ];
|
||||
wantedBy = [ "sessiond-session.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
hotkey-daemon = {
|
||||
description = "Hotkey daemon";
|
||||
|
||||
serviceUnit = {
|
||||
documentation = [ "man:sxhkd(1)" ];
|
||||
|
||||
script = '''
|
||||
''${lib.getExe' pkgs.sxhkd "sxhkd"} -c ''${./config/sxhkd/bindings}
|
||||
''';
|
||||
|
||||
serviceConfig = {
|
||||
ExecReload = "''${lib.getExe' pkgs.coreutils "kill"} -SIGUSR1 $MAINPID";
|
||||
ExecStopPost = "''${lib.getExe' sessiondPkg "sessionctl"} stop";
|
||||
OOMScoreAdjust = -1000;
|
||||
};
|
||||
};
|
||||
|
||||
targetUnit = {
|
||||
after = [ "display-manager.service" ];
|
||||
partOf = [ "sessiond-session.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
A set of desktop sessions to be configured with sessiond. Each of the
|
||||
attribute name will be used as the identifier of the desktop
|
||||
@ -117,8 +195,8 @@ in
|
||||
systemd.packages = [ cfg.package ];
|
||||
systemd.user.units = lib.mkMerge sessionSystemdUnits;
|
||||
|
||||
# We're disabling the upstream sessiond service since there can be multiple
|
||||
# sessiond sessions here.
|
||||
# We're disabling the upstream sessiond service since we have our own set
|
||||
# of sessiond sessions here.
|
||||
systemd.user.services.sessiond.enable = false;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user