bonsai: lift out of sxmo
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# bonsai docs: <https://sr.ht/~stacyharper/bonsai/>
|
# bonsai docs: <https://sr.ht/~stacyharper/bonsai/>
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.sane.gui.sxmo.bonsaid;
|
cfg = config.sane.programs.bonsai.config;
|
||||||
|
|
||||||
delayType = with lib; types.submodule {
|
delayType = with lib; types.submodule {
|
||||||
options = {
|
options = {
|
||||||
@@ -88,74 +88,43 @@ let
|
|||||||
mergeOneOption loc defs
|
mergeOneOption loc defs
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
# transitionType = with lib; types.submodule {
|
|
||||||
# options = {
|
|
||||||
# type = mkOption {
|
|
||||||
# type = types.enum [ "delay" "event" "exec" ];
|
|
||||||
# };
|
|
||||||
# delay_duration = mkOption {
|
|
||||||
# type = types.nullOr types.int;
|
|
||||||
# default = null;
|
|
||||||
# description = ''
|
|
||||||
# used for "delay" types only.
|
|
||||||
# nanoseconds until the event is finalized.
|
|
||||||
# '';
|
|
||||||
# };
|
|
||||||
# event_name = mkOption {
|
|
||||||
# type = types.nullOr types.str;
|
|
||||||
# default = null;
|
|
||||||
# description = ''
|
|
||||||
# name of event which this transition applies to.
|
|
||||||
# '';
|
|
||||||
# };
|
|
||||||
# transitions = mkOption {
|
|
||||||
# type = types.nullOr (types.listOf transitionType);
|
|
||||||
# default = null;
|
|
||||||
# description = ''
|
|
||||||
# list of transitions out of this state.
|
|
||||||
# '';
|
|
||||||
# };
|
|
||||||
# command = mkOption {
|
|
||||||
# type = types.nullOr (types.listOf types.str);
|
|
||||||
# default = null;
|
|
||||||
# description = ''
|
|
||||||
# used for "exec" types only.
|
|
||||||
# command to run when the event is triggered.
|
|
||||||
# '';
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = with lib; {
|
sane.programs.bonsai = {
|
||||||
sane.gui.sxmo.bonsaid.package = mkOption {
|
configOption = with lib; mkOption {
|
||||||
type = types.package;
|
default = {};
|
||||||
default = pkgs.bonsai;
|
type = types.submodule {
|
||||||
|
options = {
|
||||||
|
transitions = mkOption {
|
||||||
|
type = types.listOf transitionType;
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
configFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = pkgs.writeText "bonsai_tree.json" (builtins.toJSON cfg.transitions);
|
||||||
|
description = ''
|
||||||
|
configuration file to pass to bonsai.
|
||||||
|
usually auto-generated from the sibling options; exposed mainly for debugging or convenience.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
sane.gui.sxmo.bonsaid.transitions = mkOption {
|
|
||||||
type = types.listOf transitionType;
|
services.bonsaid = {
|
||||||
default = [];
|
description = "bonsai: programmable input dispatcher";
|
||||||
};
|
after = [ "graphical-session.target" ];
|
||||||
sane.gui.sxmo.bonsaid.configFile = mkOption {
|
wantedBy = [ "graphical-session.target" ];
|
||||||
type = types.path;
|
|
||||||
default = pkgs.writeText "bonsai_tree.json" (builtins.toJSON cfg.transitions);
|
|
||||||
description = ''
|
|
||||||
configuration file to pass to bonsai.
|
|
||||||
usually auto-generated from the sibling options; exposed mainly for debugging or convenience.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf config.sane.gui.sxmo.enable {
|
|
||||||
sane.user.services.bonsaid = {
|
|
||||||
description = "programmable input dispatcher";
|
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.coreutils}/bin/rm -f $XDG_RUNTIME_DIR/bonsai
|
${pkgs.coreutils}/bin/rm -f $XDG_RUNTIME_DIR/bonsai
|
||||||
exec ${cfg.package}/bin/bonsaid -t ${cfg.configFile}
|
exec ${cfg.package}/bin/bonsaid -t ${cfg.configFile}
|
||||||
'';
|
'';
|
||||||
serviceConfig.Type = "simple";
|
serviceConfig = {
|
||||||
serviceConfig.Restart = "always";
|
Type = "simple";
|
||||||
serviceConfig.RestartSec = "5s";
|
Restart = "always";
|
||||||
|
RestartSec = "5s";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
@@ -9,6 +9,7 @@
|
|||||||
./assorted.nix
|
./assorted.nix
|
||||||
./audacity.nix
|
./audacity.nix
|
||||||
./bemenu.nix
|
./bemenu.nix
|
||||||
|
./bonsai.nix
|
||||||
./brave.nix
|
./brave.nix
|
||||||
./bubblewrap.nix
|
./bubblewrap.nix
|
||||||
./calls.nix
|
./calls.nix
|
||||||
|
@@ -256,10 +256,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
|
||||||
./bonsai.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
sane.programs.sxmoApps = {
|
sane.programs.sxmoApps = {
|
||||||
@@ -267,6 +263,7 @@ in
|
|||||||
suggestedPrograms = [
|
suggestedPrograms = [
|
||||||
"guiApps"
|
"guiApps"
|
||||||
"bemenu" # specifically to import its theming
|
"bemenu" # specifically to import its theming
|
||||||
|
"bonsai"
|
||||||
"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
|
||||||
# "sway-autoscaler"
|
# "sway-autoscaler"
|
||||||
@@ -403,7 +400,6 @@ in
|
|||||||
# TODO: could use `displayManager.sessionPackages`?
|
# TODO: could use `displayManager.sessionPackages`?
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
package
|
package
|
||||||
pkgs.bonsai # sway (not sxmo) needs to exec `bonsaictl` by name (sxmo_swayinitconf.sh)
|
|
||||||
] ++ lib.optionals (cfg.terminal != null) [ pkgs."${cfg.terminal}" ]
|
] ++ lib.optionals (cfg.terminal != null) [ pkgs."${cfg.terminal}" ]
|
||||||
++ lib.optionals (cfg.keyboard != null) [ pkgs."${cfg.keyboard}" ];
|
++ lib.optionals (cfg.keyboard != null) [ pkgs."${cfg.keyboard}" ];
|
||||||
|
|
||||||
@@ -420,7 +416,7 @@ in
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
sane.gui.sxmo.bonsaid.transitions = let
|
sane.programs.bonsai.config.transitions = let
|
||||||
doExec = inputName: transitions: {
|
doExec = inputName: transitions: {
|
||||||
type = "exec";
|
type = "exec";
|
||||||
command = [
|
command = [
|
||||||
|
Reference in New Issue
Block a user