diff --git a/hosts/modules/gui/sxmo/bonsai.nix b/hosts/modules/gui/sxmo/bonsai.nix index b62270e6..597f1137 100644 --- a/hosts/modules/gui/sxmo/bonsai.nix +++ b/hosts/modules/gui/sxmo/bonsai.nix @@ -1,13 +1,24 @@ -{ sxmoPath, sxmoEnvSetup, pkgs }: +{ config, lib, pkgs, ... }: +let + cfg = config.sane.gui.sxmo.bonsaid; +in { - description = "programmable input dispatcher"; - path = sxmoPath; - script = '' - ${sxmoEnvSetup} - ${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.Restart = "always"; - serviceConfig.RestartSec = "5s"; + options = with lib; { + sane.gui.sxmo.bonsaid.package = mkOption { + type = types.package; + default = pkgs.bonsai; + }; + }; + config = { + sane.user.services.bonsaid = { + description = "programmable input dispatcher"; + 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"; + }; + }; } diff --git a/hosts/modules/gui/sxmo/default.nix b/hosts/modules/gui/sxmo/default.nix index 62ad0f09..d38decc0 100644 --- a/hosts/modules/gui/sxmo/default.nix +++ b/hosts/modules/gui/sxmo/default.nix @@ -251,6 +251,10 @@ in }; }; + imports = [ + ./bonsai.nix + ]; + config = lib.mkMerge [ { sane.programs.sxmoApps = { @@ -535,9 +539,8 @@ in sxmo_wob = sxmoService "wob"; sxmo-x11-status = sxmoService "status_xsetroot"; - bonsaid = import ./bonsai.nix { - inherit sxmoPath sxmoEnvSetup pkgs; - }; + bonsaid.path = sxmoPath; + bonsaid.script = lib.mkBefore sxmoEnvSetup; }; }