From 9904ec050bfc8ff91a4d9bff43d3d21ac06e8772 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 15 Sep 2020 22:33:29 +0200 Subject: l yellow.r: add flix-index service --- lass/1systems/yellow/config.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'lass/1systems') diff --git a/lass/1systems/yellow/config.nix b/lass/1systems/yellow/config.nix index 82fe3fac5..bc3b1f5d5 100644 --- a/lass/1systems/yellow/config.nix +++ b/lass/1systems/yellow/config.nix @@ -251,6 +251,27 @@ with import ; 3f8a56ddb2e64eb67adfc9b337157ff4 -----END OpenVPN Static key V1----- - ''; + + systemd.services.flix-index = { + wantedBy = [ "multi-user.target" ]; + path = [ + pkgs.coreutils + pkgs.findutils + pkgs.inotifyTools + ]; + serviceConfig = { + Restart = "always"; + ExecStart = pkgs.writers.writeDash "flix-index" '' + set -efu + + DIR=/var/download/finished + cd "$DIR" + while inotifywait -rq -e create -e move -e delete "$DIR"; do + find . -type f > "$DIR"/index.tmp + mv "$DIR"/index.tmp "$DIR"/index + done + ''; + }; + }; } -- cgit v1.2.3