1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00

treewide: remove with lib (#6871)

Remove from services.
This commit is contained in:
Austin Horstman 2025-04-21 09:00:59 -07:00 committed by GitHub
parent 6695b1d477
commit 82ee14ff60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
124 changed files with 1848 additions and 1891 deletions

View file

@ -5,9 +5,8 @@
...
}:
with lib;
let
inherit (lib) mkOption types;
cfg = config.services.random-background;
@ -22,11 +21,11 @@ let
in
{
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
options = {
services.random-background = {
enable = mkEnableOption "" // {
enable = lib.mkEnableOption "" // {
description = ''
Whether to enable random desktop background.
@ -83,44 +82,46 @@ in
};
};
config = mkIf cfg.enable (mkMerge ([
{
assertions = [
(hm.assertions.assertPlatform "services.random-background" pkgs platforms.linux)
];
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
assertions = [
(lib.hm.assertions.assertPlatform "services.random-background" pkgs lib.platforms.linux)
];
systemd.user.services.random-background = {
Unit = {
Description = "Set random desktop background using feh";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
systemd.user.services.random-background = {
Unit = {
Description = "Set random desktop background using feh";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
(mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = {
Description = "Set random desktop background using feh";
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
(lib.mkIf (cfg.interval != null) {
systemd.user.timers.random-background = {
Unit = {
Description = "Set random desktop background using feh";
};
Timer = {
OnUnitActiveSec = cfg.interval;
};
Timer = {
OnUnitActiveSec = cfg.interval;
};
Install = {
WantedBy = [ "timers.target" ];
Install = {
WantedBy = [ "timers.target" ];
};
};
};
})
]));
})
]
);
}