mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
mbpfan: new package
Daemon that uses input from coretemp module and sets the fan speed using the applesmc module
This commit is contained in:
parent
a8f17b376e
commit
53ab1f7d3c
3 changed files with 61 additions and 0 deletions
30
pkgs/os-specific/linux/mbpfan/default.nix
Normal file
30
pkgs/os-specific/linux/mbpfan/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{ stdenv, lib, fetchFromGitHub, gnugrep, kmod }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "mbpfan-${version}";
|
||||||
|
version = "1.9.0";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "dgraziotin";
|
||||||
|
repo = "mbpfan";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "15nm1d0a0c0lzxqngrpn2qpsydsmglnn6d20djl7brpsq26j24h9";
|
||||||
|
};
|
||||||
|
patches = [ ./fixes.patch ];
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace src/main.c \
|
||||||
|
--replace '@GREP@' '${gnugrep}/bin/grep' \
|
||||||
|
--replace '@LSMOD@' '${kmod}/bin/lsmod'
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin $out/etc
|
||||||
|
cp bin/mbpfan $out/bin
|
||||||
|
cp mbpfan.conf $out/etc
|
||||||
|
'';
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Daemon that uses input from coretemp module and sets the fan speed using the applesmc module";
|
||||||
|
homepage = "https://github.com/dgraziotin/mbpfan";
|
||||||
|
license = licenses.gpl3;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = with maintainers; [ cstrahan ];
|
||||||
|
};
|
||||||
|
}
|
29
pkgs/os-specific/linux/mbpfan/fixes.patch
Normal file
29
pkgs/os-specific/linux/mbpfan/fixes.patch
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
diff --git a/src/main.c b/src/main.c
|
||||||
|
index e8af708..6cfee17 100644
|
||||||
|
--- a/src/main.c
|
||||||
|
+++ b/src/main.c
|
||||||
|
@@ -71,7 +71,7 @@ void check_requirements()
|
||||||
|
* Check for coretemp and applesmc modules
|
||||||
|
* Credits: -http://stackoverflow.com/questions/12978794
|
||||||
|
*/
|
||||||
|
- FILE *fd = popen("lsmod | grep coretemp", "r");
|
||||||
|
+ FILE *fd = popen("@LSMOD@ | @GREP@ coretemp", "r");
|
||||||
|
char buf[16];
|
||||||
|
|
||||||
|
if (!(fread (buf, 1, sizeof (buf), fd) > 0)) {
|
||||||
|
@@ -87,7 +87,7 @@ void check_requirements()
|
||||||
|
|
||||||
|
pclose(fd);
|
||||||
|
|
||||||
|
- fd = popen("lsmod | grep applesmc", "r");
|
||||||
|
+ fd = popen("@LSMOD@ | @GREP@ applesmc", "r");
|
||||||
|
|
||||||
|
if (!(fread (buf, 1, sizeof (buf), fd) > 0)) {
|
||||||
|
DIR* dir = opendir(APPLESMC_PATH);
|
||||||
|
@@ -145,4 +145,4 @@ int main(int argc, char *argv[])
|
||||||
|
void (*fan_control)() = mbpfan;
|
||||||
|
go_daemon(fan_control);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
-}
|
||||||
|
\ No newline at end of file
|
||||||
|
+}
|
|
@ -9512,6 +9512,8 @@ let
|
||||||
|
|
||||||
lvm2 = callPackage ../os-specific/linux/lvm2 { };
|
lvm2 = callPackage ../os-specific/linux/lvm2 { };
|
||||||
|
|
||||||
|
mbpfan = callPackage ../os-specific/linux/mbpfan { };
|
||||||
|
|
||||||
mdadm = callPackage ../os-specific/linux/mdadm { };
|
mdadm = callPackage ../os-specific/linux/mdadm { };
|
||||||
|
|
||||||
mingetty = callPackage ../os-specific/linux/mingetty { };
|
mingetty = callPackage ../os-specific/linux/mingetty { };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue