new wallpaperthingie

This commit is contained in:
2026-03-17 18:36:22 +00:00
parent 76662cbca6
commit 1f42d99ac5
@@ -1,57 +1,50 @@
# file: wallpaper-copy.nix # file: configuration.nix snippet
{ {
lib,
config, config,
pkgs, pkgs,
lib,
flakeRoot, flakeRoot,
... ...
}: }:
let let
sourceDir = "${flakeRoot}/assets/hyprland/wallpaperstuff"; # Path to wallpaperstuff folder in the flake
wallpaperDir = "${flakeRoot}/assets/hyprland/wallpaperstuff";
# Determine the username safely (fallback to "default" if home-manager is not present) wallpaperConf = "${wallpaperDir}/wallpaper.conf";
username =
if lib.attrExists "home" config && lib.attrExists "username" config.home then
config.home.username
else
"default";
# Determine target directory
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"; # Make wpaperd available system-wide
environment.systemPackages = [
pkgs.wpaperd
];
config = lib.mkIf config.wallpaper.enable { # User-level systemd service for wpaperd
systemd.user.services.wpaperd = {
description = "wpaperd wallpaper daemon";
after = [ "default.target" ];
# System activation (runs on nixos-rebuild switch) serviceConfig = {
system.activationScripts.copyWallpapers = { Type = "simple";
text = '' ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperConf}";
echo "=== Copying wallpaperstuff (system activation) ===" Restart = "on-failure";
mkdir -p "${targetDir}" RestartSec = 1;
cp -rT "${sourceDir}" "${targetDir}"
echo "Done."
'';
deps = [ ];
}; };
# Home Manager activation (runs when home-manager switch is executed) install = {
home-manager.users.${username}.home.activation.copyWallpapers = WantedBy = [ "default.target" ];
lib.mkIf (lib.attrExists "home" config) };
{ };
description = "Copy wallpaperstuff to user home";
script = '' # Optional: ensure the directory exists
echo "=== Copying wallpaperstuff (home-manager activation) ===" system.activationScripts.copyWallpaperConf = {
mkdir -p "${targetDir}" text = ''
cp -rT "${sourceDir}" "${targetDir}" echo "=== Ensuring wallpaper config exists ==="
echo "Done." mkdir -p "${wallpaperDir}/pictures"
''; if [ ! -f "${wallpaperConf}" ]; then
}; touch "${wallpaperConf}"
fi
echo "Done."
'';
deps = [ ];
}; };
} }