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

nixos/upower: Allow customization of UPower.conf #73968

Merged
merged 2 commits into from Dec 5, 2019

Conversation

mat8913
Copy link
Contributor

@mat8913 mat8913 commented Nov 23, 2019

Documentation of options and default values taken from the upstream
UPower.conf. The documentation was modified slightly to make more sense
when displayed on https://nixos.org/nixos/options.html.

A copy of upstream UPower.conf can be found here:
https://cgit.freedesktop.org/upower/tree/etc/UPower.conf?id=28bd86c181e2510ef6a1dc7cfa26f97803698a79

Motivation for this change

On my laptop, the battery jumps from 20% straight down to 0%, not giving it enough time to hibernate under the default settings.

#25815

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I tested this on my laptop running NixOS 19.09 by cherry-picking the commit onto the release branch and adding this to my config:

  services.upower.percentageLow = 35;
  services.upower.percentageCritical = 30;
  services.upower.percentageAction = 25;
Notify maintainers

cc @mmahut @worldofpeace

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See @matthewbauer and my comments.

A release note can be added at

mat8913 added a commit to mat8913/nixpkgs that referenced this pull request Dec 3, 2019
In the process of making UPower.conf customizable (NixOS#73968), it came up
that UPower doesn't load its config from /etc by default.

The UPower derivation is modified to make it load its config from /etc
at runtime, but still install the default config to its nix store path
as before.

The UPower module is modified to symlink the default config into /etc.
@mat8913 mat8913 mentioned this pull request Dec 3, 2019
10 tasks
@worldofpeace
Copy link
Contributor

@mat8913 Could you take the diff that touches the upower package at 56b4d68 and apply it here?

That way you don't have to make it load the config from the package in that PR, then rebase this and undo this.

Documentation of options and default values taken from the upstream
UPower.conf. The documentation was modified slightly to make more sense
when displayed on https://nixos.org/nixos/options.html.

A copy of upstream UPower.conf can be found here:
https://cgit.freedesktop.org/upower/tree/etc/UPower.conf?id=28bd86c181e2510ef6a1dc7cfa26f97803698a79
In the process of making UPower.conf customizable (NixOS#73968), it came up
that UPower doesn't load its config from /etc by default.

The UPower derivation is modified to make it load its config from /etc
at runtime, but still install the default config to its nix store path
as before.

The UPower module is modified to put the config in /etc.
@mat8913
Copy link
Contributor Author

mat8913 commented Dec 4, 2019

OK, I think I've got this right. I'll close the other PR.

@worldofpeace
Copy link
Contributor

Thanks @mat8913, upower is working fine on my machine with these patches.

dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Dec 5, 2019
nixos/upower: Allow customization of UPower.conf

(cherry picked from commit b12aef0)
@mat8913 mat8913 deleted the upower-config-master branch December 5, 2019 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants