Files
nixos/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix
T
2026-03-17 16:39:29 +00:00

65 lines
2.5 KiB
Nix

{ lib, config, pkgs, flakeRoot, ... }:
let
# Define source and destination paths
source_path = "${flakeRoot}/assets/hyprland/wallpaperstuff";
destination_path = "${config.home.homeDirectory}/Droidnix/wallpaperstuff";
script_path = "${flakeRoot}/assets/hyprland/scripts/copy-wallpapers.sh";
wallpaper_conf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf";
# Define the script in the let block
copy_wallpapers_script = ''
#!${pkgs.bash}/bin/bash
set -euo pipefail
# Source and destination directories
SOURCE_DIR="${source_path}"
DEST_DIR="${destination_path}"
# Check if source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Error: Source directory $SOURCE_DIR does not exist."
exit 1
fi
# Create destination directory if it doesn't exist
mkdir -p "$DEST_DIR"
# Use rsync to copy files, overwriting symlinks and existing files
rsync -av --no-group --no-owner "$SOURCE_DIR/" "$DEST_DIR/"
echo "Config files copied from $SOURCE_DIR to $DEST_DIR. Symlinks replaced with editable files."
'';
# Print the script contents during the build
_ = builtins.trace (lib.concatStringsSep "\n" [
"=== Contents of copy-wallpapers.sh ==="
copy_wallpapers_script
"=== End of copy-wallpapers.sh ==="
]);
in {
options = {
wallpaper.enable = lib.mkEnableOption "Wallpaper setup";
};
config = lib.mkIf config.wallpaper.enable {
# Print the script contents again in the config block to ensure it's visible
_ = builtins.trace (lib.concatStringsSep "\n" [
"=== Contents of copy-wallpapers.sh (in config block) ==="
copy_wallpapers_script
"=== End of copy-wallpapers.sh (in config block) ==="
]);
# Use a script to copy all files from source to destination
home-manager.users.${config.home.username}.home.file."${script_path}".text = copy_wallpapers_script;
home-manager.users.${config.home.username}.home.file."${script_path}".executable = true;
# Run the script on activation
home-manager.users.${config.home.username}.home.activation.copy-wallpapers.script = ''
echo "=== Activation Script Running ==="
cat "${script_path}"
"${script_path}"
'';
# Install wpaperd
home-manager.users.${config.home.username}.home.packages = [ pkgs.wpaperd ];
# Configure wpaperd
home-manager.users.${config.home.username}.home.file."${config.home.homeDirectory}/.config/wpaperd/config.toml".text = builtins.readFile wallpaper_conf;
};
}