Commit graph

15 commits

Author SHA1 Message Date
Quentin Smith
f6b80ab6cd Address review comments 2024-02-21 07:24:54 +00:00
Quentin Smith
fbec55367f modules/sops/templates: Support custom files as secret templates
This exposes the `file` option, which can be used with `pkgs.formats` to write additional configuration formats.
2024-02-21 07:24:54 +00:00
DDoSolitary
f88661c9a9 Revert "don't substitute binaries"
This reverts commit 7711514b85.

With db82bcafd4, we no longer need to
ensure that the pair list only contains utf-8 text, as long as users
don't reference non-utf-8 data in template content.
Fixes Mic92/sops-nix#439.
2024-02-20 16:46:05 +00:00
DDoSolitary
f805f3061a template rendering should only read referenced secrets
Adds an extra check to determine if the placeholder ocurrs in template
content before actually reading the corresponding secret file.
In terms of performance, this adds an extra string search, but removes
possibly unneceassary file reading if the secret is not used in the
template, though both of them should be negligible in most cases.
Fixes Mic92/sops-nix#496.
2024-02-20 16:46:05 +00:00
Edward Tjörnhammar
7711514b85 don't substitute binaries 2023-10-14 22:09:48 +00:00
zowoq
dca9e50fe3 modules/sops/templates: isCoercibleToString -> isConvertibleWithToString
834f0d660a
2023-08-12 09:27:30 +01:00
Maximilian Bosch
f10110ddef
modules/sops/templates: declare defaultText for sops.templates.<name>.group
When using `documentation.nixos.includeAllModules = true;` this fails
for me with

    error: attribute 'users' missing

           at /nix/store/30jax2y4q3d1xyf8ha3cwilw3kdz4pn8-source/modules/sops/templates/default.nix:8:11:

                7|   secretsForUsers = lib.filterAttrs (_: v: v.neededForUsers) cfg.secrets;
                8|   users = config.users.users;
                 |           ^
                9| in {
    (use '--show-trace' to show detailed location information)

Not depending on `config` when building the manual fixes the issue.
2023-04-25 21:45:42 +02:00
Janne Heß
679ad65214
templates: Add descriptions and use singleLineStr 2023-04-23 12:56:01 +02:00
mlatus
4de4d820ba fix scope in sops.templates; add relevant test 2023-04-18 12:47:12 +08:00
Jörg Thalheim
800f2cd885
Update modules/sops/templates/default.nix 2023-03-21 18:19:08 +00:00
mlatus
d93c3bf08e inline option type and submodule 2023-03-21 21:23:20 +08:00
Ninlives
8c4ecdc301
Apply suggestions from code review
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-03-21 21:20:42 +08:00
mlatus
efd85fbf51 code improvement; use more secure flow to create secret file 2023-03-15 13:56:51 +08:00
mlatus
c955d8fe91 typo 2023-03-14 00:09:48 +08:00
mlatus
c4c39450b1 add sops.templates 2023-03-13 23:56:19 +08:00