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

mcontrolcenter: init at 0.4.1 #306216

Merged
merged 2 commits into from
Jun 26, 2024
Merged

mcontrolcenter: init at 0.4.1 #306216

merged 2 commits into from
Jun 26, 2024

Conversation

Tommimon
Copy link
Contributor

@Tommimon Tommimon commented Apr 23, 2024

MControlCenter provides a relatively full-featured control panel for MSI laptops, written in Qt. It allows users to control MSI laptop power plans, fan speed, battery charging limits, keyboard backlight settings, USB power sharing and more.

The application comes with strong desktop integration: shortcuts, taskbar item, etc. etc. -- screenshots here

The package comes with a patch that corrects MControlCenter's path to the modprobe binary, allowing it to automatically load the ec_sys kernel module (included with NixOS by default) with the right settings when launched.

This package has been previous requested by the NixOS community (#244881). Another pull request (#251816) was submitted for this same package. The pull request has been reviewed but I contacted the author personally and he is not interested in completing it any more. For this reason I'm opening a new pull request incorporating all the changes suggested in the review.

This NixOS package has been tested on a NixOS Plasma5 and GNOME 45 desktops.

fixes: #244881

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@NixOSInfra NixOSInfra added the 12. first-time contribution This PR is the author's first one; please be gentle! label Apr 23, 2024
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 23, 2024
@Tommimon Tommimon mentioned this pull request Apr 23, 2024
12 tasks
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Apr 27, 2024
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/3847

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review-december/1711/21

@nim65s
Copy link
Contributor

nim65s commented May 1, 2024

Result of nixpkgs-review pr 306216 run on x86_64-linux 1

1 package built:
  • mcontrolcenter

Copy link
Contributor

@nim65s nim65s left a comment

Choose a reason for hiding this comment

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

I guess you could move this to pkgs/by-name. I think using libsForQt5.callPackage is not needed, and you can maybe directly extract packages from libsForQt5. Could you try ?

pkgs/os-specific/linux/mcontrolcenter/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/mcontrolcenter/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/mcontrolcenter/default.nix Outdated Show resolved Hide resolved
pkgs/os-specific/linux/mcontrolcenter/default.nix Outdated Show resolved Hide resolved
@github-actions github-actions bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label May 2, 2024
@Tommimon
Copy link
Contributor Author

Tommimon commented May 3, 2024

I guess you could move this to pkgs/by-name. I think using libsForQt5.callPackage is not needed, and you can maybe directly extract packages from libsForQt5. Could you try ?

I applied all the suggested changes and tested the package on x86_64-linux, everything should work as intended. Here is a list of what I did:

  • move to pkgs/by-name
  • avoid using libsForQt5.callPackage by extracting packages from libsForQt5
  • getting hash from finalAttrs.version
  • remove unused cmake flags
  • patching with substituteInPlace
  • add kmod to build inputs

@nim65s con you confirm the pool request looks fine to you now?

Copy link
Contributor

@nim65s nim65s left a comment

Choose a reason for hiding this comment

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

This looks good to me, thanks !
I do not know if we have a better solution for this DBus .service file.

@nim65s
Copy link
Contributor

nim65s commented May 4, 2024

Discussions on matrix raised that maybe this .service file (and maybe the desktop file btw) should be proposed upstream. Maybe you can contribute a PR there with those files ?

Also, using pkgs.writeText instead of those echo would be a bit cleaner.

@LordGrimmauld
Copy link
Contributor

LordGrimmauld commented May 4, 2024

Built and tested, launches fine on linux-x86-64 (msi GF75 thin) once the ec-sys kernel module is actually loaded.
However, most options are pretty much locked to something with no way to edit them, with the exception of fan curves. Whether that is due to my extensive customization on tlp, acpi and similar i have not yet fully tested.

@Tommimon
Copy link
Contributor Author

Tommimon commented May 4, 2024

Built and tested, launches fine on linux-x86-64 (msi GF75 thin) once the ec-sys kernel module is actually loaded. However, most options are pretty much locked to something with no way to edit them, with the exception of fan curves. Whether that is due to my extensive customization on tlp, acpi and similar i have not yet fully tested.

It seams to be an upstream issue, someone else reported the same problems for the same model which apparently is not fully supported.

For me the battery options are working correctly, it might be a problem related to tlp in your case (as you suggested).

@LordGrimmauld
Copy link
Contributor

Ah upstream lists my precise model (GF75 thin 10SDR) as fully unsupported currently, soo i guess thats my hardware just not being supported then

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label May 4, 2024
Copy link
Contributor

@LordGrimmauld LordGrimmauld left a comment

Choose a reason for hiding this comment

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

Looking good, i would however actually make use of the upstream dbus service file and use substituteInPlace to fix the paths on it.

Also remember to squash your commits eventually, you want two commits:

  1. maintainers: add Tommimon where you only add the entry in the maintainers file
  2. mcontrolcenter: init at 0.4.1 where all the rest is squashed into it
    The maintainer addition should come first in the history.

pkgs/by-name/mc/mcontrolcenter/package.nix Outdated Show resolved Hide resolved
@LordGrimmauld
Copy link
Contributor

LordGrimmauld commented May 4, 2024

Discussions on matrix raised that maybe this .service file (and maybe the desktop file btw) should be proposed upstream. Maybe you can contribute a PR there with those files ?

Also, using pkgs.writeText instead of those echo would be a bit cleaner.

In an effort to learn more about nix, i tried doing just that; turns out getting the $out path for mcontrolcenter into writeText is either nearly or completely impossible, at which point you'd have to use substituteInPlace during installPhase anyways. Hence there is no reason why you shouldn't just take the upstream dbus service config and fix that using substituteInPlace instead. I left code to do just that in my suggested changes in my review above.

@Tommimon Tommimon closed this May 5, 2024
@Tommimon Tommimon reopened this May 5, 2024
Copy link
Contributor

@LordGrimmauld LordGrimmauld left a comment

Choose a reason for hiding this comment

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

Looking good now 👍

@Tommimon
Copy link
Contributor Author

Tommimon commented May 5, 2024

I added the suggested changes:

  • squashed everything into two commits
  • using upstream service file
  • using substituteInPlace to patch the Exec path
  • using --replace-fail in every other occurrence of substituteInPlace

Copy link
Contributor

@nim65s nim65s left a comment

Choose a reason for hiding this comment

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

Good ! I still have another nit suggestion, but feel free to ignore it if you are tired of those changes 😅

pkgs/by-name/mc/mcontrolcenter/package.nix Outdated Show resolved Hide resolved
@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one reputable person label May 5, 2024
@wegank wegank added the 12.approvals: 2 This PR was reviewed and approved by two reputable people label May 5, 2024
Copy link
Contributor

@LordGrimmauld LordGrimmauld left a comment

Choose a reason for hiding this comment

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

approving again because weganks bot will discard my approval otherwise

@wegank wegank removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label May 15, 2024
@Tommimon
Copy link
Contributor Author

Tommimon commented Jun 1, 2024

@Aleksanaa, can I ask you if you approve the current state of this pr? After I applied the last changes.

Co-authored-by: Nadim Kobeissi <[email protected]>
@Tommimon Tommimon requested a review from Aleksanaa June 26, 2024 13:58
@SuperSandro2000 SuperSandro2000 merged commit 1719216 into NixOS:master Jun 26, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: MControlCenter
8 participants