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 #251816

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11931,6 +11931,13 @@
fingerprint = "9E6A 25F2 C1F2 9D76 ED00 1932 1261 173A 01E1 0298";
}];
};
nadimkobeissi = {
name = "Nadim Kobeissi";
email = "[email protected]";
github = "nadimkobeissi";
githubId = 9953;
matrix = "@nadimkobeissi:matrix.org";
};
nadrieril = {
email = "[email protected]";
github = "Nadrieril";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/os-specific/linux/mcontrolcenter/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.libsForQt5.callPackage ./derivation.nix {}
Copy link
Member

@FliegendeWurst FliegendeWurst Nov 9, 2023

Choose a reason for hiding this comment

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

Usually, this line would be in pkgs/top-level/all-packages.nix.
Also please don't try to import <nixpkgs> in nixpkgs.

62 changes: 62 additions & 0 deletions pkgs/os-specific/linux/mcontrolcenter/derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ pkgs, lib, stdenv, qtbase, wrapQtAppsHook, qttools, makeDesktopItem, copyDesktopItems, fetchFromGitHub }:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{ pkgs, lib, stdenv, qtbase, wrapQtAppsHook, qttools, makeDesktopItem, copyDesktopItems, fetchFromGitHub }:
{ pkgs, lib, stdenv, qtbase, wrapQtAppsHook, qttools, makeDesktopItem, copyDesktopItems, fetchFromGitHub, cmake }:


stdenv.mkDerivation (finalAttrs: rec {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
stdenv.mkDerivation (finalAttrs: rec {
stdenv.mkDerivation (finalAttrs: {

pname = "mcontrolcenter";
version = "0.4.1";

desktopItems = [
(makeDesktopItem {
name = "MControlCenter";
exec = "mcontrolcenter";
icon = "mcontrolcenter";
comment = finalAttrs.meta.description;
desktopName = "MControlCenter";
categories = [ "System" ];
})
];

buildInputs = [
pkgs.cmake
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pkgs.cmake

qtbase
];

nativeBuildInputs = [
wrapQtAppsHook
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
wrapQtAppsHook
cmake
wrapQtAppsHook

qttools
copyDesktopItems
];

src = fetchFromGitHub {
owner = "dmitry-s93";
repo = "MControlCenter";
rev = "f04ca9878f0ccfa5ea849a3bd17bcb79a5f52a0a";
hash = "sha256-SV78OVRGzy2zFLT3xqeUtbjlh81Z97PVao18P3h/8dI=";
};

patches = [ ./modprobe.patch ];

cmakeFlags = [
"-DENABLE_TESTING=OFF"
"-DENABLE_INSTALL=ON"
];

installPhase = ''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
installPhase = ''
installPhase = ''
runHook preInstall

install -Dm755 mcontrolcenter $out/bin/mcontrolcenter
install -Dm755 helper/mcontrolcenter-helper $out/libexec/mcontrolcenter-helper
install -Dm644 $src/resources/mcontrolcenter.svg $out/share/icons/hicolor/32x32/apps/mcontrolcenter.svg
install -Dm644 $src/src/helper/mcontrolcenter-helper.conf $out/share/dbus-1/system.d/mcontrolcenter-helper.conf
mkdir -p $out/share/dbus-1/system-services
echo "[D-BUS Service]" >> $out/share/dbus-1/system-services/mcontrolcenter.helper.service
echo "Name=mcontrolcenter.helper" >> $out/share/dbus-1/system-services/mcontrolcenter.helper.service
echo "Exec=$out/libexec/mcontrolcenter-helper" >> $out/share/dbus-1/system-services/mcontrolcenter.helper.service
echo "User=root" >> $out/share/dbus-1/system-services/mcontrolcenter.helper.service
'';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'';
runHook postInstall
'';


meta = with lib; {
homepage = "https://github.com/dmitry-s93/MControlCenter";
description = "An application that allows you to change the settings of MSI laptops running Linux.";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
description = "An application that allows you to change the settings of MSI laptops running Linux.";
description = "Tool to change the settings of MSI laptops running Linux";

licencse = licenses.gpl3;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
licencse = licenses.gpl3;
licencse = licenses.gpl3Plus;

https://github.com/dmitry-s93/MControlCenter/blob/main/src/main.cpp#L8

platforms = with platforms; linux;
maintainers = [ maintainers.nadimkobeissi ];
};
})
13 changes: 13 additions & 0 deletions pkgs/os-specific/linux/mcontrolcenter/modprobe.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/helper/helper.cpp b/src/helper/helper.cpp
index 5c291c8..382c18f 100644
--- a/src/helper/helper.cpp
+++ b/src/helper/helper.cpp
@@ -57,7 +57,7 @@ bool Helper::isEcSysModuleLoaded() const {
bool Helper::loadEcSysModule() const {
fprintf(stderr, "%s\n", qPrintable("Trying to load the ec_sys kernel module"));
auto *process = new QProcess();
- process->start("sh", QStringList() << "-c" << "/usr/sbin/modprobe ec_sys write_support=1 2>&1");
+ process->start("sh", QStringList() << "-c" << "/run/current-system/sw/bin/modprobe ec_sys write_support=1 2>&1");
process->waitForFinished(1000);
if (QByteArray output = process->readAllStandardOutput(); output != "")
fprintf(stderr, "%s", qPrintable(output));