summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hosts/poweredge-pro/filebrowser.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/hosts/poweredge-pro/filebrowser.nix b/hosts/poweredge-pro/filebrowser.nix
new file mode 100644
index 0000000..b719400
--- /dev/null
+++ b/hosts/poweredge-pro/filebrowser.nix
@@ -0,0 +1,55 @@
+{ pkgs, ... }: {
+ containers.filebrowser = {
+ autoStart = true;
+ privateNetwork = true;
+ hostBridge = "br-lan1";
+ localMacAddress = "02:00:00:00:77:12";
+
+ # Host path
+ bindMounts = {
+ "/var/lib/filebrowser/data/chexx" = {
+ hostPath = "/Storage/chexx";
+ isReadOnly = true;
+ };
+ "/var/lib/filebrowser/data/Scans" = {
+ hostPath = "/Storage/Scans";
+ isReadOnly = true;
+ };
+ };
+
+ config = { lib, pkg, config, ... }: let
+ publicPort = 9000;
+ in {
+ # Network
+ networking.interfaces.eth0.useDHCP = true;
+ networking.firewall.allowedTCPPorts = [ 80 publicPort ]; # Caddy (private + public)
+
+ # Filebrowser
+ services.filebrowser = {
+ enable = true;
+ #package = pkgs.filebrowser-quantum; # Not supported yet
+ };
+
+ # Reverse proxy
+ services.caddy = {
+ enable = true;
+ # Private
+ virtualHosts.":80".extraConfig = ''
+ reverse_proxy localhost:8080
+ '';
+ # Public (not sure why toString is needed but ok)
+ virtualHosts.":${toString publicPort}".extraConfig = ''
+ @shared {
+ path /share/*
+ path /static/*
+ path /api/public/*
+ }
+
+ reverse_proxy @shared localhost:8080
+ '';
+ };
+
+ system.stateVersion = "26.05";
+ };
+ };
+}