From 42c03800c0a776e05e10d0abefa17a7be0d62e22 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Sat, 24 Jun 2023 17:31:11 +0100 Subject: [PATCH] nixos/middleman: Add stuff.nul.ie file browser --- .../vms/shill/containers/middleman/default.nix | 5 +++++ .../colony/vms/shill/containers/middleman/vhosts.nix | 12 ++++++++++++ nixos/boxes/colony/vms/shill/default.nix | 6 +++++- secrets/middleman/htpasswd.age | 12 ++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 secrets/middleman/htpasswd.age diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/default.nix b/nixos/boxes/colony/vms/shill/containers/middleman/default.nix index ea0e3c0..d04a49a 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/default.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/default.nix @@ -54,6 +54,10 @@ in owner = "nginx-sso"; group = "nginx-sso"; }; + "middleman/htpasswd" = { + owner = "nginx"; + group = "nginx"; + }; }; }; @@ -193,6 +197,7 @@ in enableReload = true; additionalModules = with pkgs.nginxModules; [ vts + fancyindex ]; recommendedTlsSettings = true; diff --git a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix index 4cacac7..baccfdc 100644 --- a/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix +++ b/nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix @@ -368,6 +368,18 @@ in }; useACMEHost = lib.my.pubDomain; }; + + "stuff.${lib.my.pubDomain}" = { + locations."/" = { + basicAuthFile = config.age.secrets."middleman/htpasswd".path; + root = "/mnt/media/stuff"; + extraConfig = '' + fancyindex on; + fancyindex_show_dotfiles on; + ''; + }; + useACMEHost = lib.my.pubDomain; + }; }; minio = diff --git a/nixos/boxes/colony/vms/shill/default.nix b/nixos/boxes/colony/vms/shill/default.nix index 8bfa3b2..5e74ecd 100644 --- a/nixos/boxes/colony/vms/shill/default.nix +++ b/nixos/boxes/colony/vms/shill/default.nix @@ -159,7 +159,11 @@ in containers.instances = let instances = { - middleman = {}; + middleman = { + bindMounts = { + "/mnt/media" = {}; + }; + }; vaultwarden = {}; colony-psql = {}; chatterbox = {}; diff --git a/secrets/middleman/htpasswd.age b/secrets/middleman/htpasswd.age new file mode 100644 index 0000000..fc25348 --- /dev/null +++ b/secrets/middleman/htpasswd.age @@ -0,0 +1,12 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyB1bk1X +c20zQzNoRDk2TzI3V3E4cW92cVNkUWxER3pVeXl3NVZNNWlQcWtrCmhIVms0N2JJ +VU41Mnl2dXMzb3FHRnBrMW8wemY0bFVpaWRVdW9DVHB1K3MKLT4gWDI1NTE5IENG +Q0RVRFdJNXEyVkd4ZkNNNHgwcjhHRThSYkRjMzNGOXVNU3J3NDFXbW8KT0ovQ21I +WjFLekFReXZwL2ZGaEJBZW1YWnNsUUNVQzZvZTRaSEd4N2dWcwotPiBIa1N0bkQt +Z3JlYXNlIDAgdU1MQl9uaApVb21LVmZRaXNzbm95SG11QVhVN0VPWnBEZ3pJbFZY +dmFJM3pwUQotLS0gdHJ1L1YrL0pEK21GQmlnU2JlTXZGQzNYQ3lKNG4vM2dLRHhw +bEVMc25mZwq8aFKhboR0yXDbn8kuksVV5lwdNwaBhEOmM/2J18quaj+/RIHRSTYX +IU7lXniSC0J/MNie1SGpbzB/gscclfPrPsqQVHMe4PSphJdS0UuW9Jm9WnVzv2fc +aYRLI/7MvIEneD3SHdBGULrPC1I7ktFKSo07ZjZH +-----END AGE ENCRYPTED FILE-----