new wallpaperthingie

This commit is contained in:
2026-03-17 16:22:57 +00:00
parent 525ed71c02
commit 2c18965c55
@@ -1,10 +1,4 @@
{ { lib, config, pkgs, flakeRoot, ... }:
lib,
config,
pkgs,
flakeRoot,
...
}:
let let
# Define source and destination paths # Define source and destination paths
@@ -12,34 +6,35 @@ let
source_path = "${flakeRoot}/assets/hyprland/wallpaperstuff"; source_path = "${flakeRoot}/assets/hyprland/wallpaperstuff";
destination_path = "${config.home.homeDirectory}/Droidnix/wallpaperstuff"; destination_path = "${config.home.homeDirectory}/Droidnix/wallpaperstuff";
wallpaper_conf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf"; wallpaper_conf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf";
in in {
{
options = { options = {
wallpaper.enable = lib.mkEnableOption "Wallpaper setup"; wallpaper.enable = lib.mkEnableOption "Wallpaper setup";
}; };
config = lib.mkIf config.wallpaper.enable { config = lib.mkIf config.wallpaper.enable {
# Use a script to copy all files from source to destination # Use a script to copy all files from source to destination
home-manager.users.${config.home.username}.home.file."${script_path}/copy-wallpapers.sh".text = '' home-manager.users.${config.home.username}.home.file."${script_path}/copy-wallpapers.sh".text = ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
#cp -r "${source_path}"/* "${destination_path}/"
set -euo pipefail set -euo pipefail
# Source and destination directories # Source and destination directories
SOURCE_DIR="${source_path}" SOURCE_DIR="${source_path}"
DEST_DIR="${destination_path}" DEST_DIR="${destination_path}"
# Print script contents for debugging
echo "=== Script Contents ==="
cat "$0"
echo "=== End of Script Contents ==="
# Check if source directory exists # Check if source directory exists
if [ ! -d "$SOURCE_DIR" ]; then if [ ! -d "$SOURCE_DIR" ]; then
echo "Error: Source directory $SOURCE_DIR does not exist." echo "Error: Source directory $SOURCE_DIR does not exist."
exit 1
fi fi
# Create destination directory if it doesn't exist
mkdir -p "$DEST_DIR"
# Use rsync to copy files, overwriting symlinks and existing files # 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/" 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." 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 = home-manager.users.${config.home.username}.home.file."${script_path}/copy-wallpapers.sh".executable = true;
true;
# Run the script on activation # Run the script on activation
home-manager.users.${config.home.username}.home.activation.copy-wallpapers.script = '' home-manager.users.${config.home.username}.home.activation.copy-wallpapers.script = ''
@@ -50,7 +45,6 @@ in
home-manager.users.${config.home.username}.home.packages = [ pkgs.wpaperd ]; home-manager.users.${config.home.username}.home.packages = [ pkgs.wpaperd ];
# Configure wpaperd # Configure wpaperd
home-manager.users.${config.home.username}.home.file."${config.home.homeDirectory}/.config/wpaperd/config.toml".text = home-manager.users.${config.home.username}.home.file."${config.home.homeDirectory}/.config/wpaperd/config.toml".text = builtins.readFile wallpaper_conf;
builtins.readFile wallpaper_conf;
}; };
} }