new wallpaperthingie

This commit is contained in:
2026-03-17 18:31:18 +00:00
parent 8cc6b5b65b
commit 76662cbca6
@@ -1,14 +1,28 @@
# file: wallpaper-copy.nix # file: wallpaper-copy.nix
{ lib, config, pkgs, flakeRoot, ... }: {
lib,
config,
pkgs,
flakeRoot,
...
}:
let let
sourceDir = "${flakeRoot}/assets/hyprland/wallpaperstuff"; sourceDir = "${flakeRoot}/assets/hyprland/wallpaperstuff";
# Determine target directory: use Home Manager homeDirectory if available, else $HOME # Determine the username safely (fallback to "default" if home-manager is not present)
targetDir = if lib.attrExists "home" config then username =
"${config.home.homeDirectory}/Droidnix/wallpaperstuff" if lib.attrExists "home" config && lib.attrExists "username" config.home then
else config.home.username
"$HOME/Droidnix/wallpaperstuff"; else
"default";
# Determine target directory
targetDir =
if lib.attrExists "home" config then
"${config.home.homeDirectory}/Droidnix/wallpaperstuff"
else
"$HOME/Droidnix/wallpaperstuff";
in in
{ {
@@ -24,18 +38,20 @@ in
cp -rT "${sourceDir}" "${targetDir}" cp -rT "${sourceDir}" "${targetDir}"
echo "Done." echo "Done."
''; '';
deps = []; deps = [ ];
}; };
# Home Manager activation (runs when home-manager switch is executed) # Home Manager activation (runs when home-manager switch is executed)
home-manager.users.${config.home.username ? config.home.username or "default"}?.home.activation.copyWallpapers = lib.mkIf (lib.attrExists "home" config) { home-manager.users.${username}.home.activation.copyWallpapers =
description = "Copy wallpaperstuff to user home"; lib.mkIf (lib.attrExists "home" config)
script = '' {
echo "=== Copying wallpaperstuff (home-manager activation) ===" description = "Copy wallpaperstuff to user home";
mkdir -p "${targetDir}" script = ''
cp -rT "${sourceDir}" "${targetDir}" echo "=== Copying wallpaperstuff (home-manager activation) ==="
echo "Done." mkdir -p "${targetDir}"
''; cp -rT "${sourceDir}" "${targetDir}"
}; echo "Done."
'';
};
}; };
} }