services/reflex: use reflex-cache package

This commit is contained in:
Max Headroom 2022-02-26 00:48:30 +01:00
parent ccffd920bc
commit 8771355dd6

View file

@ -1,11 +1,6 @@
{ config, pkgs, tools, ... }:
{ config, inputs, pkgs, tools, ... }:
let
py3 = pkgs.python3.withPackages (ps: with ps; [
requests
requests-unixsocket
]);
port = config.portsStr.nixIpfs;
in {
reservePortsFor = [ "nixIpfs" ];
@ -13,11 +8,15 @@ in {
systemd.services.nix-ipfs-cache = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${py3}/bin/python3 -u ${./reflex.py} ${port}";
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;
};
};
services.nginx.virtualHosts."reflex.${tools.meta.domain}" = tools.nginx.vhosts.proxy "http://127.0.0.1:${port}";