Full resource for forgejo-ci

This commit is contained in:
Nicolas Jeannerod 2025-02-12 18:35:08 +01:00 committed by Kiara Grouwstra
parent f4a1a1650b
commit 09ea1acdbe
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU

View file

@ -1,5 +1,20 @@
{ inputs, ... }:
{ lib, inputs, ... }:
## NOTE: Hackish solution mostly taken from `../common/resource.nix`.
## Eventually, `forgejo-ci` should move to a datacentre somewhere and this code
## should be integrated with the code for other machines (in particular VMs).
let
inherit (lib) attrValues elem;
inherit (lib.attrsets) concatMapAttrs optionalAttrs;
inherit (lib.strings) removeSuffix;
secretsPrefix = ../../secrets;
secrets = import (secretsPrefix + "/secrets.nix");
keys = import ../../keys;
hostPublicKey = keys.systems.forgejo-ci;
in
{
nixops4Deployments.forgejo-ci =
{ providers, ... }:
@ -12,12 +27,27 @@
ssh = {
host = "45.142.234.216";
opts = "-J orianne";
hostPublicKey = (import ../../keys).systems.forgejo-ci;
opts = "-J orianne"; # FIXME
hostPublicKey = hostPublicKey;
};
nixpkgs = inputs.nixpkgs;
nixos.module = import ./configuration.nix;
nixos.module = {
imports = [
inputs.agenix.nixosModules.default
./configuration.nix
];
age.secrets = concatMapAttrs (
name: secret:
optionalAttrs (elem hostPublicKey secret.publicKeys) ({
${removeSuffix ".age" name}.file = secretsPrefix + "/${name}";
})
) secrets;
users.users.root.openssh.authorizedKeys.keys = attrValues keys.contributors;
};
};
};
}