Files
nix/users/configs/swww/default.nix
Nikolaos Karaolidis 3d503fd1c2 Expand xdg config
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2024-06-23 20:39:17 +03:00

34 lines
818 B
Nix

{ user ? throw "user argument is required" }: { config, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
in
{
home-manager.users."${user.name}" = {
home = {
packages = with pkgs; [ swww ];
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ];
};
theme.extraConfig = let name = "theme-swww"; in
"${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [
coreutils-full
swww
];
text = ''
if ! pgrep -x "swww-daemon" > /dev/null; then
swww-daemon &> /tmp/swww.log &
fi
while ! swww query &> /dev/null; do
sleep 0.1
done
swww img "${hmConfig.theme.configDir}/wallpaper"
'';
}}/bin/${name}";
};
}