blob: b3cf61b851be6f8d87640a2d2fc8eacb81b02ccc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{ pkgs, tasks, ... }:
pkgs.lib.mapAttrsToList (name: value: let
command = pkgs.writeTextFile {
name = "tasker_cmd_" + name;
executable = true;
destination = "/bin/tasker_cmd_" + name;
text = if value.terminal then ''
#!/bin/sh
exec ${pkgs.kitty}/bin/kitty -d ${value.directory} ${value.command}
'' else ''
#!/bin/sh
pushd ${value.directory}
exec ${value.command}
popd
'';
};
shortcut = pkgs.writeTextFile {
name = "tasker_shortcut_" + name;
executable = false;
destination = "/share/applications/tasker_shortcut_" + name + ".desktop";
text = ''
[Desktop Entry]
Type=Application
Name=${value.description}
GenericName=Tasker
Exec=${command}/bin/tasker_cmd_${name}
Terminal=false
'';
};
in pkgs.symlinkJoin {
name = "tasker_task_" + name;
paths = [ shortcut ];
}) tasks
|