45 lines
967 B
Nix
45 lines
967 B
Nix
{
|
|
# self,
|
|
# config,
|
|
# lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
adminArg = "-a admin:$(cat /etc/nixos/.secrets/dufs/adminpw)@/:rw";
|
|
cerinventArg = "-a cerinvent:$(cat /etc/nixos/.secrets/dufs/cerinventpw)@/cerinvent";
|
|
domain = "builds.sondell.org";
|
|
port = "5555";
|
|
in {
|
|
users = {
|
|
users.dufs = {
|
|
isNormalUser = false;
|
|
isSystemUser = true;
|
|
|
|
group = "dufs";
|
|
};
|
|
groups.dufs = {};
|
|
};
|
|
|
|
systemd.services."dufs-files" = {
|
|
enable = true;
|
|
description = "website for file browsing";
|
|
wantedBy = ["multi-user.target"];
|
|
unitConfig = {
|
|
After = "network-online.target";
|
|
};
|
|
script = with pkgs; ''
|
|
${dufs}/bin/dufs /pool/var/dufs/ -A -p ${port} ${cerinventArg} ${adminArg}
|
|
'';
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = "dufs";
|
|
};
|
|
};
|
|
services.nginx.virtualHosts.${domain} = {
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:${port}/";
|
|
proxyWebsockets = true;
|
|
};
|
|
};
|
|
}
|