2023-02-24 16:16:15 +02:00
|
|
|
{ config, depot, 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;
|
2023-02-24 16:16:15 +02:00
|
|
|
ExecStart = "${depot.inputs.nar-serve.packages.nar-serve}/bin/nar-serve";
|
2021-12-12 05:52:18 +02:00
|
|
|
};
|
|
|
|
environment = { inherit NAR_CACHE_URL PORT; };
|
2021-10-16 21:24:25 +03:00
|
|
|
};
|
2021-12-12 05:52:18 +02:00
|
|
|
in
|
|
|
|
{
|
2022-06-18 03:44:51 +03:00
|
|
|
links = {
|
|
|
|
nar-serve-self.protocol = "http";
|
|
|
|
nar-serve-nixos-org.protocol = "http";
|
|
|
|
};
|
2021-12-12 05:52:18 +02:00
|
|
|
|
2022-06-18 03:44:51 +03:00
|
|
|
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;
|
2021-10-16 21:24:25 +03:00
|
|
|
}
|