Files
nix/hosts/common/user/configs/gui/swww/default.nix
Nikolaos Karaolidis d54df170cd Remove impermanence home-manager module
Too many bugs to deal with unfortunately.

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2024-07-31 15:33:04 +03:00

66 lines
1.4 KiB
Nix

{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
hmConfig = config.home-manager.users.${username};
themeSwww = lib.meta.getExe (
pkgs.writeShellApplication {
name = "theme-swww";
runtimeInputs = with pkgs; [
coreutils
swww
];
text = "exec swww img \"${hmConfig.theme.configDir}/wallpaper\"";
}
);
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/swww"
];
home-manager.users.${username} = {
home.packages = with pkgs; [ swww ];
systemd.user.services.swww = {
Unit = {
Description = "Wallpaper daemon";
BindsTo = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "forking";
ExecStart = lib.meta.getExe (
pkgs.writeShellApplication {
name = "init-swww";
runtimeInputs = with pkgs; [ swww ];
text = "exec swww init";
}
);
ExecStartPost = themeSwww;
ExecStop = lib.meta.getExe (
pkgs.writeShellApplication {
name = "kill-swww";
runtimeInputs = with pkgs; [ swww ];
text = "exec swww kill";
}
);
};
Install.WantedBy = [ "graphical-session.target" ];
};
theme.extraConfig = lib.mkAfter "${themeSwww} &";
};
}