sxmo.bonsaid: make it a proper nix module

This commit is contained in:
Colin 2023-11-20 02:31:23 +00:00
parent 9cc72c09dc
commit b7247f6082
2 changed files with 28 additions and 14 deletions

View File

@ -1,13 +1,24 @@
{ sxmoPath, sxmoEnvSetup, pkgs }: { config, lib, pkgs, ... }:
let
cfg = config.sane.gui.sxmo.bonsaid;
in
{ {
description = "programmable input dispatcher"; options = with lib; {
path = sxmoPath; sane.gui.sxmo.bonsaid.package = mkOption {
script = '' type = types.package;
${sxmoEnvSetup} default = pkgs.bonsai;
${pkgs.coreutils}/bin/rm -f $XDG_RUNTIME_DIR/bonsai };
exec ${pkgs.bonsai}/bin/bonsaid -t $XDG_CONFIG_HOME/sxmo/bonsai_tree.json };
''; config = {
serviceConfig.Type = "simple"; sane.user.services.bonsaid = {
serviceConfig.Restart = "always"; description = "programmable input dispatcher";
serviceConfig.RestartSec = "5s"; script = ''
${pkgs.coreutils}/bin/rm -f $XDG_RUNTIME_DIR/bonsai
exec ${cfg.package}/bin/bonsaid -t $XDG_CONFIG_HOME/sxmo/bonsai_tree.json
'';
serviceConfig.Type = "simple";
serviceConfig.Restart = "always";
serviceConfig.RestartSec = "5s";
};
};
} }

View File

@ -251,6 +251,10 @@ in
}; };
}; };
imports = [
./bonsai.nix
];
config = lib.mkMerge [ config = lib.mkMerge [
{ {
sane.programs.sxmoApps = { sane.programs.sxmoApps = {
@ -535,9 +539,8 @@ in
sxmo_wob = sxmoService "wob"; sxmo_wob = sxmoService "wob";
sxmo-x11-status = sxmoService "status_xsetroot"; sxmo-x11-status = sxmoService "status_xsetroot";
bonsaid = import ./bonsai.nix { bonsaid.path = sxmoPath;
inherit sxmoPath sxmoEnvSetup pkgs; bonsaid.script = lib.mkBefore sxmoEnvSetup;
};
}; };
} }