allow consuming attic cache from ci runner

This commit is contained in:
Kiara Grouwstra 2025-07-04 19:23:41 +02:00
parent eaf8ef0de5
commit c8b1091548
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
5 changed files with 58 additions and 1 deletions

View file

@ -64,6 +64,7 @@ in
pkgs.httpie pkgs.httpie
pkgs.jq pkgs.jq
pkgs.nix-unit pkgs.nix-unit
pkgs.attic-client
test-loop test-loop
nixops4.packages.${system}.default nixops4.packages.${system}.default
]; ];

View file

@ -24,6 +24,14 @@ in
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
nix.settings = {
substituters = [
"https://attic.fediversity.net/demo"
];
trusted-public-keys = [
"demo:N3CAZ049SeBVqBM+OnhLMrxWJ9altbD/aoJtHrY19KM="
];
};
boot.loader = { boot.loader = {
systemd-boot.enable = true; systemd-boot.enable = true;
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;

View file

@ -1,8 +1,20 @@
{ pkgs, config, ... }: {
lib,
pkgs,
config,
sources,
...
}:
{ {
_class = "nixos"; _class = "nixos";
imports = with sources; [
(import "${home-manager}/nixos")
"${vars}/options.nix"
"${vars}/backends/on-machine.nix"
];
services.gitea-actions-runner = { services.gitea-actions-runner = {
package = pkgs.forgejo-actions-runner; package = pkgs.forgejo-actions-runner;
@ -44,4 +56,39 @@
## For the Docker mode of the runner. ## For the Docker mode of the runner.
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
vars.settings.on-machine.enable = true;
vars.generators."templates" = rec {
dependencies = [ "attic" ];
runtimeInputs = [
pkgs.coreutils
pkgs.gnused
];
script = lib.concatStringsSep "\n" (
lib.mapAttrsToList (template: _: ''
cp "$templates/${template}" "$out/${template}"
echo "filling placeholders in template ${template}..."
sed -i "s/${placeholder}/$(cat "${config.age.secrets.wiki-password.path}")/g" "$out/${template}"
'') files
);
files."attic.toml" = {
secret = true;
template = pkgs.writeText "attic.toml" ''
default-server = "fediversity"
[servers.fediversity]
endpoint = "http://localhost:8080"
token = "${config.vars.generators.attic.files.token.placeholder}"
'';
};
};
home-manager = {
users.gitea-runner.home = {
stateVersion = "25.05";
file.".config/attic/config.toml".source =
config.vars.generators."templates".files."attic.toml".path;
};
};
} }

BIN
secrets/attic-ci-token.age Normal file

Binary file not shown.

View file

@ -24,6 +24,7 @@ concatMapAttrs
## are able to decrypt them. ## are able to decrypt them.
{ {
attic-ci-token = [ forgejo-ci ];
forgejo-database-password = [ vm02116 ]; forgejo-database-password = [ vm02116 ];
forgejo-email-password = [ vm02116 ]; forgejo-email-password = [ vm02116 ];
forgejo-runner-token = [ forgejo-ci ]; forgejo-runner-token = [ forgejo-ci ];