1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 07:31:03 +01:00
home-manager/modules/services/swww.nix
Joonas Rautiola 211594c88d swww: add package to service path
Signed-off-by: Joonas Rautiola <joonas@rautiola.co>
2025-11-15 09:51:45 +01:00

61 lines
1.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.swww;
in
{
meta.maintainers = with lib.hm.maintainers; [ hey2022 ];
options.services.swww = {
enable = lib.mkEnableOption "swww, a Solution to your Wayland Wallpaper Woes";
package = lib.mkPackageOption pkgs "swww" { };
extraArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [
"--no-cache"
"--layer"
"bottom"
];
description = ''
Options given to swww-daemon when the service is run.
See `swww-daemon --help` for more information.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.swww" pkgs lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.swww = {
Install = {
WantedBy = [ config.wayland.systemd.target ];
};
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "swww-daemon";
After = [ config.wayland.systemd.target ];
PartOf = [ config.wayland.systemd.target ];
};
Service = {
ExecStart = "${lib.getExe' cfg.package "swww-daemon"} ${lib.escapeShellArgs cfg.extraArgs}";
Environment = [
"PATH=$PATH:${lib.makeBinPath [ cfg.package ]}"
];
Restart = "always";
RestartSec = 10;
};
};
};
}