2021-12-12 05:52:18 +02:00
|
|
|
{ config, inputs, pkgs, tools, ... }:
|
2021-10-16 21:24:25 +03:00
|
|
|
|
2021-12-12 05:52:18 +02:00
|
|
|
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; };
|
2021-10-16 21:24:25 +03:00
|
|
|
};
|
2021-12-12 05:52:18 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
reservePortsFor = [
|
|
|
|
"nar-serve-self"
|
|
|
|
"nar-serve-nixos-org"
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.services.nar-serve-self = mkNarServe "https://cache.${tools.meta.domain}" config.portsStr.nar-serve-self;
|
|
|
|
systemd.services.nar-serve-nixos-org = mkNarServe "https://cache.nixos.org" config.portsStr.nar-serve-nixos-org;
|
2021-10-16 21:24:25 +03:00
|
|
|
}
|