blob: 6574c6cd19d9bc5f73621b9884552afc3ca6030e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{
containers.filebrowser = {
autoStart = true;
privateNetwork = true;
hostBridge = "br-lan0";
localMacAddress = "02:00:00:00:01:45";
ephemeral = true;
# Host path
bindMounts = {
"/var/lib/filebrowser" = {
hostPath = "/nix/persist/filebrowser";
isReadOnly = false;
};
"/media" = {
hostPath = "/media";
isReadOnly = true;
};
};
config = { lib, pkgs, config, ... }: let
FILEBROWSER_CONFIG = "${(pkgs.formats.yaml { }).generate "config.yaml" {
server = {
port = 8080;
database = "/var/lib/filebrowser/database.db";
sources = [ { path = "/media"; } ];
};
}}";
in {
# Network
networking.interfaces.eth0.useDHCP = true;
networking.firewall.allowedTCPPorts = [ 80 8080 ]; # Caddy + filebrowser
# Filebrowser-quantum
services.filebrowser = {
enable = true;
package = pkgs.filebrowser-quantum;
};
# Edit systemd service for filebrowser to make it compatible w/ filebrowser-quantum
systemd.services.filebrowser = {
#environment.FILEBROWSER_DATABASE =
environment = { inherit FILEBROWSER_CONFIG; };
serviceConfig = {
ExecStart = lib.mkForce (lib.getExe pkgs.filebrowser-quantum);
};
};
# Reverse proxy
services.caddy = {
enable = true;
virtualHosts.":80".extraConfig = ''
reverse_proxy localhost:8080
'';
};
system.stateVersion = "26.05";
};
};
}
|