(feat): added users declaratively

This commit is contained in:
Harry 2024-08-17 12:09:32 +02:00
parent bc7f6a9e4f
commit 8909f3fe6e
2 changed files with 12 additions and 3 deletions

View file

@ -1,10 +1,12 @@
{ config, ... }:
{ config, lib, ... }:
{
imports = [ ./forgejo-smtp.nix ];
sops.secrets.smtp_address = { };
sops.secrets.smtp_password = {
owner = "forgejo";
};
sops.secrets.forgejoInitialMail = { };
sops.secrets.forgejoInitialPassword = { };
services.forgejo = {
enable = true;
@ -29,4 +31,9 @@
};
mailerPasswordFile = config.sops.secrets.smtp_password.path;
};
systemd.services.forgejo.preStart = ''
create="${lib.getExe config.services.forgejo.package} admin user create"
$create --admin --email "`cat ${config.sops.secrets.forgejoInitialMail}`" --username you --password "`cat ${config.sops.secrets.forgejoInitialPassword.path}`" &>/dev/null || true
'';
}

View file

@ -1,6 +1,8 @@
borgRepoPassword: ENC[AES256_GCM,data:pgaBumNDhis8ftypaz5MdQfY467ToUJLYUs=,iv:rE0kAaAC1NEQgCvEl7f8hnSk0N6jZOAMABrErDudRMQ=,tag:58ZlN1lseFwQFq/T2gLB2g==,type:str]
photoprismAdmin: ENC[AES256_GCM,data:kSFgrZKGGMA=,iv:fFkWYgUBfCg3lVLQMTFkabQzJvJ2IsciEiyOkObOL4k=,tag:AylOeAP5Vllx/vlOKAPqsA==,type:str]
photoprismPassword: ENC[AES256_GCM,data:3zUZhRZElMmpsBF4zBGz43dci2JC5bc=,iv:qj5wpKHxeu67R3KTDfyjfVbP7Hvydyh7Oxd/FY8YOg0=,tag:bCAQ57eG8CmBdF8oobo3Vg==,type:str]
forgejoInitialMail: ENC[AES256_GCM,data:kcUIZMQYl5Ast0v/,iv:g+feK0H41ufxUwGbY8euCh2+/Bz45m4CUPlHVI8yY90=,tag:n6bRu2iz/VO1y5jGxtIIwA==,type:str]
forgejoInitialPassword: ENC[AES256_GCM,data:L6moUxZbEpeNStsEM5HMSOcCURxJZ58uvdI=,iv:2rXOsQM+jgSdEawKiwFqQWK5LZXvwNbKiO+BysOtQZE=,tag:B+ZP16gFQLpZXj+WALwktg==,type:str]
smtp_address: ENC[AES256_GCM,data:HjF8aPPE6FqdM09lqXLyRQ==,iv:fTgefhxOL4FJ4pKD+Lfox1a27GPlsC+QtMixVOUjQZU=,tag:ridCBcd3ZqswKswackFfTg==,type:str]
smtp_password: ENC[AES256_GCM,data:mgQlrXLfLnl2nv7/cdfo0lQz02s4ccunmCJenURA5j2xjX+Ef/vQAacKYofCxCwe3lo=,iv:t1tKu6OFsboovdobb4xHhtC/Fy3R6GoFT2SkUf9Vk3s=,tag:L2cMIBg2LeEu4P1a7Z1y/Q==,type:str]
matrix_data: ENC[AES256_GCM,data:VinMt0TvPACJ6iz+9nnjf9SsZhUIkRVbvYHqlpEeIhvuYmjRtnO3frJ46uwYpNcTE+fpYcWu,iv:yc/EKM4UFe23wAe6fuGrmPtdIpEZ5XSW/9YzZY3P7yw=,tag:5qZiO4kmnsYHIsINB00gBQ==,type:str]
@ -33,8 +35,8 @@ sops:
UTYrZ1dWUG5ka1p0b3JrREZXUzZiWlEKBFn4I/U3bwyurfa8gyfy7D3wYAwOtDw7
K0jQE5SeExD9kluwH0gyGDZbk/DWn+ppWoMNqQKDmICrUQpns6GJnQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-08-12T15:57:34Z"
mac: ENC[AES256_GCM,data:Y4MEQSgqvALcP0K92TlAaqFylk5YRTHXLRSUJmKV3ShFrdHg/iQdpcZndpX0qEynGnLooKJHfc2XpNuNVn+Z4r8jKNbI0veHdyDUWR342na9nQ3iQhccNrPxNLQ/QtOrHx4RDMv65n91XDqdWOpbzDG5gaNvk5t+hPLRY+cDUas=,iv:9qdunFsspOKcJOYdlQuAcGR16oWKCe4uzLcmwEgCy78=,tag:SSO/6Y0YTmz332ysQeP55A==,type:str]
lastmodified: "2024-08-17T10:09:08Z"
mac: ENC[AES256_GCM,data:cREWNP3tUUzJETDE3FXKaUrT1yn4b9RezCOvjf+DywYbPLPECKAWThhbDw8xJHvjoUWlPIaQ7eOTbiYIJbPY2k8ZYsXjbzuag2BZhOby2f+Z+09lDpI/sSUkYHei3wRSJnbE7/L5DD6XR8naIoAh3IzCmEtlsKh5m4y89Y157A8=,iv:1RlpPvekxjsN4Pk9rcd5cRY+PWK2abgZYT3eoiYDLBU=,tag:mVKBGJ7gYqxNGsEQ5ic06g==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.0