Skip to content

Instantly share code, notes, and snippets.

@fpletz
Last active September 17, 2017 12:51
Show Gist options
  • Save fpletz/cb1bfaf976921a28436821e6e5182fd0 to your computer and use it in GitHub Desktop.
Save fpletz/cb1bfaf976921a28436821e6e5182fd0 to your computer and use it in GitHub Desktop.
cache.nixos.community mirror
# Mirrors only the NixOS Binary Cache from cache.nixos.community
let
cacheHostname = "cache.nixos.ffmuc.net";
cacheFolder = "/srv/nixos-cache";
in {
systemd.services."rsync-nixos-cache" = {
startAt = "hourly";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.rsync}/bin/rsync -rtlvH --delete-after --delay-updates --safe-links rsync://rsync.nixos.community/nixos/binary_cache/ ${cacheFolder}/binary_cache";
};
};
services.rsyncd = {
enable = true;
motd = "Welcome at ${cacheHostname}.";
modules = {
nixos = { path = cacheFolder;
"read only" = "yes";
"filter" = "- ***/.~tmp~";
comment = "NixOS releases";
};
};
};
services.nginx = {
enable = true;
recommendedOptimisation = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;
virtualHosts = {
"${cacheHostname}" = {
addSSL = true;
enableACME = true;
root = "/tank/nixos-cache/binary_cache";
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment