WIP: gitea: init gpg signing key

This commit is contained in:
h7x4 2024-11-23 23:51:53 +01:00
parent 07777edafb
commit 78028846a9
No known key found for this signature in database
GPG Key ID: 9F2F7D8250F35146
2 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,7 @@ let
in {
imports = [
./ci.nix
./gpg.nix
./import-users
./web-secret-provider
];

View File

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.gitea;
GNUPGHOME = "${config.users.users.gitea.home}/gnupg";
in
{
sops.secrets."gitea/gpg-signing-key" = {
owner = cfg.user;
inherit (cfg) group;
};
systemd.services.gitea.environment = { inherit GNUPGHOME; };
systemd.services.gitea-ensure-gnupg-homedir = {
description = "Import gpg key for gitea";
environment = { inherit GNUPGHOME; };
serviceConfig = {
Type = "oneshot";
User = cfg.user;
PrivateNetwork = true;
};
script = ''
${lib.getExe pkgs.gnupg} --import ${config.sops.secrets."gitea/gpg-signing-key".path}
'';
};
}