Regenerated
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
||||
{ lib, config, pkgs, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
username = config.defaultUser or "henrov";
|
||||
homeDir = "/home/${username}";
|
||||
wallpaperSrc = "${flakeRoot}/assets/mymachine/Wallpapers";
|
||||
wallpaperDst = "${homeDir}/Wallpapers";
|
||||
sysName = "awww";
|
||||
assetPath = "${flakeRoot}/generated/.config/${sysName}";
|
||||
randoScript = "${homeDir}/.config/${sysName}/scripts/randomizeWallpapers.sh";
|
||||
in
|
||||
{
|
||||
# Make bash available
|
||||
environment.systemPackages = [
|
||||
pkgs.bash
|
||||
pkgs.rsync
|
||||
pkgs.jq
|
||||
pkgs.awww
|
||||
pkgs.waypaper pkgs.socat ];
|
||||
|
||||
# Create the copy script using Home Manager, following Waybar style
|
||||
# This can not be done using a prepared script
|
||||
home-manager.users = {
|
||||
${username} = {
|
||||
home.activation.MakeWallpaperMutable = {
|
||||
after = [ "writeBoundary" ];
|
||||
before = [];
|
||||
data = ''
|
||||
rm -rf $HOME/.config/${sysName}
|
||||
mkdir -p $HOME/.config/${sysName}
|
||||
cp -r ${assetPath}/* $HOME/.config/${sysName}/
|
||||
chmod -R u+w $HOME/.config/${sysName}/
|
||||
find $HOME/.config/${sysName}/ -name "*.sh" -exec chmod +x {} \;
|
||||
'';
|
||||
};
|
||||
home.file = {
|
||||
"copy-wallpapers.sh" = {
|
||||
text = ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
set -euo pipefail
|
||||
echo "Running as $(whoami)"
|
||||
echo "Copying wallpapers from ${wallpaperSrc} to ${wallpaperDst} ..."
|
||||
if [ ! -d "${wallpaperSrc}" ]; then
|
||||
echo "ERROR: ${wallpaperSrc} does not exist"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "${wallpaperDst}"
|
||||
# Simple copy, overwrite everything
|
||||
cp -r "${wallpaperSrc}/." "${wallpaperDst}/"
|
||||
# Fix permissions
|
||||
chmod -R u+rwx "${wallpaperDst}"
|
||||
echo "Done copying wallpapers."
|
||||
'';
|
||||
executable = true;
|
||||
force = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# User service to run the script that copies the Wallpaperstuff
|
||||
systemd.user.services.copyWallpapers = {
|
||||
description = "Copy wallpapers from repo to ~/Wallpapers";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${homeDir}/copy-wallpapers.sh";
|
||||
Restart = "no";
|
||||
WorkingDirectory = homeDir;
|
||||
};
|
||||
wantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
# User service to randomize wallpapers
|
||||
systemd.user.services.randomizeWallpapers = {
|
||||
description = "Randomize wallpapers in ~/Wallpapers/pictures";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${randoScript}";
|
||||
Restart = "no";
|
||||
WorkingDirectory = homeDir;
|
||||
};
|
||||
wantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user