diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index f61c89ec544a9..be54c66494055 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -11931,6 +11931,13 @@ fingerprint = "9E6A 25F2 C1F2 9D76 ED00 1932 1261 173A 01E1 0298"; }]; }; + nadimkobeissi = { + name = "Nadim Kobeissi"; + email = "nadim@symbolic.software"; + github = "nadimkobeissi"; + githubId = 9953; + matrix = "@nadimkobeissi:matrix.org"; + }; nadrieril = { email = "nadrieril@gmail.com"; github = "Nadrieril"; diff --git a/pkgs/os-specific/linux/mcontrolcenter/default.nix b/pkgs/os-specific/linux/mcontrolcenter/default.nix new file mode 100644 index 0000000000000..105e11611daa3 --- /dev/null +++ b/pkgs/os-specific/linux/mcontrolcenter/default.nix @@ -0,0 +1,2 @@ +{ pkgs ? import {} }: +pkgs.libsForQt5.callPackage ./derivation.nix {} diff --git a/pkgs/os-specific/linux/mcontrolcenter/derivation.nix b/pkgs/os-specific/linux/mcontrolcenter/derivation.nix new file mode 100644 index 0000000000000..15825b8132551 --- /dev/null +++ b/pkgs/os-specific/linux/mcontrolcenter/derivation.nix @@ -0,0 +1,62 @@ +{ pkgs, lib, stdenv, qtbase, wrapQtAppsHook, qttools, makeDesktopItem, copyDesktopItems, fetchFromGitHub }: + +stdenv.mkDerivation (finalAttrs: rec { + 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 + qtbase + ]; + + nativeBuildInputs = [ + 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 = '' + 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 + ''; + + 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."; + licencse = licenses.gpl3; + platforms = with platforms; linux; + maintainers = [ maintainers.nadimkobeissi ]; + }; +}) diff --git a/pkgs/os-specific/linux/mcontrolcenter/modprobe.patch b/pkgs/os-specific/linux/mcontrolcenter/modprobe.patch new file mode 100644 index 0000000000000..d444445699f3e --- /dev/null +++ b/pkgs/os-specific/linux/mcontrolcenter/modprobe.patch @@ -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));