2022-01-21 17:06:18 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
let
|
|
|
|
in
|
|
|
|
{
|
|
|
|
systemd.services.copy-to-cache = {
|
|
|
|
enable = true;
|
|
|
|
description = "Copy nix cache to cache.int.chir.rs";
|
|
|
|
script = ''
|
|
|
|
#!${pkgs.bash}/bin/bash
|
2022-03-03 09:16:05 +00:00
|
|
|
${pkgs.nix}/bin/nix store sign --key-file /root/cache-priv-key.pem --all
|
2022-03-03 18:41:23 +00:00
|
|
|
${pkgs.nix}/bin/nix copy --to 's3://nix-cache?scheme=https&endpoint=cache.int.chir.rs&multipart-upload=true' --all
|
2022-03-03 09:16:05 +00:00
|
|
|
${pkgs.minio-client}/bin/mc rm -r --older-than 7d nix-cache/nix-cache
|
2022-01-21 17:06:18 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
systemd.timers.copy-to-cache = {
|
|
|
|
enable = true;
|
|
|
|
description = "Copy nix cache to cache.int.chir.rs";
|
|
|
|
requires = [ "copy-to-cache.service" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
timerConfig = {
|
2022-02-18 19:36:49 +00:00
|
|
|
OnUnitActiveSec = 300;
|
|
|
|
OnBootSec = 300;
|
2022-01-21 17:06:18 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|