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

nixos/modules/services/hardware/upower.nix Outdated Show resolved Hide resolved
mat8913 added a commit to mat8913/nixpkgs that referenced this pull request Nov 23, 2019
Copy link
Member

@worldofpeace worldofpeace left a comment

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
4 of 10 tasks complete
@worldofpeace
Copy link
Member

@worldofpeace worldofpeace commented Dec 3, 2019

@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.

mat8913 added 2 commits 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
In the process of making UPower.conf customizable (#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 mat8913 force-pushed the mat8913:upower-config-master branch from 9170cfe to f83a83f Dec 4, 2019
@mat8913
Copy link
Contributor Author

@mat8913 mat8913 commented Dec 4, 2019

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

@worldofpeace worldofpeace merged commit b12aef0 into NixOS:master Dec 5, 2019
15 checks passed
15 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
upower on aarch64-linux Success
Details
upower on x86_64-linux Success
Details
@worldofpeace
Copy link
Member

@worldofpeace worldofpeace commented Dec 5, 2019

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

dtzWill added 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 mat8913:upower-config-master branch Dec 5, 2019
worldofpeace added a commit to worldofpeace/nixpkgs that referenced this pull request Dec 13, 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 put the config in /etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.