2022-02-26 01:48:30 +02:00
|
|
|
{ config, inputs, pkgs, tools, ... }:
|
2022-01-30 21:28:16 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
port = config.portsStr.nixIpfs;
|
|
|
|
in {
|
|
|
|
reservePortsFor = [ "nixIpfs" ];
|
|
|
|
|
|
|
|
systemd.services.nix-ipfs-cache = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2022-02-26 01:48:30 +02:00
|
|
|
ExecStart = "${inputs.self.packages.${pkgs.system}.reflex-cache}/bin/reflex";
|
2022-01-30 21:28:16 +02:00
|
|
|
DynamicUser = true;
|
|
|
|
SupplementaryGroups = [ "ipfs" ];
|
|
|
|
CacheDirectory = "nix-ipfs-cache";
|
|
|
|
};
|
2022-02-26 01:48:30 +02:00
|
|
|
environment = {
|
|
|
|
REFLEX_PORT = port;
|
|
|
|
IPFS_API = config.services.ipfs.apiAddress;
|
2022-03-13 03:16:01 +02:00
|
|
|
NIX_CACHES = toString [
|
|
|
|
"https://cache.nixos.org"
|
|
|
|
"https://cache.${tools.meta.domain}"
|
|
|
|
"https://max.cachix.org"
|
|
|
|
];
|
2022-02-26 01:48:30 +02:00
|
|
|
};
|
2022-01-30 21:28:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."reflex.${tools.meta.domain}" = tools.nginx.vhosts.proxy "http://127.0.0.1:${port}";
|
|
|
|
}
|