From 87f73a8fc1874c075a0d1581dbe7be1108a49df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 10 Feb 2022 19:28:28 +0100 Subject: [PATCH] fix(radio): clean up files after 1h --- systems/makanek/radio.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/systems/makanek/radio.nix b/systems/makanek/radio.nix index 4b0dfca..8a54a52 100644 --- a/systems/makanek/radio.nix +++ b/systems/makanek/radio.nix @@ -1,5 +1,7 @@ { lib, pkgs, config, ... }: let + inherit (import ) tmpfilesConfig; + liquidsoapDirectory = "/var/cache/liquidsoap"; icecastPassword = "hackme"; lyrikline-poem = pkgs.writers.writeDash "lyrikline.sh" '' set -efu @@ -44,7 +46,7 @@ let ''; wikipedia-article = pkgs.writers.writeDash "wikipedia.sh" '' set -efu - opus=$(mktemp /tmp/wikipedia.XXX.opus) + opus=$(mktemp ${liquidsoapDirectory}/wikipedia.XXX.opus) html=$(mktemp) trap clean EXIT @@ -103,6 +105,20 @@ in { ) ''; + systemd.services.radio.environment.TMPDIR = liquidsoapDirectory; + + systemd.tmpfiles.rules = [ + (tmpfilesConfig { + type = "d"; + path = liquidsoapDirectory; + mode = "0750"; + user = "liquidsoap"; + group = "liquidsoap"; + age = "1h"; + }) + ]; + + services.icecast = { enable = true; hostname = "radio.kmein.de";