Author: amiddelk
Date: Thu Jan 26 01:02:22 2012
New Revision: 31840
URL: https://nixos.org/websvn/nix/?rev=31840&sc=1
Log:
Added the 'bbswitch' module, which is a more conventient module for powering
off/on nvidia graphics cards than possible via the acpi_call module.
Added:
nixpkgs/trunk/pkgs/os-specific/linux/bbswitch/
nixpkgs/trunk/pkgs/os-specific/linux/bbswitch/default.nix
Modified:
nixpkgs/trunk/pkgs/top-level/all-packages.nix
Added: nixpkgs/trunk/pkgs/os-specific/linux/bbswitch/default.nix
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ nixpkgs/trunk/pkgs/os-specific/linux/bbswitch/default.nix Thu Jan 26
01:02:22 2012 (r31840)
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, kernel }:
+
+let
+
+ version = "0.4.1";
+ name = "bbswitch-${version}";
+
+in stdenv.mkDerivation {
+ inherit name;
+
+ src = fetchurl {
+ url =
"http://github.com/downloads/Bumblebee-Project/bbswitch/${name}.tar.gz";
+ sha256 =
"d579c6efc5f6482f0cf0b2c1b1f1a127413218cdffdc8f2d5a946c11909bda23";
+ };
+
+ preBuild = ''
+ kernelVersion=$(cd ${kernel}/lib/modules && ls)
+ substituteInPlace Makefile \
+ --replace "\$(shell uname -r)" "$kernelVersion" \
+ --replace "/lib/modules" "${kernel}/lib/modules"
+ '';
+
+ installPhase = ''
+ kernelVersion=$(cd ${kernel}/lib/modules && ls)
+ ensureDir $out/lib/modules/$kernelVersion/misc
+ cp bbswitch.ko $out/lib/modules/$kernelVersion/misc
+
+ ensureDir $out/bin
+ tee $out/bin/discrete_vga_poweroff << EOF
+ #!/bin/sh
+
+ echo -n OFF > /proc/acpi/bbswitch
+ EOF
+ tee $out/bin/discrete_vga_poweron << EOF
+ #!/bin/sh
+
+ echo -n ON > /proc/acpi/bbswitch
+ EOF
+ chmod +x $out/bin/discrete_vga_poweroff $out/bin/discrete_vga_poweron
+ '';
+
+ meta = {
+ platforms = stdenv.lib.platforms.linux;
+ description = "A module for powering off hybrid GPUs";
+ };
+}
Modified: nixpkgs/trunk/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/trunk/pkgs/top-level/all-packages.nix Wed Jan 25 23:04:34
2012 (r31839)
+++ nixpkgs/trunk/pkgs/top-level/all-packages.nix Thu Jan 26 01:02:22
2012 (r31840)
@@ -5814,6 +5814,8 @@
acpi_call = callPackage ../os-specific/linux/acpi-call {};
+ bbswitch = callPackage ../os-specific/linux/bbswitch {};
+
ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { };
aufs =
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits