automatically upload the nix store to the cache

This commit is contained in:
Charlotte 🦝 Delenk 2022-01-21 18:06:18 +01:00
parent a93393cd9c
commit 8b32673bfe
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
2 changed files with 28 additions and 0 deletions

View file

@ -8,6 +8,7 @@
./services/loki.nix
./home.nix
./services/restic.nix
./services/nix-cache-upload.nix
];
services.openssh.enable = true;
environment.systemPackages = [ pkgs.git ];

View file

@ -0,0 +1,27 @@
{ pkgs, ... }:
let
in
{
systemd.services.copy-to-cache = {
enable = true;
description = "Copy nix cache to cache.int.chir.rs";
script = ''
#!${pkgs.bash}/bin/bash
${pkgs.nix}/bin/nix copy --to 's3://cache.int.chir.rs?scheme=https&endpoint=minio.int.chir.rs' --all
'';
unitConfig = {
user = "darkkirb";
group = "users";
};
};
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 = {
onUnitActiveSec = 3600;
onBootSec = 3600;
};
};
}