Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

mbpfan: new package

Daemon that uses input from coretemp module and sets the fan speed using
the applesmc module

+61
+30
pkgs/os-specific/linux/mbpfan/default.nix
··· 1 + { stdenv, lib, fetchFromGitHub, gnugrep, kmod }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "mbpfan-${version}"; 5 + version = "1.9.0"; 6 + src = fetchFromGitHub { 7 + owner = "dgraziotin"; 8 + repo = "mbpfan"; 9 + rev = "v${version}"; 10 + sha256 = "15nm1d0a0c0lzxqngrpn2qpsydsmglnn6d20djl7brpsq26j24h9"; 11 + }; 12 + patches = [ ./fixes.patch ]; 13 + postPatch = '' 14 + substituteInPlace src/main.c \ 15 + --replace '@GREP@' '${gnugrep}/bin/grep' \ 16 + --replace '@LSMOD@' '${kmod}/bin/lsmod' 17 + ''; 18 + installPhase = '' 19 + mkdir -p $out/bin $out/etc 20 + cp bin/mbpfan $out/bin 21 + cp mbpfan.conf $out/etc 22 + ''; 23 + meta = with lib; { 24 + description = "Daemon that uses input from coretemp module and sets the fan speed using the applesmc module"; 25 + homepage = "https://github.com/dgraziotin/mbpfan"; 26 + license = licenses.gpl3; 27 + platforms = platforms.linux; 28 + maintainers = with maintainers; [ cstrahan ]; 29 + }; 30 + }
+29
pkgs/os-specific/linux/mbpfan/fixes.patch
··· 1 + diff --git a/src/main.c b/src/main.c 2 + index e8af708..6cfee17 100644 3 + --- a/src/main.c 4 + +++ b/src/main.c 5 + @@ -71,7 +71,7 @@ void check_requirements() 6 + * Check for coretemp and applesmc modules 7 + * Credits: -http://stackoverflow.com/questions/12978794 8 + */ 9 + - FILE *fd = popen("lsmod | grep coretemp", "r"); 10 + + FILE *fd = popen("@LSMOD@ | @GREP@ coretemp", "r"); 11 + char buf[16]; 12 + 13 + if (!(fread (buf, 1, sizeof (buf), fd) > 0)) { 14 + @@ -87,7 +87,7 @@ void check_requirements() 15 + 16 + pclose(fd); 17 + 18 + - fd = popen("lsmod | grep applesmc", "r"); 19 + + fd = popen("@LSMOD@ | @GREP@ applesmc", "r"); 20 + 21 + if (!(fread (buf, 1, sizeof (buf), fd) > 0)) { 22 + DIR* dir = opendir(APPLESMC_PATH); 23 + @@ -145,4 +145,4 @@ int main(int argc, char *argv[]) 24 + void (*fan_control)() = mbpfan; 25 + go_daemon(fan_control); 26 + exit(EXIT_SUCCESS); 27 + -} 28 + \ No newline at end of file 29 + +}
+2
pkgs/top-level/all-packages.nix
··· 9512 9512 9513 9513 lvm2 = callPackage ../os-specific/linux/lvm2 { }; 9514 9514 9515 + mbpfan = callPackage ../os-specific/linux/mbpfan { }; 9516 + 9515 9517 mdadm = callPackage ../os-specific/linux/mdadm { }; 9516 9518 9517 9519 mingetty = callPackage ../os-specific/linux/mingetty { };