diff --git a/hosts/storage-2/configuration.nix b/hosts/storage-2/configuration.nix index 164df34..899aeff 100644 --- a/hosts/storage-2/configuration.nix +++ b/hosts/storage-2/configuration.nix @@ -6,6 +6,7 @@ ./hardware-configuration.nix ../../configuration/common ../../configuration/proxmox-vm + ./mixcloud.nix ]; boot.loader.grub.enable = true; @@ -23,6 +24,10 @@ networking.defaultGateway6 = { address = "2001:638:904:ffc0::1"; interface = "ens18"; }; networking.nameservers = [ "2001:638:904:ffcc::3" "2001:638:904:ffcc::4" "141.24.40.3" "141.24.40.4" ]; + services.nginx.enable = true; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + clerie.monitoring = { enable = true; id = "209"; diff --git a/hosts/storage-2/mixcloud.nix b/hosts/storage-2/mixcloud.nix new file mode 100644 index 0000000..be7fa47 --- /dev/null +++ b/hosts/storage-2/mixcloud.nix @@ -0,0 +1,39 @@ +{ pkgs, ... }: + +{ + services.nginx.virtualHosts = { + "mixcloud.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/" = { + alias = "/data/mixcloud/"; + basicAuthFile = "/var/src/secrets/nginx/mixcloud.htpasswd"; + extraConfig = '' + autoindex on; + ''; + }; + }; + }; + + users.users.data-mixcloud = { + group = "data-mixcloud"; + home = "/data/mixcloud"; + useDefaultShell = true; + isSystemUser = true; + }; + users.groups.data-mixcloud = {}; + + systemd.services."youtube-dl-mixcloud-couchsofa" = { + serviceConfig = { + User = "data-mixcloud"; + Group = "data-mixcloud"; + }; + path = [ pkgs.youtube-dl ]; + script = '' + mkdir -p /data/mixcloud/couchsofa/ + cd /data/mixcloud/couchsofa/ + youtube-dl https://www.mixcloud.com/couchsofa/ + ''; + startAt = "*-*-* 05:05:00"; + }; +}