1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-13 20:41:07 +01:00

wpaperd: add systemd service; move to services/ from programs/ (#6302)

This commit adds a systemd service to run it, and accordingly moves it to services.wpaperd.

In addition, the existing tests have been migrated to services, and an entry in the newslist has been created alerting users to this change.
This commit is contained in:
eulalia 2025-02-22 12:32:15 -05:00 committed by GitHub
parent e860bd49ea
commit 7ceacd98a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 106 additions and 53 deletions

View file

@ -679,4 +679,10 @@
github = "folliehiyuki";
githubId = 67634026;
};
"3ulalia" = {
name = "Eulalia del Sol";
email = "3ulalia@proton.me";
github = "3ulalia";
githubId = "179992797";
};
}

View file

@ -2100,7 +2100,18 @@ in {
message = ''
A new module is available: 'programs.jqp'.
A TUI playground for experimentingn with `jq`.
A TUI playground for experimenting with `jq`.
'';
}
{
time = "2025-02-22T16:46:56+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.wpaperd'.
This replaces the existing module, 'programs.wpaperd', and adds a
systemd service to ensure its execution.
'';
}
];

View file

@ -273,7 +273,6 @@ let
./programs/wezterm.nix
./programs/wlogout.nix
./programs/wofi.nix
./programs/wpaperd.nix
./programs/xmobar.nix
./programs/xplr.nix
./programs/yambar.nix
@ -425,6 +424,7 @@ let
./services/wlsunset.nix
./services/wluma.nix
./services/wob.nix
./services/wpaperd.nix
./services/xcape.nix
./services/xembed-sni-proxy.nix
./services/xidlehook.nix

View file

@ -1,49 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.wpaperd;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ hm.maintainers.Avimitin ];
options.programs.wpaperd = {
enable = mkEnableOption "wpaperd";
package = mkPackageOption pkgs "wpaperd" { };
settings = mkOption {
type = tomlFormat.type;
default = { };
example = literalExpression ''
{
eDP-1 = {
path = "/home/foo/Pictures/Wallpaper";
apply-shadow = true;
};
DP-2 = {
path = "/home/foo/Pictures/Anime";
sorting = "descending";
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/wpaperd/wallpaper.toml`.
See <https://github.com/danyspin97/wpaperd#wallpaper-configuration>
for the full list of options.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wpaperd-wallpaper" cfg.settings;
};
};
};
}

View file

@ -0,0 +1,84 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.wpaperd;
tomlFormat = pkgs.formats.toml { };
inherit (lib) mkRenamedOptionModule mkIf;
in {
meta.maintainers = [ lib.hm.maintainers."3ulalia" ];
imports = [
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "enable" ] # \
[ "services" "wpaperd" "enable" ])
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "package" ] # \
[ "services" "wpaperd" "package" ])
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "settings" ] # \
[ "services" "wpaperd" "settings" ])
];
options.services.wpaperd = {
enable = lib.mkEnableOption "wpaperd";
package = lib.mkPackageOption pkgs "wpaperd" { };
settings = lib.mkOption {
type = tomlFormat.type;
default = { };
example = lib.literalExpression ''
{
eDP-1 = {
path = "/home/foo/Pictures/Wallpaper";
apply-shadow = true;
};
DP-2 = {
path = "/home/foo/Pictures/Anime";
sorting = "descending";
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/wpaperd/wallpaper.toml`.
See <https://github.com/danyspin97/wpaperd#wallpaper-configuration>
for the full list of options.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.wpaperd" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wpaperd-wallpaper" cfg.settings;
};
};
systemd.user.services.wpaperd = {
Install = { WantedBy = [ config.wayland.systemd.target ]; };
Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "wpaperd";
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
X-Restart-Triggers =
[ "${config.xdg.configFile."wpaperd/wallpaper.toml".source}" ];
};
Service = {
ExecStart = "${lib.getExe cfg.package}";
Restart = "always";
RestartSec = "10";
};
};
};
}