stockholm/lass/2configs/binary-cache/server.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2016-06-25 16:56:39 +00:00
{ config, lib, pkgs, ...}:
{
# generate private key with:
# nix-store --generate-binary-cache-key my-secret-key my-public-key
services.nix-serve = {
enable = true;
secretKeyFile = config.krebs.secret.files.nix-serve-key.path;
port = 5005;
2016-06-25 16:56:39 +00:00
};
systemd.services.nix-serve = {
2020-08-04 18:28:04 +00:00
after = [
config.krebs.secret.files.nix-serve-key.service
];
partOf = [
2020-08-04 18:28:04 +00:00
config.krebs.secret.files.nix-serve-key.service
];
2016-06-25 16:56:39 +00:00
};
krebs.secret.files.nix-serve-key = {
path = "/run/secret/nix-serve.key";
owner.name = "nix-serve";
source-path = toString <secrets> + "/nix-serve.key";
};
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 = {
serverAliases = [ "cache.prism.r" ];
locations."/".extraConfig = ''
proxy_pass http://localhost:${toString config.services.nix-serve.port};
'';
};
virtualHosts."cache.krebsco.de" = {
2018-11-30 22:12:06 +00:00
forceSSL = true;
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
};
};
}