{ config, pkgs, lib, flakeRoot, ... }: let username = config.users.users.defaultUser or "henrov"; homeDir = "/home/${username}"; wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers"; wallpaperDst = "${homeDir}/Wallpapers"; in { environment.systemPackages = [ pkgs.bash pkgs.coreutils ]; systemd.user.services.copyWallpapers = { description = "Copy wallpapers from repo to ~/Wallpapers"; wants = [ "graphical-session.target" ]; after = [ "graphical-session.target" ]; serviceConfig.Type = "oneshot"; serviceConfig.ExecStart = '' echo "Copying wallpapers from ${wallpaperSrc} to ${wallpaperDst} ..." if [ ! -d "${wallpaperSrc}" ]; then echo "ERROR: ${wallpaperSrc} does not exist" exit 1 fi mkdir -p "${wallpaperDst}" chown -R ${username}:${username} "${wallpaperDst}" # Copy everything from source to destination cp -r "${wallpaperSrc}/." "${wallpaperDst}/" # Fix permissions just in case chown -R ${username}:${username} "${wallpaperDst}" chmod -R u+rwx "${wallpaperDst}" echo "Done copying wallpapers." ''; serviceConfig.Restart = "no"; }; }