depot/hosts/VEGAS/services/nix/nar-serve.nix

23 lines
722 B
Nix

{ config, inputs, pkgs, tools, ... }:
let
mkNarServe = NAR_CACHE_URL: PORT: {
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = true;
ExecStart = "${inputs.nar-serve.defaultPackage."${pkgs.system}"}/bin/nar-serve";
};
environment = { inherit NAR_CACHE_URL PORT; };
};
in
{
links = {
nar-serve-self.protocol = "http";
nar-serve-nixos-org.protocol = "http";
};
systemd.services.nar-serve-self = mkNarServe "https://cache.${tools.meta.domain}" config.links.nar-serve-self.portStr;
systemd.services.nar-serve-nixos-org = mkNarServe "https://cache.nixos.org" config.links.nar-serve-nixos-org.portStr;
}