From 77a95ebc947abc73ed410cb0b059a27306093f99 Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Wed, 26 Apr 2023 10:44:15 +0200 Subject: [PATCH] linuxKernel.packages.lenovo-legion: init at 2023-04-02-16-53-51 --- pkgs/os-specific/linux/lenovo-legion/app.nix | 48 +++++++++++++++++++ .../linux/lenovo-legion/default.nix | 34 +++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/linux-kernels.nix | 2 + 4 files changed, 86 insertions(+) create mode 100644 pkgs/os-specific/linux/lenovo-legion/app.nix create mode 100644 pkgs/os-specific/linux/lenovo-legion/default.nix diff --git a/pkgs/os-specific/linux/lenovo-legion/app.nix b/pkgs/os-specific/linux/lenovo-legion/app.nix new file mode 100644 index 000000000000..ba189767bca6 --- /dev/null +++ b/pkgs/os-specific/linux/lenovo-legion/app.nix @@ -0,0 +1,48 @@ +{ lib, fetchFromGitHub, xorg, libsForQt5, wrapQtAppsHook, python3 }: + +python3.pkgs.buildPythonApplication rec { + pname = "lenovo-legion-app"; + version = "2023-04-02-16-53-51"; + + src = fetchFromGitHub { + owner = "johnfanv2"; + repo = "LenovoLegionLinux"; + rev = "main${version}"; + sha256 = "sha256-s4JFFmawokdC4qoqNvZDhuJSinhQ3YKSIfAYi79VTTA="; + }; + + sourceRoot = "source/python/legion_linux"; + + nativeBuildInputs = [ wrapQtAppsHook ]; + + propagatedBuildInputs = with python3.pkgs; [ + pyqt5 + argcomplete + pyyaml + xorg.libxcb + libsForQt5.qtbase + ]; + + postInstall = '' + cp -r ./{legion.py,legion_cli.py,legion_gui.py} $out/${python3.sitePackages} + cp ./legion_logo.png $out/${python3.sitePackages}/legion_logo.png + + rm -rf $out/data + ''; + + dontWrapQtApps = true; + + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + + meta = { + description = "An utility to control Lenovo Legion laptop"; + homepage = "https://github.com/johnfanv2/LenovoLegionLinux"; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.ulrikstrid ]; + mainProgram = "legion_gui"; + }; +} + diff --git a/pkgs/os-specific/linux/lenovo-legion/default.nix b/pkgs/os-specific/linux/lenovo-legion/default.nix new file mode 100644 index 000000000000..375b835ac47d --- /dev/null +++ b/pkgs/os-specific/linux/lenovo-legion/default.nix @@ -0,0 +1,34 @@ +{ lib, fetchurl, stdenv, kernel, bash, lenovo-legion }: + +stdenv.mkDerivation { + pname = "lenovo-legion-module"; + inherit (lenovo-legion) version src; + + sourceRoot = "source/kernel_module"; + + hardeningDisable = [ "pic" ]; + + preConfigure = '' + sed -i -e '/depmod/d' ./Makefile + ''; + + makeFlags = kernel.makeFlags ++ [ + "SHELL=bash" + "KERNELVERSION=${kernel.modDirVersion}" + "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "INSTALLDIR=${placeholder "out"}/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86" + "MODDESTDIR=${placeholder "out"}/lib/modules/${kernel.modDirVersion}/kernel/drivers/platform/x86" + "DKMSDIR=${placeholder "out"}/lib/modules/${kernel.modDirVersion}/misc" + ]; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + meta = { + description = "Linux kernel module for controlling fan and power in Lenovo Legion laptops"; + homepage = "https://github.com/johnfanv2/LenovoLegionLinux"; + license = lib.licenses.gpl2Only; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.ulrikstrid ]; + broken = kernel.kernelOlder "5.15"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 26e08cfb6996..4528f9687a11 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32069,6 +32069,8 @@ with pkgs; lemonbar-xft = callPackage ../applications/window-managers/lemonbar/xft.nix { }; + lenovo-legion = libsForQt5.callPackage ../os-specific/linux/lenovo-legion/app.nix { }; + legitify = callPackage ../development/tools/legitify { }; lens = callPackage ../applications/networking/cluster/lens { }; diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index bbaf6f183f69..7e68285707e5 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -386,6 +386,8 @@ in { kvdo = callPackage ../os-specific/linux/kvdo {}; + lenovo-legion-module = callPackage ../os-specific/linux/lenovo-legion { }; + liquidtux = callPackage ../os-specific/linux/liquidtux {}; lkrg = callPackage ../os-specific/linux/lkrg {};