Added bincache

This commit is contained in:
Julien Malka 2021-12-25 17:15:58 +01:00
parent 8103e8e236
commit 18cd7a5c8b
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
4 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,37 @@
{ pkgs, config, lib, inputs, ... }:
let
cfg = config.luj.bincache;
port = 5000;
in
with lib;
{
options.luj.bincache = {
enable = mkEnableOption "Enable nix bincache";
subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable
{
sops.secrets.bin-cache-priv-key = {
owner = "nix-serve";
};
services.nix-serve = {
enable = true;
secretKeyFile = "/run/secrets/bin-cache-priv-key";
port = port;
};
luj.nginx.enable = true;
services.nginx.virtualHosts."${cfg.subdomain}.julienmalka.me" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
};
};
};
}

View file

@ -25,6 +25,14 @@ with lib;
nixPath = [
"nixpkgs=${inputs.nixpkgs}"
];
binaryCaches = [
"https://bin.julienmalka.me"
"https://cache.nixos.org/"
];
binaryCachePublicKeys = [
"bin.julienmalka.me:y0uADfX8ZQ6Pthofm8Pj7v+hED3m2cY0d+Sg6/Jm+s8="
];
};