This repository has no description
792 B
24 lines
1{
2 perSystem =
3 { pkgs, ... }:
4 {
5 packages.lockscreen =
6 (pkgs.writeShellApplication {
7 name = "lockscreen";
8 runtimeInputs = [
9 pkgs.ffmpeg
10 pkgs.coreutils
11 pkgs.procps
12 pkgs.swaylock-plugin
13 pkgs.mpvpaper
14 ];
15 text = ''
16 VIDEO=$(find "$HOME"/lockscreens/*.{mp4,webm} | shuf -n 1)
17 DURATION=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$VIDEO" 2>/dev/null | cut -d. -f1)
18 START=$((RANDOM % ''${DURATION:-300}))
19 exec swaylock-plugin --command "mpvpaper -o \"no-audio loop start=$START\" '*' \"$VIDEO\"" "$@"
20 '';
21 }).overrideAttrs
22 { passthru.usage = builtins.readFile ./usage.kdl; };
23 };
24}