mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
Add NixOS binary cache
This commit is contained in:
parent
8017763bfb
commit
308f0da79f
4 changed files with 47 additions and 2 deletions
34
modules/binary-cache.nix
Normal file
34
modules/binary-cache.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
|
||||
sops.secrets = {
|
||||
nixCacheKey = {
|
||||
owner = config.services.borgbackup.jobs.data.user;
|
||||
key = "nix/cache_secret_key";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
services.nix-serve = {
|
||||
enable = true;
|
||||
port = 1500;
|
||||
secretKeyFile = config.sops.secrets.nixCacheKey.path;
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
virtualHosts = {
|
||||
"cache.${config.networking.domain}" = {
|
||||
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."/".extraConfig = ''
|
||||
proxy_pass http://localhost:${toString config.services.nix-serve.port};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue