nixpkgs/pkgs/os-specific/linux/powertop/default.nix
Peter Simons b7badc6be0 powertop: call "xset" from $PATH
Patch the source code to find "xset" in $PATH rather than expecting the
hard-coded path "/usr/bin/xset" to work. I've decided *not* to hard-code
a proper path like "${xset}/bin/xset", because that reference greatly
increases the size of the powertop closure. Since "xset" is required
only for --calibrate (and that even seems to work fine without it), it
felt like an optional dependency is more appropriate in this case.

Thanks to @heydojo locating the source code file that needs patching.

Fixes https://github.com/NixOS/nixpkgs/issues/12662.
2016-01-31 21:44:36 +01:00

25 lines
778 B
Nix

{ stdenv, fetchurl, gettext, libnl, ncurses, pciutils, pkgconfig, zlib }:
stdenv.mkDerivation rec {
name = "powertop-2.8";
src = fetchurl {
url = "https://01.org/sites/default/files/downloads/powertop/${name}.tar.gz";
sha256 = "0nlwazxbnn0k6q5f5b09wdhw0f194lpzkp3l7vxansqhfczmcyx8";
};
buildInputs = [ gettext libnl ncurses pciutils pkgconfig zlib ];
postPatch = ''
substituteInPlace src/main.cpp --replace "/sbin/modprobe" "modprobe"
substituteInPlace src/calibrate/calibrate.cpp --replace "/usr/bin/xset" "xset"
'';
meta = {
description = "Analyze power consumption on Intel-based laptops";
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.chaoflow ];
platforms = stdenv.lib.platforms.linux;
};
}