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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
{
pkgs,
lib,
sysLib,
config,
...
}: let
write_script = {
name,
path,
dependencies,
}:
sysLib.writeShellScriptWithLibrary {
inherit name;
src = ./scripts/${path}/${name};
dependencies = dependencies ++ [pkgs.dash];
};
aumo-scr = write_script {
name = "aumo";
path = "apps";
dependencies = builtins.attrValues {inherit (pkgs) udisks gawk gnused gnugrep sudo;};
};
con2pdf-scr = sysLib.writeShellScriptWithLibrary {
name = "con2pdf";
src = ./scripts/apps/con2pdf;
dependencies = builtins.attrValues {inherit (pkgs) sane-backends imagemagick coreutils fd;};
generateCompletions = true;
replacementStrings = {
DEVICE_FUNCTION =
# This is here, because escaping the whole function, to use it in the shell script
# directly just isn't possible
pkgs.writeText "DEVICE_FUNCTION"
/*
bash
*/
''
scanimage -L | awk 'BEGIN { FS = "`" } { gsub(/'.*/, "", $2); print $2 }'
'';
};
};
dldragon-scr = write_script {
name = "dldragon";
path = "small_functions";
dependencies = builtins.attrValues {inherit (pkgs) curl xdragon;};
};
gtk-themes-scr = write_script {
name = "gtk-themes";
path = "small_functions";
dependencies = builtins.attrValues {inherit (pkgs) glib;};
};
screen_shot-scr = write_script {
name = "screen_shot";
path = "small_functions";
dependencies = builtins.attrValues {inherit (pkgs) grim slurp alacritty;}; # TODO: add llp
};
mocs-scr = write_script {
name = "mocs";
path = "small_functions";
dependencies = builtins.attrValues {inherit (pkgs) ncmpc procps;}; # TODO: add mymocp
};
neorg-scr = sysLib.writeShellScriptWithLibraryAndKeepPath {
name = "neorg";
src = ./scripts/wrappers/neorg;
dependencies = with pkgs; [
cocogitto
git-crypt
rofi
libnotify
];
generateCompletions = true;
replacementStrings = {
DEFAULT_NEORG_PROJECT_DIR =
config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces.projects;
HOME_TASKRC = "${config.xdg.configHome}/task/home-manager-taskrc";
ALL_PROJECTS_NEWLINE = "${config.soispha.taskwarrior.projects.projects_newline}";
ALL_PROJECTS_COMMA = "${config.soispha.taskwarrior.projects.projects_comma}";
ALL_PROJECTS_PIPE = "${config.soispha.taskwarrior.projects.projects_pipe}";
ALL_WORKSPACES = "${lib.strings.concatStringsSep "|" (builtins.attrNames config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces)}";
ID_GENERATION_FUNCTION =
# This is here, because escaping the whole function, to use it in the shell script
# directly just isn't possible
pkgs.writeText "ID_GENERATION_FUNCTION"
/*
bash
*/
''
`(wc="$(task project:"$(task _get rc.context)" _ids)"; if [ "$wc" ]; then echo "$wc"; else echo "0"; fi ) | xargs task _zshids | awk -F: -v s="'" '{print $1 ":" s $2 s}'`
'';
# TODO: Replace the hard-coded path here with some reference <2023-10-20>
TASK_PROJECT_FILE = "/home/soispha/repos/nix/nixos-config/hm/soispha/conf/taskwarrior/projects/default.nix";
};
};
update-sys-scr = write_script {
name = "update-sys";
path = "small_functions";
dependencies = builtins.attrValues {inherit (pkgs) git git-crypt nixos-rebuild sudo openssh coreutils mktemp gnugrep gnused;};
};
ll-scr = sysLib.writeShellScriptWithLibraryUnwrapped {
name = "ll";
src = ./scripts/wrappers/ll;
};
# TODO: this need to be replaced with a wayland alternative
# llp-scr = write_script {
# name = "llp";
# path = "wrappers";
# dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;};
# };
spodi-scr = write_script {
name = "spodi";
path = "wrappers";
dependencies = builtins.attrValues {inherit (pkgs) gawk expect spotdl fd coreutils;};
};
virsh-del-scr = write_script {
name = "virsh-del";
path = "wrappers";
dependencies = builtins.attrValues {inherit (pkgs) libvirt;};
};
yti-scr = write_script {
name = "yti";
path = "wrappers";
dependencies = builtins.attrValues {inherit (pkgs) gawk expect yt-dlp;};
};
in [
aumo-scr
con2pdf-scr
dldragon-scr
gtk-themes-scr
ll-scr
# llp-scr # TODO: see above
mocs-scr
neorg-scr
screen_shot-scr
# spodi-scr # # TODO: Reactivate when spotdl builds again <2023-10-31>
update-sys-scr
virsh-del-scr
yti-scr
]
|