diff --git a/Droidnix/assets/hyprland/scripts/copy_wallpaperstuf.sh b/Droidnix/assets/hyprland/scripts/copy_wallpaperstuf.sh new file mode 100644 index 000000000..e69de29bb diff --git a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix index e625114c8..696c67134 100644 --- a/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix +++ b/Droidnix/generated/hyprland/decorations/rotating_wallpaper.nix @@ -8,6 +8,7 @@ let # Define source and destination paths + script_path = "${flakeRoot}/assets/hyprland/scripts"; source_path = "${flakeRoot}/assets/hyprland/wallpaperstuff"; destination_path = "${config.home.homeDirectory}/Droidnix/wallpaperstuff"; wallpaper_conf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf"; @@ -18,17 +19,26 @@ in }; config = lib.mkIf config.wallpaper.enable { - # Ensure the destination directory exists - home-manager.users.${config.home.username}.home.file."${destination_path}".source = null; - home-manager.users.${config.home.username}.home.file."${destination_path}".createDir = true; # Use a script to copy all files from source to destination - home-manager.users.${config.home.username}.home.file."${destination_path}/copy-wallpapers.sh".text = - '' - #!${pkgs.bash}/bin/bash - cp -r "${source_path}"/* "${destination_path}/" - ''; - home-manager.users.${config.home.username}.home.file."${destination_path}/copy-wallpapers.sh".executable = + home-manager.users.${config.home.username}.home.file."${script_path}/copy-wallpapers.sh".text = '' + #!${pkgs.bash}/bin/bash + #cp -r "${source_path}"/* "${destination_path}/" + 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." + fi + # Use rsync to copy files, overwriting symlinks and existing files + # --no-group --no-owner preserves your user ownership + 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." + + ''; + home-manager.users.${config.home.username}.home.file."${script_path}/copy-wallpapers.sh".executable = true; # Run the script on activation