Regenerated
This commit is contained in:
@@ -1,5 +1,52 @@
|
||||
{ config, pkgs, lib, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
username = config.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
wallpaperSrc = "${flakeRoot}/assets/traveldroid/Wallpapers";
|
||||
wallpaperDst = "${homeDir}/Wallpapers";
|
||||
scriptFile = "${homeDir}//Wallpapers/scripts/copy-wallpapers.sh";
|
||||
in
|
||||
{
|
||||
# Ensure bash exists
|
||||
environment.systemPackages = [ pkgs.bash ];
|
||||
|
||||
# Drop the script into home
|
||||
home.file."/Wallpapers/scripts//Wallpapers/scripts/copy-wallpapers.sh".text = ''
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
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
|
||||
cp -r "${wallpaperSrc}/." "${wallpaperDst}/"
|
||||
|
||||
# Fix permissions
|
||||
chown -R ${username}:${username} "${wallpaperDst}"
|
||||
chmod -R u+rwx "${wallpaperDst}"
|
||||
|
||||
echo "Done copying wallpapers."
|
||||
'';
|
||||
|
||||
# User service that runs the script
|
||||
systemd.user.services.copyWallpapers = {
|
||||
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||
wants = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.ExecStart = "${scriptFile}";
|
||||
serviceConfig.Restart = "no";
|
||||
};
|
||||
}
|
||||
let
|
||||
username = config.users.users.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
|
||||
Reference in New Issue
Block a user