diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2023-02-25 13:27:37 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2023-02-25 13:27:37 +0100 |
commit | f122223243cbb50fa65d96646bc06f53567fd815 (patch) | |
tree | c14a2c875e2c56131857fa98f13a7e26581a3782 /accounts | |
parent | 07f9ba7096d0db355d87147468990bc30b732a00 (diff) | |
download | nixos-f122223243cbb50fa65d96646bc06f53567fd815.tar nixos-f122223243cbb50fa65d96646bc06f53567fd815.tar.gz nixos-f122223243cbb50fa65d96646bc06f53567fd815.tar.bz2 nixos-f122223243cbb50fa65d96646bc06f53567fd815.tar.xz nixos-f122223243cbb50fa65d96646bc06f53567fd815.zip |
...
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/gkleen@sif/default.nix | 2 | ||||
-rw-r--r-- | accounts/gkleen@sif/zshrc | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index ed3ba7d8..14e2c9a7 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
@@ -364,7 +364,7 @@ in { | |||
364 | weechat wrappedElementDesktop # helvum | 364 | weechat wrappedElementDesktop # helvum |
365 | matrix-synapse-tools.synadm wrappedRocketChatDesktop | 365 | matrix-synapse-tools.synadm wrappedRocketChatDesktop |
366 | flakeInputs.deploy-rs.packages.${config.nixpkgs.system}.deploy-rs | 366 | flakeInputs.deploy-rs.packages.${config.nixpkgs.system}.deploy-rs |
367 | sieve-connect pdf-redact-tools gimp inkscape udiskie glab | 367 | sieve-connect gimp inkscape udiskie glab |
368 | ]; | 368 | ]; |
369 | 369 | ||
370 | file = { | 370 | file = { |
diff --git a/accounts/gkleen@sif/zshrc b/accounts/gkleen@sif/zshrc index 8b29b2d3..3136a8f6 100644 --- a/accounts/gkleen@sif/zshrc +++ b/accounts/gkleen@sif/zshrc | |||
@@ -113,8 +113,9 @@ dir() { | |||
113 | gitWorktree="" | 113 | gitWorktree="" |
114 | # notmuchMsg="" | 114 | # notmuchMsg="" |
115 | quickserve=false | 115 | quickserve=false |
116 | modifyPDF="" | ||
116 | 117 | ||
117 | while getopts ':t:a:s:Sd:ir:wqg:n:' arg; do | 118 | while getopts ':t:a:s:Sd:ir:wqg:n:p:' arg; do |
118 | case $arg in | 119 | case $arg in |
119 | "t") ;; | 120 | "t") ;; |
120 | "a") | 121 | "a") |
@@ -134,6 +135,7 @@ dir() { | |||
134 | "g") gitWorktree=${OPTARG} ;; | 135 | "g") gitWorktree=${OPTARG} ;; |
135 | # "n") notmuchMsg=${OPTARG} ;; | 136 | # "n") notmuchMsg=${OPTARG} ;; |
136 | "q") quickserve=true ;; | 137 | "q") quickserve=true ;; |
138 | "p") modifyPDF=${OPTARG} ;; | ||
137 | *) printf "Invalid option: %s\n" $arg >&2; exit 2 ;; | 139 | *) printf "Invalid option: %s\n" $arg >&2; exit 2 ;; |
138 | esac | 140 | esac |
139 | done | 141 | done |
@@ -157,7 +159,15 @@ dir() { | |||
157 | gitWorktree="" | 159 | gitWorktree="" |
158 | fi | 160 | fi |
159 | 161 | ||
162 | cleanup() | ||
163 | { | ||
164 | cd ${modifyPDF:h} | ||
165 | [[ -n ${modifyPDF} ]] && nix shell nixos#imagemagick -c convert ${dir}/page-*.png ${modifyPDF} | ||
166 | } | ||
167 | |||
160 | ( | 168 | ( |
169 | trap cleanup EXIT | ||
170 | |||
161 | cd ${dir} | 171 | cd ${dir} |
162 | export dir; | 172 | export dir; |
163 | 173 | ||
@@ -165,6 +175,8 @@ dir() { | |||
165 | 175 | ||
166 | [[ -n ${repoUrl} ]] && git clone -- ${repoUrl} . | 176 | [[ -n ${repoUrl} ]] && git clone -- ${repoUrl} . |
167 | 177 | ||
178 | [[ -n ${modifyPDF} ]] && templateArchive=${modifyPDF} | ||
179 | |||
168 | if [[ -n ${templateArchive} ]]; then | 180 | if [[ -n ${templateArchive} ]]; then |
169 | ( | 181 | ( |
170 | archiveFile="" | 182 | archiveFile="" |
@@ -205,6 +217,10 @@ dir() { | |||
205 | cpio --extract --make-directories --no-absolute-filenames -F ${templateArchive} | 217 | cpio --extract --make-directories --no-absolute-filenames -F ${templateArchive} |
206 | unpack=false | 218 | unpack=false |
207 | ;; | 219 | ;; |
220 | application/pdf) | ||
221 | nix shell nixos#ghostscript nixos#imagemagick -c convert -verbose -density 400 ${templateArchive} page-%0d.png | ||
222 | unpack=false | ||
223 | ;; | ||
208 | *) | 224 | *) |
209 | tar -xvaf ${templateArchive} | 225 | tar -xvaf ${templateArchive} |
210 | unpack=false | 226 | unpack=false |