diff --git a/jasmine/slideshow.nix b/jasmine/slideshow.nix index fb6a4bfa26e2ee92460744e4d362d90cd11152e4..e97980740156cbca4c570c9ecae61a6bfe4b1f57 100644 --- a/jasmine/slideshow.nix +++ b/jasmine/slideshow.nix @@ -1,41 +1,17 @@ { pkgs, ... }: -let - root = "/mnt/feh"; - slideshow = pkgs.writeShellApplication { - name = "slideshow"; - runtimeInputs = with pkgs; [ - coreutils - findutils - mpv - ]; - text = '' - while true; do - month=$(date +%B | tr '[:upper:]' '[:lower:]') - - playlist="/tmp/slideshow.txt" - touch "$playlist" - - find ${root} -maxdepth 1 -type f >> "$playlist" - - if [ -d "${root}/$month" ]; then - find "${root}/$month" -type f >> "$playlist" - fi - - mpv --shuffle --image-display-duration=5 --fullscreen --playlist="$playlist" - done - ''; - }; -in { systemd.user.services = { - slideshow = { + feh = { description = "Autostart slideshow"; wantedBy = [ "graphical-session.target" ]; after = [ "graphical-session.target" ]; serviceConfig = { - ExecStart = pkgs.lib.getExe slideshow; + ExecStart = pkgs.writeShellScript "mpv-slideshow" '' + while true; do + ${pkgs.lib.getExe pkgs.mpv} --shuffle --image-display-duration=5 --fullscreen /mnt/feh/ + done + ''; Restart = "always"; - PrivateTmp = true; }; }; disable-dpms = {