automatically upload the nix store to the cache
This commit is contained in:
parent
a93393cd9c
commit
8b32673bfe
2 changed files with 28 additions and 0 deletions
|
@ -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 ];
|
||||
|
|
27
config/services/nix-cache-upload.nix
Normal file
27
config/services/nix-cache-upload.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue