2021-12-07 16:43:00 +00:00
|
|
|
{ config, lib, pkgs, stockholm, ...}:
|
2016-06-25 16:56:39 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
# generate private key with:
|
|
|
|
# nix-store --generate-binary-cache-key my-secret-key my-public-key
|
|
|
|
services.nix-serve = {
|
|
|
|
enable = true;
|
2021-12-07 16:43:00 +00:00
|
|
|
secretKeyFile = toString <secrets> + "/nix-serve.key";
|
2021-01-23 21:25:38 +00:00
|
|
|
port = 5005;
|
2016-06-25 16:56:39 +00:00
|
|
|
};
|
|
|
|
|
2016-12-26 13:18:08 +00:00
|
|
|
services.nginx = {
|
2016-06-25 16:56:39 +00:00
|
|
|
enable = true;
|
2016-12-26 13:18:08 +00:00
|
|
|
virtualHosts.nix-serve = {
|
2018-11-27 03:01:13 +00:00
|
|
|
serverAliases = [ "cache.prism.r" ];
|
|
|
|
locations."/".extraConfig = ''
|
|
|
|
proxy_pass http://localhost:${toString config.services.nix-serve.port};
|
|
|
|
'';
|
2021-10-25 14:21:41 +00:00
|
|
|
locations."= /nix-cache-info".extraConfig = ''
|
|
|
|
alias ${pkgs.writeText "cache-info" ''
|
|
|
|
StoreDir: /nix/store
|
|
|
|
WantMassQuery: 1
|
|
|
|
Priority: 42
|
|
|
|
''};
|
|
|
|
'';
|
2018-11-27 03:01:13 +00:00
|
|
|
};
|
|
|
|
virtualHosts."cache.krebsco.de" = {
|
2018-11-30 22:12:06 +00:00
|
|
|
forceSSL = true;
|
2018-11-27 03:01:13 +00:00
|
|
|
serverAliases = [ "cache.lassul.us" ];
|
|
|
|
enableACME = true;
|
2016-12-26 13:18:08 +00:00
|
|
|
locations."/".extraConfig = ''
|
2016-06-25 16:56:39 +00:00
|
|
|
proxy_pass http://localhost:${toString config.services.nix-serve.port};
|
2016-12-26 13:18:08 +00:00
|
|
|
'';
|
2016-06-25 16:56:39 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|