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