From 5191dee7addc9b4abd04359c49150f92f48f490e Mon Sep 17 00:00:00 2001 From: ChaotiCryptidz Date: Sun, 23 Jan 2022 10:30:56 +0000 Subject: [PATCH] add mpd and sftp --- hosts/hetzner-vm/hetzner-vm.nix | 3 +- hosts/hetzner-vm/services/minecraft.nix | 8 ----- hosts/hetzner-vm/services/mpd.nix | 37 ++++++++++++++++++++++ hosts/hetzner-vm/services/storage-sftp.nix | 22 +++++++++++++ hosts/lappy/lappy.nix | 4 +++ 5 files changed, 65 insertions(+), 9 deletions(-) delete mode 100644 hosts/hetzner-vm/services/minecraft.nix create mode 100644 hosts/hetzner-vm/services/mpd.nix create mode 100644 hosts/hetzner-vm/services/storage-sftp.nix diff --git a/hosts/hetzner-vm/hetzner-vm.nix b/hosts/hetzner-vm/hetzner-vm.nix index 087dc5b..7a0ea3e 100644 --- a/hosts/hetzner-vm/hetzner-vm.nix +++ b/hosts/hetzner-vm/hetzner-vm.nix @@ -15,7 +15,8 @@ hosts.hetzner-vm.services.vault hosts.hetzner-vm.services.netdata hosts.hetzner-vm.services.quassel - hosts.hetzner-vm.services.minecraft + hosts.hetzner-vm.services.mpd + hosts.hetzner-vm.services.storage-sftp (modulesPath + "/profiles/qemu-guest.nix") ]; diff --git a/hosts/hetzner-vm/services/minecraft.nix b/hosts/hetzner-vm/services/minecraft.nix deleted file mode 100644 index e82e508..0000000 --- a/hosts/hetzner-vm/services/minecraft.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: { - services.minecraft-server = { - enable = true; - eula = true; - openFirewall = true; - package = pkgs.papermc; - }; -} diff --git a/hosts/hetzner-vm/services/mpd.nix b/hosts/hetzner-vm/services/mpd.nix new file mode 100644 index 0000000..b470040 --- /dev/null +++ b/hosts/hetzner-vm/services/mpd.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: { + services.mpd = { + enable = true; + network.listenAddress = "0.0.0.0"; + dataDir = "/mpd"; + musicDirectory = "/storage/music"; + playlistDirectory = "/mpd/playlists"; + credentials = [{ + passwordFile = "/secrets/mpd-password"; + permissions = [ "read" "add" "control" "admin" ]; + }]; + extraConfig = '' + samplerate_converter "1" + audio_output_format "44100:16:2" + audio_output { + type "httpd" + name "HTTP Music Out" + encoder "opus" + port "8012" + bitrate "128000" + format "48000:16:2" + always_on "yes" + tags "yes" + } + ''; + }; + + systemd.services.mpd.serviceConfig.StateDirectory = ["/mpd"]; + + services.nginx.virtualHosts."stream.owo.monster" = { + forceSSL = true; + enableACME = true; + locations = { "/".proxyPass = "http://127.0.0.1:8012"; }; + }; + + networking.firewall.allowedTCPPorts = [ 6600 ]; +} diff --git a/hosts/hetzner-vm/services/storage-sftp.nix b/hosts/hetzner-vm/services/storage-sftp.nix new file mode 100644 index 0000000..efab6a6 --- /dev/null +++ b/hosts/hetzner-vm/services/storage-sftp.nix @@ -0,0 +1,22 @@ +{ ... }: { + services.vsftpd = { + enable = true; + extraConfig = '' + listen_port=4220 + pasv_enable=Yes + pasv_min_port=51000 + pasv_max_port=51999 + ''; + localUsers = true; + userlistEnable = true; + userlist = ["ftp-user"]; + localRoot = "/storage"; + }; + users.users.ftp-user = { + isSystemUser = true; + group = "ftp-user"; + }; + users.groups.ftp-user = {}; + networking.firewall.allowedTCPPortRanges = [ { from = 51000; to = 51999; } ]; + networking.firewall.allowedTCPPorts = [ 4220 ]; +} diff --git a/hosts/lappy/lappy.nix b/hosts/lappy/lappy.nix index 0bdcd0f..9b8ddb7 100644 --- a/hosts/lappy/lappy.nix +++ b/hosts/lappy/lappy.nix @@ -68,6 +68,10 @@ # let vscode, vivaldi, etc work. security.unprivilegedUsernsClone = true; + virtualisation.virtualbox.host.enable = true; + #virtualisation.virtualbox.host.enableExtensionPack = true; + users.extraGroups.vboxusers.members = [ "chaoticryptidz" ]; + networking.hostName = "lappy"; time.timeZone = "Europe/London"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";