{ config, pkgs, lib, flakeRoot, ... }: let repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; userRelRoot = "nixos_conf/wallpaperstuff"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; # The video file you want as wallpaper (must exist under the synced dir) userVideoPath = "${userAbsRoot}/videos/myWallpaper.mp4"; # (keep your existing approach: sync the repo wallpaper dir to the user dir) repoWallpapersOnly = lib.cleanSourceWith { src = repoWallpaperDir; filter = path: type: true; }; in { home.packages = [ pkgs.mpvpaper pkgs.mpv ]; # Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff home.file."${userRelRoot}" = { source = repoWallpapersOnly; recursive = true; }; systemd.user.services.mpvpaper-wallpaper = { Unit = { Description = "Video wallpaper (mpvpaper)"; After = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ]; }; Service = { Type = "simple"; # -p auto-pause saves resources when the wallpaper surface is hidden. # '*' applies to all outputs. # Stretch-to-fill (cover) behavior: # --panscan=1.0 fills the entire output by cropping (no letterboxing). # If you literally want distortion-stretch (ignore aspect ratio), use --keepaspect=no instead. ExecStart = '' ${pkgs.mpvpaper}/bin/mpvpaper \ -p \ -o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \ '*' "${userVideoPath}" ''; Restart = "on-failure"; RestartSec = 1; }; Install = { WantedBy = [ "graphical-session.target" ]; }; }; }