diff options
author | Adrian Kummerlaender | 2019-02-25 12:05:20 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-02-25 12:05:20 +0100 |
commit | c82f4b2baff11e917f7799e6a5945a7e82cf2abe (patch) | |
tree | 5cd8b13a7a3bbe4f566fe0431e3f823d75b12a93 /module | |
parent | 52b136997fbe7243f508522bf0239932be80deb8 (diff) | |
download | nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar.gz nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar.bz2 nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar.lz nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar.xz nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.tar.zst nixos_home-c82f4b2baff11e917f7799e6a5945a7e82cf2abe.zip |
Wrap common Tasker scripts in functions
Diffstat (limited to 'module')
-rw-r--r-- | module/tasker.nix | 43 |
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 ''; }; }; |