92 lines
2.9 KiB
Nix
92 lines
2.9 KiB
Nix
# --- 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/traveldroid/Wallpapers";
|
|
wallpaperDst = "${homeDir}/Wallpapers";
|
|
randoScript = "${homeDir}/Wallpapers/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
|
|
home-manager.users = {
|
|
${username} = {
|
|
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" ];
|
|
};
|
|
|
|
############################
|
|
# Random background per workspace at logon
|
|
############################
|
|
|
|
systemd.user.services.workspaceWallpapers = {
|
|
description = "Dynamic wallpapers per workspace for Hyprland";
|
|
after = [ "graphical-session.target" ];
|
|
wants = [ "graphical-session.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
ExecStart = "${homeDir}/Wallpapers/scripts/workspace-wallpapers.sh";
|
|
Restart = "on-failure";
|
|
RestartSec = 5;
|
|
WorkingDirectory = homeDir;
|
|
Environment = [
|
|
"HYPRLAND_INSTANCE_SIGNATURE=${builtins.getEnv "HYPRLAND_INSTANCE_SIGNATURE"}"
|
|
"WAYLAND_DISPLAY=wayland-1"
|
|
"PATH=/run/current-system/sw/bin:/usr/bin:/bin"
|
|
];
|
|
};
|
|
|
|
wantedBy = [ "default.target" ];
|
|
};
|
|
}
|