From 52b136997fbe7243f508522bf0239932be80deb8 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 24 Feb 2019 21:45:28 +0100 Subject: Move Tasker into module folder --- module/tasker.nix | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 module/tasker.nix (limited to 'module') diff --git a/module/tasker.nix b/module/tasker.nix new file mode 100644 index 0000000..8b51d94 --- /dev/null +++ b/module/tasker.nix @@ -0,0 +1,59 @@ +{ pkgs, config, ... }: + +let + 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 + ''; + }; + }; + + shortcut = pkgs.writeTextFile { + name = "tasker_shortcut_" + name; + executable = false; + destination = "/share/applications/tasker_shortcut_" + name + ".desktop"; + text = '' + [Desktop Entry] + Type=Application + Name=${conf.description} + GenericName=Tasker + Exec=${command}/bin/tasker_cmd_${name} + Terminal=false + ''; + }; + + in pkgs.symlinkJoin { + name = "tasker_task_" + name; + paths = [ shortcut ]; + }) config.custom.tasks; + +in { + home.packages = taskivations; +} -- cgit v1.2.3