Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poweralertd: add module #1951

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@
/modules/services/playerctld.nix @fendse
/tests/modules/playerctld @fendse

/modules/services/poweralertd.nix @ThibautMarty

/modules/services/pulseeffects.nix @jonringer

/modules/services/random-background.nix @rycee
Expand Down
8 changes: 8 additions & 0 deletions modules/misc/news.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,14 @@ in
A new module is available: 'programs.exa'.
'';
}

{
time = "2021-04-26T07:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.poweralertd'.
'';
}
];
};
}
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ let
(loadModule ./services/plan9port.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/playerctld.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/polybar.nix { })
(loadModule ./services/poweralertd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/random-background.nix { })
(loadModule ./services/redshift-gammastep/redshift.nix { })
Expand Down
31 changes: 31 additions & 0 deletions modules/services/poweralertd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:

with lib;

let cfg = config.services.poweralertd;

in {
meta.maintainers = [ maintainers.thibautmarty ];

options.services.poweralertd.enable =
mkEnableOption "the Upower-powered power alerterd";

config = mkIf cfg.enable {
systemd.user.services.poweralertd = {
Unit = {
Description = "UPower-powered power alerter";
Documentation = "man:poweralertd(1)";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};

Install.WantedBy = [ "graphical-session.target" ];

Service = {
Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd";
Restart = "always";
};
};
};
}