Home

infra @main - refs - log -
-
https://git.jolheiser.com/infra.git
dragonwell flake
tree log patch
check for month dir Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5 AAAAQONdgQ31XQdm2SxXUbarj1nhvRXrEqNlhh/LEa/4nyHdkEPSz1j9KFRVQfNkTmL0mW E+uMLdC+JCyArEgqKFqAg= -----END SSH SIGNATURE-----
jolheiser <git@jolheiser.com>
2 weeks ago
1 changed files, 30 additions(+), 6 deletions(-)
jasmine/slideshow.nix
M jasmine/slideshow.nix -> jasmine/slideshow.nix
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/jasmine/slideshow.nix b/jasmine/slideshow.nix
index e97980740156cbca4c570c9ecae61a6bfe4b1f57..fb6a4bfa26e2ee92460744e4d362d90cd11152e4 100644
--- a/jasmine/slideshow.nix
+++ b/jasmine/slideshow.nix
@@ -1,17 +1,41 @@
 { 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 = {
-    feh = {
+    slideshow = {
       description = "Autostart slideshow";
       wantedBy = [ "graphical-session.target" ];
       after = [ "graphical-session.target" ];
       serviceConfig = {
-        ExecStart = pkgs.writeShellScript "mpv-slideshow" ''
-          while true; do
-            ${pkgs.lib.getExe pkgs.mpv} --shuffle --image-display-duration=5 --fullscreen /mnt/feh/
-          done
-        '';
+        ExecStart = pkgs.lib.getExe slideshow;
         Restart = "always";
+        PrivateTmp = true;
       };
     };
     disable-dpms = {