aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/tasker.nix43
1 files changed, 19 insertions, 24 deletions
diff --git a/module/tasker.nix b/module/tasker.nix
index 8b51d94..4f2e0fe 100644
--- a/module/tasker.nix
+++ b/module/tasker.nix
@@ -1,36 +1,31 @@
{ pkgs, config, ... }:
let
+ launchCommandInDirectory = dir: cmd: ''
+ #!/bin/sh
+ pushd ${dir}
+ exec ${cmd}
+ popd
+ '';
+ launchTerminalInDirectory = dir: cmd: ''
+ #!/bin/sh
+ exec ${pkgs.kitty}/bin/kitty -d ${dir} ${cmd}
+ '';
+
taskivations = pkgs.lib.mapAttrsToList (name: conf: let
command = pkgs.writeTextFile {
name = "tasker_cmd_" + name;
executable = true;
destination = "/bin/tasker_cmd_" + name;
text = pkgs.lib.attrByPath [ conf.type ] "" {
- launcher = ''
- #!/bin/sh
- pushd ${conf.directory}
- exec ${conf.command}
- popd
- '';
- terminal = ''
- #!/bin/sh
- exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} ${conf.command}
- '';
- local-shell = ''
- #!/bin/sh
- exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} nix-shell --command fish
- '';
- local-editor = ''
- #!/bin/sh
- pushd ${conf.directory}
- exec nix-shell --run 'nvim-qt --no-ext-tabline'
- popd
- '';
- environment = ''
- #!/bin/sh
- exec ${pkgs.kitty}/bin/kitty -d ${conf.directory} nix-shell \
- ${builtins.unsafeDiscardStringContext conf.environment.drvPath} --command fish
+ launcher = launchCommandInDirectory conf.directory conf.command;
+ terminal = launchTerminalInDirectory conf.directory conf.command;
+
+ local-shell = launchTerminalInDirectory conf.directory "nix-shell --command fish";
+ local-editor = launchCommandInDirectory conf.directory "nix-shell --run 'nvim-qt --no-ext-tabline'";
+
+ environment = launchTerminalInDirectory conf.directory ''
+ nix-shell ${builtins.unsafeDiscardStringContext conf.environment.drvPath} --command fish
'';
};
};