blob: 82aacb5a304d2491feb0e5e4b7061d72d3777214 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.services.wpaperd;
tomlFormat = pkgs.formats.toml { };
in
{
options.services.wpaperd = {
enable = mkEnableOption "enable wpaperd";
package = mkOption {
default = pkgs.wpaperd;
defaultText = literalExpression "pkgs.wpaperd";
type = types.package;
example = literalExpression "pkgs.wpaperd";
description = "The package to use for the wpaperd binary.";
};
settings = mkOption {
type = tomlFormat.type;
description = ''
Configuration for wpaperd. Options are specified on:
https://github.com/danyspin97/wpaperd#wallpaper-configuration
'';
example = literalExpression ''
{
default = {
path = "/home/myusername/Pictures/Wallpapers/";
duration = "10m"
sorting = "random";
};
}
'';
};
systemdTarget = mkOption {
type = types.str;
default = "hyprland-session.target";
description = ''
Systemd target to bind to.
Note: if you're using home-manager to configure hyprland, you want to
have `wayland.windowManager.hyprland.systemdIntegration` enabled.
'';
};
};
config = mkIf cfg.enable {
assertions = [ (hm.assertions.assertPlatform "services.wpaperd" pkgs platforms.linux) ];
home.packages = [ cfg.package ];
xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wpaperd-config" cfg.settings;
};
};
systemd.user.services.wpaperd = {
Unit = {
Description = "Wallpaper daemon for Wayland";
BindsTo = [ cfg.systemdTarget ];
};
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/wpaperd";
};
Install.WantedBy = [ cfg.systemdTarget ];
};
};
}
|