depot/hosts/VEGAS/services/nix/ipfs-cache.nix

25 lines
615 B
Nix
Raw Normal View History

2022-01-30 21:28:16 +02:00
{ config, pkgs, tools, ... }:
let
py3 = pkgs.python3.withPackages (ps: with ps; [
requests
requests-unixsocket
]);
port = config.portsStr.nixIpfs;
in {
reservePortsFor = [ "nixIpfs" ];
systemd.services.nix-ipfs-cache = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${py3}/bin/python3 -u ${./nix-ipfs-cache.py} ${port}";
DynamicUser = true;
SupplementaryGroups = [ "ipfs" ];
CacheDirectory = "nix-ipfs-cache";
};
};
services.nginx.virtualHosts."reflex.${tools.meta.domain}" = tools.nginx.vhosts.proxy "http://127.0.0.1:${port}";
}