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
powerd: init at 1.0.0 #75706
powerd: init at 1.0.0 #75706
Conversation
@GrahamcOfBorg build powerd |
--exec-command "${cfg.execCommand}" | ||
''; | ||
serviceConfig = { | ||
User = cfg.user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't like how this is root by default. How about this:
- The module sets
--exec-command
to beecho TRIGGER > /run/powerd/triggerfile
- In parallel to that a script that executes
execCommand
every time that file is written to - This script can then run as root or whatever, while powerd can run with
DynamicUser = true
without any privileges. This way we know that onlyexecCommand
can be run as root - This doesn't change the module interface at all, but is more secure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infinisil Thanks! While testing I've found that dbus notifications don't work from systemd unit, so I'll remove the module. It will be better to run powerd right from user session.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NixOS does support user systemd services with systemd.user.services
. Want to use that instead? Can also always be done later still if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infinisil Yes I know, but are they popular? I've never used any because of this issue #21460
This reverts commit cd74dfd.
This software doesn't consider charge mode, always executing command. So I think its not viable. |
Motivation for this change
Add powerd, a simple daemon to handle battery power levels (execute a warning or a command depending on how low is a battery level).
Add a module for it.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @