Creating this post just to bring awareness to NixOS Gnome users, regarding Gnome extension to set Charging threshold / limit various laptops make/models.
Lately with the help of NixOS user (Thanks to the users), the extension addressed issue of not working with NixOS, and now the extension is compatible and can be installed without any additional configuration required by NixOS
Using Battery Health Charging extension, some laptop models are supported out of the box, while others model that are not supported by native linux kernel need to install dependencies, either 3rd party kernel module or packages.
The below link for readme of extension Github pages, contains a list of laptop make/model and dependencies, if required. It also contains command-line to change threshold which can be helpful for if you want to change it without extension by using commandline only. Please check it out for more information. Although I am not sure about the procedure or configuration needed to install these dependencies if required on NixOS.
I have seem lots of users in different forums asking for a GUI way to change battery charging limit/threshold and in most case the post gets locked in 3-4 days without the correct solution and I am unable to answer them, so I am creating this post. Most of user are even unaware that enthusiast have developed kernel modules and packages to change charging threshold.
Hope whoever needs this, finds this post.
Very nice application, but on my Dell it searches for tools from the libsmbios project. it needs a symbolic link like this: sudo ln -s /run/current-system/sw/bin/smbios-battery-ctl /usr/sbin/
I am still new to nixos. I guess there is some way to declare that in the configuration.nix instead of doing it manually in the cli.
I am also not familiar with Nix-OS. There was a request from a NixOS user, due incompatibility with polkit rules, and it was fixed. That was the only time I uised nixos on a Virtual Machine.
I did not take into account that for Dell and Razer with rely on packages like libsmbios, dell control center and razer-cli, since all packages are not at their default location this would be an issue.
Yes, we probably need to come up with a nix configuration, to symlink the path.
If you manage to do so ping me here.
I will also attempt to make this in my free time, but since I am unfamiliar it my take longer.
Solution would be using the program from PATH rather than from the hardcoded path:
I guess the hardcoded path can serve as a fallback in case /usr/sbin is not on PATH.
But the cctk path is non-standard so there is no portable method to find it. And Nixpkgs does not even have it packaged, so that will be a bigger problem.
By the way, there is a proposal to eventually integrate this feature into UPower and gnome-control-center.
So we could require people to install pkgs.dell-command-configure and pkgs.libsmbios have both picked up from PATH, only falling back to the hardcoded paths.
And for people installing the extension from Nixpkgs, we could even patch the paths to avoid the need for manual installation. Although, since this does not allow expressing optional dependencies, relying on PATH will probably be better, to avoid bloating the closure size.
I do not have dell but I have do have NixOS running on VM but I cannot test this.
This will work only if the following path for smbios-battery-ctl doesnt change. Meaning if libsmbios is installed on NixOS the path should always be run/current-system/sw/bin/smbios-battery-ctl
Also I am not sure regarding cctk path? is this correct? /run/current-system/sw/bin/command-configure/opt/dell/dcc/cctk
Let me know if the paths are correct or if they can change in certain situation or they are always at the same pathβ¦
@ NeuerUser Can you test the extension in branch NixOS-Dell on Github? Remove any symlinks added.
The whole point of Nix is that there is no global filesystem hierarchy. /run/current-system/sw/bin would work when the programs are installed through environment.systemPackages NixOS option but we also have users that install programs to their home profile, or even use Nix on other Linux distros.
The only portable way would then would be something like the following β look for the program on PATH for Nix and, if it does not exist, look on the fallback path:
It would be /run/current-system/sw/bin/cctk. The package trees for packages installed using environment.systemPackages NixOS option will be partly linked to /run/current-system/sw. And dell-command-configure package has the the programs directly in $out/bin β as much as Nix does not have global FHS-like hierarchy, Nixpkgs usually enforces it locally in package output tree.
Thanks @jtojnar
I implemented your suggestion. Check for program in PATH and uses it relative_path,
if not check for Absolute path and use Absolute path.
Iβm still very new to nixos, so have no idea how-to build packages from source and to replace the ones from the nixos repo. So, sorry, but I cannot test it.
If you mean building and installin extension from source.
In github choose branch nixos and download/and extract. You will see a folder βBattery-Health-Charging-nixosβ
Correct method
Open folder, Right-click > Open in Console and type ./install.sh.
It might ask to install gettext, if gettext is missing. You can install it running command nix-env -iA nixos.**gettext**.
After installing gettext run extesnsion installer again using ./install.sh
Logout and Re-login, conitnue using extension
If you mean building libsmbios or cctk from source, than I am afraid even I do not know.
No problem. I understand if cannot test. But if you do manage to test it kindly update me. Thank you
No error message, no driver/device specific config tab showing up.
I am not at my computer currently, but can confirm that I can run smbios-battery-ctl from the command line without any special steps. So it should be in PATH.
I am NixOS noob, I just install it in a Vm just to debug issue with NixOS.
All this time I was using Battery Health Charging extension installing from Github.
I tried nix-env -iA nixos.gnomeExtensions.baattery-health-charging
it install an run as a system extension.
and it is still on version 37. How do I update it to the latest one