[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calling gpg encrypt inside mixed-text-file
From: |
( |
Subject: |
Re: Calling gpg encrypt inside mixed-text-file |
Date: |
Fri, 14 Oct 2022 09:55:03 +0100 |
Hey Reza,
On Fri Oct 14, 2022 at 9:40 AM BST, Reza Housseini wrote:
> (service radicale-service-type
> (radicale-configuration
> (config-file (mixed-text-file "radicale.conf" "
> [auth]
> type = htpasswd
> htpasswd_filename = " (local-file "my-password.gpg ") "
> htpasswd_encryption = plain
> "))))
>
> This obviously does not work, but how would I achieve to call gpg
> --decrypt --quiet inside the mixed-text-file?
You'll need two things; ``computed-file'', and the ``(ice-9 popen)'' standard
library module. ``computed-file'' allows you to build a file-like object from
arbitrary code. Have a look here for an example from my configuration,
https://git.sr.ht/~unmatched-paren/conf/tree/root/item/home.scm#L168
which removes all ``//'' comments from ``waybar.json'' before writing the
result to the store path.
Also see the Guix and Guile manuals on these two subjects,
``(ice-9 popen)'':
https://www.gnu.org/software/guile/manual/html_node/Pipes.html
``computed-file'':
https://guix.gnu.org/manual/en/html_node/G_002dExpressions.html#index-computed_002dfile
-- (