sxmo: finish porting to systemd (everything tested works now)
This commit is contained in:
parent
45e5752a05
commit
045b5f0294
|
@ -246,12 +246,12 @@ in
|
||||||
"guiApps"
|
"guiApps"
|
||||||
"bemenu" # specifically to import its theming
|
"bemenu" # specifically to import its theming
|
||||||
"sfeed" # want this here so that the user's ~/.sfeed/sfeedrc gets created
|
"sfeed" # want this here so that the user's ~/.sfeed/sfeedrc gets created
|
||||||
"superd" # make superctl (used by sxmo) be on PATH
|
# "superd" # make superctl (used by sxmo) be on PATH
|
||||||
];
|
];
|
||||||
|
|
||||||
persist.cryptClearOnBoot = [
|
persist.cryptClearOnBoot = [
|
||||||
# builds to be 10's of MB per day
|
# builds to be 10's of MB per day
|
||||||
".local/state/superd/logs"
|
# ".local/state/superd/logs"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -413,25 +413,25 @@ in
|
||||||
# start the service many times.
|
# start the service many times.
|
||||||
# see <repo:craftyguy/superd:internal/cmd/cmd.go>
|
# see <repo:craftyguy/superd:internal/cmd/cmd.go>
|
||||||
# TODO: better fix may be to patch `sxmo_hook_lisgdstart.sh` and force it to behave as a singleton
|
# TODO: better fix may be to patch `sxmo_hook_lisgdstart.sh` and force it to behave as a singleton
|
||||||
systemd.services."dedupe-sxmo-lisgd" = {
|
# systemd.services."dedupe-sxmo-lisgd" = {
|
||||||
description = "kill duplicate lisgd processes started by superd";
|
# description = "kill duplicate lisgd processes started by superd";
|
||||||
serviceConfig = {
|
# serviceConfig = {
|
||||||
Type = "oneshot";
|
# Type = "oneshot";
|
||||||
};
|
# };
|
||||||
script = ''
|
# script = ''
|
||||||
if [ "$(${pkgs.procps}/bin/pgrep -c lisgd)" -gt 1 ]; then
|
# if [ "$(${pkgs.procps}/bin/pgrep -c lisgd)" -gt 1 ]; then
|
||||||
echo 'killing duplicated lisgd daemons'
|
# echo 'killing duplicated lisgd daemons'
|
||||||
${pkgs.psmisc}/bin/killall lisgd # let superd restart it
|
# ${pkgs.psmisc}/bin/killall lisgd # let superd restart it
|
||||||
fi
|
# fi
|
||||||
'';
|
# '';
|
||||||
wantedBy = [ "multi-user.target" ];
|
# wantedBy = [ "multi-user.target" ];
|
||||||
};
|
# };
|
||||||
systemd.timers."dedupe-sxmo-lisgd" = {
|
# systemd.timers."dedupe-sxmo-lisgd" = {
|
||||||
wantedBy = [ "dedupe-sxmo-lisgd.service" ];
|
# wantedBy = [ "dedupe-sxmo-lisgd.service" ];
|
||||||
timerConfig = {
|
# timerConfig = {
|
||||||
OnUnitActiveSec = "2min";
|
# OnUnitActiveSec = "2min";
|
||||||
};
|
# };
|
||||||
};
|
# };
|
||||||
|
|
||||||
sane.user.fs = lib.mkMerge [
|
sane.user.fs = lib.mkMerge [
|
||||||
{
|
{
|
||||||
|
@ -483,14 +483,28 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
sane.user.services = let
|
sane.user.services = let
|
||||||
sxmoPath = [ "/home/colin/.config/sxmo/hooks" package ] ++ package.runtimeDeps ++ [
|
sxmoPath = [
|
||||||
"/run/current-system/sw" # for flock wrapper
|
"/etc/profiles/per-user/colin" # so as to launch user-enabled applications (like g4music, etc)
|
||||||
"/run/wrappers" # for doas
|
"/run/wrappers" # for doas, and anything else suid
|
||||||
];
|
"/run/current-system/sw" # for things installed system-wide, especially flock
|
||||||
|
] ++ [ package ] ++ package.runtimeDeps;
|
||||||
|
sxmoEnvSetup = ''
|
||||||
|
# mimic my sxmo_init.sh a bit. refer to the actual sxmo_init.sh above for details.
|
||||||
|
# the specific ordering, and the duplicated profile sourcing, matters.
|
||||||
|
export HOME="''${HOME:-/home/colin}"
|
||||||
|
export XDG_CONFIG_HOME="''${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
|
source "$XDG_CONFIG_HOME/sxmo/profile"
|
||||||
|
source ${package}/etc/profile.d/sxmo_init.sh
|
||||||
|
source "$XDG_CONFIG_HOME/sxmo/profile"
|
||||||
|
export PATH="$XDG_CONFIG_HOME/sxmo/hooks:$PATH"
|
||||||
|
'';
|
||||||
sxmoService = name: {
|
sxmoService = name: {
|
||||||
description = "sxmo ${name}";
|
description = "sxmo ${name}";
|
||||||
path = sxmoPath;
|
path = sxmoPath;
|
||||||
serviceConfig.ExecStart = "${pkgs.coreutils}/bin/env sxmo_${name}.sh";
|
script = ''
|
||||||
|
${sxmoEnvSetup}
|
||||||
|
exec sxmo_${name}.sh
|
||||||
|
'';
|
||||||
serviceConfig.Type = "simple";
|
serviceConfig.Type = "simple";
|
||||||
serviceConfig.Restart = "always";
|
serviceConfig.Restart = "always";
|
||||||
serviceConfig.RestartSec = "20s";
|
serviceConfig.RestartSec = "20s";
|
||||||
|
@ -511,13 +525,14 @@ in
|
||||||
bonsaid = {
|
bonsaid = {
|
||||||
description = "programmable input dispatcher";
|
description = "programmable input dispatcher";
|
||||||
path = sxmoPath;
|
path = sxmoPath;
|
||||||
# systemd expands %E to $XDG_CONFIG_HOME
|
script = ''
|
||||||
serviceConfig.ExecStart = "${pkgs.bonsai}/bin/bonsaid -t %E/sxmo/bonsai_tree.json";
|
${sxmoEnvSetup}
|
||||||
serviceConfig.ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/bonsai"; # systemd expands %t to $XDG_RUNTIME_DIR
|
${pkgs.coreutils}/bin/rm -f $XDG_RUNTIME_DIR/bonsai
|
||||||
|
exec ${pkgs.bonsai}/bin/bonsaid -t $XDG_CONFIG_HOME/sxmo/bonsai_tree.json
|
||||||
|
'';
|
||||||
serviceConfig.Type = "simple";
|
serviceConfig.Type = "simple";
|
||||||
serviceConfig.Restart = "always";
|
serviceConfig.Restart = "always";
|
||||||
serviceConfig.RestartSec = "5s";
|
serviceConfig.RestartSec = "5s";
|
||||||
environment.SXMO_STATE = "/run/user/1000/sxmo.state"; #< TODO: this is $XDG_RUNTIME_DIR/sxmo.state
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user