new wallpaperthingie

This commit is contained in:
2026-03-17 18:29:07 +00:00
parent 661033dd30
commit 8cc6b5b65b
@@ -1,30 +1,41 @@
# 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";
targetDir = "$HOME/Droidnix/wallpaperstuff";
# Determine target directory: use Home Manager homeDirectory if available, else $HOME
targetDir = if lib.attrExists "home" config then
"${config.home.homeDirectory}/Droidnix/wallpaperstuff"
else
"$HOME/Droidnix/wallpaperstuff";
in in
{ {
options.wallpaper.enable = lib.mkEnableOption "Copy wallpaperstuff dir"; options.wallpaper.enable = lib.mkEnableOption "Copy wallpaperstuff dir";
config = lib.mkIf config.wallpaper.enable { config = lib.mkIf config.wallpaper.enable {
# System activation script (runs on nixos-rebuild switch) # System activation (runs on nixos-rebuild switch)
system.activationScripts.copyWallpapers = { system.activationScripts.copyWallpapers = {
text = '' text = ''
echo "=== Copying wallpaperstuff ===" echo "=== Copying wallpaperstuff (system activation) ==="
mkdir -p "${targetDir}"
cp -rT "${sourceDir}" "${targetDir}"
echo "Done."
'';
deps = [];
};
# 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) {
description = "Copy wallpaperstuff to user home";
script = ''
echo "=== Copying wallpaperstuff (home-manager activation) ==="
mkdir -p "${targetDir}" mkdir -p "${targetDir}"
cp -rT "${sourceDir}" "${targetDir}" cp -rT "${sourceDir}" "${targetDir}"
echo "Done." echo "Done."
''; '';
deps = [ ];
}; };
}; };
} }