Switch to just taking a->b instead of a list

This commit is contained in:
niten 2024-02-14 16:47:33 -08:00
parent c7919fe478
commit 1b580545e6
1 changed files with 10 additions and 12 deletions

View File

@ -74,10 +74,8 @@ in {
}; };
extraCerts = mkOption { extraCerts = mkOption {
type = attrsOf (listOf str); type = attrsOf str;
description = '' description = "Map of certificate name to certificate location.";
Map of certificate name to a list of certificates to make available to the
Authentik server (i.e. the public and optionally private keys).'';
default = { }; default = { };
}; };
@ -111,14 +109,14 @@ in {
wantedBy = [ "arion-authentik.service" ]; wantedBy = [ "arion-authentik.service" ];
before = [ "arion-authentik.service" ]; before = [ "arion-authentik.service" ];
script = let script = let
copyCommands = concatLists (mapAttrsToList (_: certs: mkCopyCommand = name: src:
concatMap (cert: let target = "${cfg.state-directory}/certs/${name}";
let target = "${cfg.state-directory}/certs/${baseNameOf cert}"; in ''
in '' cp -v "${src}" "${target}"
cp ${cert} ${target} chown authentik:root "${target}"
chown authentik:root ${target} '';
'') certs)) cfg.extraCerts; in concatStringsSep "\n"
in concatStringsSep "\n" copyCommands; (mapAttrsToList mkCopyCommand cfg.extraCerts);
}; };
arion-authentik = { arion-authentik = {
after = [ "network-online.target" "podman.service" ]; after = [ "network-online.target" "podman.service" ];