feat(cache): add cache service
This commit is contained in:
parent
5402760418
commit
2292d645bb
3 changed files with 37 additions and 12 deletions
37
modules/nixos/sites/cache/default.nix
vendored
Normal file
37
modules/nixos/sites/cache/default.nix
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
with lib.custom; let
|
||||||
|
cfg = config.sites.cache;
|
||||||
|
|
||||||
|
sec = config.age.secrets;
|
||||||
|
in {
|
||||||
|
options.sites.hydra = with types; {
|
||||||
|
enable = mkBoolOpt false "Enable Hydra";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
age.secrets = {
|
||||||
|
cache_key = {
|
||||||
|
file = ./sec/cache_key.age;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nix-serve = {
|
||||||
|
enable = true;
|
||||||
|
secretKeyFile = sec.cache_key.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."cache.zoeys.computer" = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -15,23 +15,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
age.secrets = {
|
|
||||||
hydra_key = {
|
|
||||||
owner = "hydra";
|
|
||||||
group = "hydra";
|
|
||||||
file = ./sec/hydra_key.age;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.hydra = {
|
services.hydra = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hydraURL = "https://hydra.zoeys.computer";
|
hydraURL = "https://hydra.zoeys.computer";
|
||||||
useSubstitutes = true;
|
useSubstitutes = true;
|
||||||
notificationSender = "hydra@localhost"; # e-mail of hydra service
|
notificationSender = "hydra@localhost"; # e-mail of hydra service
|
||||||
|
|
||||||
extraConfig = ''
|
|
||||||
binary_cache_secret_key_file = ${sec.hydra_key.path}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.virtualHosts."hydra.zoeys.computer" = {
|
services.nginx.virtualHosts."hydra.zoeys.computer" = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue