55 lines
1.4 KiB
Nix
55 lines
1.4 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
flakeRoot,
|
|
...
|
|
}:
|
|
|
|
let
|
|
# Source wallpaperstuff in the flake
|
|
wallpaperSource = "${flakeRoot}/assets/hyprland/wallpaperstuff";
|
|
|
|
# Target in the user home
|
|
wallpaperTarget = "$HOME/.config/wpaperd";
|
|
|
|
# Config file inside the flake
|
|
wallpaperConf = "${flakeRoot}/assets/hyprland/wallpaperstuff/wallpaper.conf";
|
|
in
|
|
{
|
|
# Install the wpaperd package system-wide
|
|
environment.systemPackages = with pkgs; [ wpaperd ];
|
|
|
|
# Activation script: copy wallpapers & config to user home
|
|
system.activationScripts.copyWpaperdConfig = {
|
|
text = ''
|
|
echo "=== Copying wpaperd config to $HOME/.config/wpaperd ==="
|
|
mkdir -p "${wallpaperTarget}"
|
|
cp -rT "${wallpaperSource}" "${wallpaperTarget}"
|
|
echo "Done."
|
|
'';
|
|
deps = [ ];
|
|
};
|
|
|
|
# Enable linger so user services can run outside login
|
|
systemd.enableUserServices = true;
|
|
systemd.user.enableLinger = true;
|
|
|
|
# User systemd service
|
|
systemd.user.services.wpaperd = {
|
|
description = "wpaperd wallpaper daemon";
|
|
after = [ "default.target" ];
|
|
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
# Use bash -c to expand HOME properly
|
|
ExecStart = "bash -c '${pkgs.wpaperd}/bin/wpaperd --config ${wallpaperTarget}/wallpaper.conf'";
|
|
Restart = "on-failure";
|
|
RestartSec = 1;
|
|
};
|
|
|
|
# Enable the service by default
|
|
wantedBy = [ "default.target" ];
|
|
};
|
|
}
|