uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
141
pkgs/tools/X11/bumblebee/default.nix
Normal file
141
pkgs/tools/X11/bumblebee/default.nix
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
# The bumblebee package allows a program to be rendered on an
|
||||
# dedicated video card by spawning an additional X11 server and
|
||||
# streaming the results via VirtualGL or primus to the primary server.
|
||||
|
||||
# The package is rather chaotic; it's also quite recent.
|
||||
# As it may change a lot, some of the hacks in this nix expression
|
||||
# will hopefully not be needed in the future anymore.
|
||||
|
||||
# To test:
|
||||
# 1. make sure that the 'bbswitch' kernel module is installed,
|
||||
# 2. then run 'bumblebeed' as root
|
||||
# 3. Then either 'optirun glxinfo' or 'primusrun glxinfo' as user.
|
||||
#
|
||||
# The glxinfo output should indicate the NVidia driver is being used
|
||||
# and all expected extensions are supported.
|
||||
#
|
||||
# To use at startup, see hardware.bumblebee options.
|
||||
|
||||
{ stdenv, lib, fetchurl, fetchpatch, pkg-config, help2man, makeWrapper
|
||||
, glib, libbsd
|
||||
, libX11, xorgserver, kmod, xf86videonouveau
|
||||
, nvidia_x11, virtualgl, libglvnd
|
||||
, automake111x, autoconf
|
||||
# The below should only be non-null in a x86_64 system. On a i686
|
||||
# system the above nvidia_x11 and virtualgl will be the i686 packages.
|
||||
# TODO: Confusing. Perhaps use "SubArch" instead of i686?
|
||||
, nvidia_x11_i686 ? null
|
||||
, libglvnd_i686 ? null
|
||||
, useDisplayDevice ? false
|
||||
, extraNvidiaDeviceOptions ? ""
|
||||
, extraNouveauDeviceOptions ? ""
|
||||
, useNvidia ? true
|
||||
}:
|
||||
|
||||
let
|
||||
nvidia_x11s = [ nvidia_x11 ]
|
||||
++ lib.optional nvidia_x11.useGLVND libglvnd
|
||||
++ lib.optionals (nvidia_x11_i686 != null)
|
||||
([ nvidia_x11_i686 ] ++ lib.optional nvidia_x11_i686.useGLVND libglvnd_i686);
|
||||
|
||||
nvidiaLibs = lib.makeLibraryPath nvidia_x11s;
|
||||
|
||||
bbdPath = lib.makeBinPath [ kmod xorgserver ];
|
||||
|
||||
xmodules = lib.concatStringsSep "," (map (x: "${x.out or x}/lib/xorg/modules") ([ xorgserver ] ++ lib.optional (!useNvidia) xf86videonouveau));
|
||||
|
||||
modprobePatch = fetchpatch {
|
||||
url = "https://github.com/Bumblebee-Project/Bumblebee/commit/1ada79fe5916961fc4e4917f8c63bb184908d986.patch";
|
||||
sha256 = "02vq3vba6nx7gglpjdfchws9vjhs1x02a543yvqrxqpvvdfim2x2";
|
||||
};
|
||||
libkmodPatch = fetchpatch {
|
||||
url = "https://github.com/Bumblebee-Project/Bumblebee/commit/deceb14cdf2c90ff64ebd1010a674305464587da.patch";
|
||||
sha256 = "00c05i5lxz7vdbv445ncxac490vbl5g9w3vy3gd71qw1f0si8vwh";
|
||||
};
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "bumblebee";
|
||||
version = "3.2.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.bumblebee-project.org/${pname}-${version}.tar.gz";
|
||||
sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./nixos.patch
|
||||
|
||||
modprobePatch
|
||||
libkmodPatch
|
||||
];
|
||||
|
||||
# By default we don't want to use a display device
|
||||
nvidiaDeviceOptions = lib.optionalString (!useDisplayDevice) ''
|
||||
# Disable display device
|
||||
Option "UseEDID" "false"
|
||||
Option "UseDisplayDevice" "none"
|
||||
'' + extraNvidiaDeviceOptions;
|
||||
|
||||
nouveauDeviceOptions = extraNouveauDeviceOptions;
|
||||
|
||||
# the have() function is deprecated and not available to bash completions the
|
||||
# way they are currently loaded in NixOS, so use _have. See #10936
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/bash_completion/bumblebee \
|
||||
--replace "have optirun" "_have optirun"
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
# Don't use a special group, just reuse wheel.
|
||||
substituteInPlace configure \
|
||||
--replace 'CONF_GID="bumblebee"' 'CONF_GID="wheel"'
|
||||
|
||||
# Apply configuration options
|
||||
substituteInPlace conf/xorg.conf.nvidia \
|
||||
--subst-var nvidiaDeviceOptions
|
||||
|
||||
substituteInPlace conf/xorg.conf.nouveau \
|
||||
--subst-var nouveauDeviceOptions
|
||||
'';
|
||||
|
||||
# Build-time dependencies of bumblebeed and optirun.
|
||||
# Note that it has several runtime dependencies.
|
||||
buildInputs = [ libX11 glib libbsd kmod ];
|
||||
nativeBuildInputs = [ makeWrapper pkg-config help2man automake111x autoconf ];
|
||||
|
||||
# The order of LDPATH is very specific: First X11 then the host
|
||||
# environment then the optional sub architecture paths.
|
||||
#
|
||||
# The order for MODPATH is the opposite: First the environment that
|
||||
# includes the acceleration driver. As this is used for the X11
|
||||
# server, which runs under the host architecture, this does not
|
||||
# include the sub architecture components.
|
||||
configureFlags = [
|
||||
"--with-udev-rules=$out/lib/udev/rules.d"
|
||||
# see #10282
|
||||
#"CONF_PRIMUS_LD_PATH=${primusLibs}"
|
||||
] ++ lib.optionals useNvidia [
|
||||
"CONF_LDPATH_NVIDIA=${nvidiaLibs}"
|
||||
"CONF_MODPATH_NVIDIA=${nvidia_x11.bin}/lib/xorg/modules"
|
||||
];
|
||||
|
||||
CFLAGS = [
|
||||
"-DX_MODULE_APPENDS=\\\"${xmodules}\\\""
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram "$out/sbin/bumblebeed" \
|
||||
--prefix PATH : "${bbdPath}"
|
||||
|
||||
wrapProgram "$out/bin/optirun" \
|
||||
--prefix PATH : "${virtualgl}/bin"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/Bumblebee-Project/Bumblebee";
|
||||
description = "Daemon for managing Optimus videocards (power-on/off, spawns xservers)";
|
||||
platforms = platforms.linux;
|
||||
license = licenses.gpl3;
|
||||
maintainers = with maintainers; [ abbradar ];
|
||||
};
|
||||
}
|
||||
80
pkgs/tools/X11/bumblebee/nixos.patch
Normal file
80
pkgs/tools/X11/bumblebee/nixos.patch
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
diff --git a/conf/xorg.conf.nouveau b/conf/xorg.conf.nouveau
|
||||
index 87e48cb..60d6eaf 100644
|
||||
--- a/conf/xorg.conf.nouveau
|
||||
+++ b/conf/xorg.conf.nouveau
|
||||
@@ -15,4 +15,5 @@ Section "Device"
|
||||
# This Setting is needed on Ubuntu 13.04.
|
||||
# BusID "PCI:01:00:0"
|
||||
|
||||
+@nouveauDeviceOptions@
|
||||
EndSection
|
||||
diff --git a/conf/xorg.conf.nvidia b/conf/xorg.conf.nvidia
|
||||
index c3107f9..17072f4 100644
|
||||
--- a/conf/xorg.conf.nvidia
|
||||
+++ b/conf/xorg.conf.nvidia
|
||||
@@ -29,6 +29,6 @@ Section "Device"
|
||||
Option "ProbeAllGpus" "false"
|
||||
|
||||
Option "NoLogo" "true"
|
||||
- Option "UseEDID" "false"
|
||||
- Option "UseDisplayDevice" "none"
|
||||
+
|
||||
+@nvidiaDeviceOptions@
|
||||
EndSection
|
||||
diff --git a/src/bbsecondary.c b/src/bbsecondary.c
|
||||
index 71a6b73..a682d8a 100644
|
||||
--- a/src/bbsecondary.c
|
||||
+++ b/src/bbsecondary.c
|
||||
@@ -145,6 +145,23 @@ bool start_secondary(bool need_secondary) {
|
||||
}
|
||||
|
||||
bb_log(LOG_INFO, "Starting X server on display %s.\n", bb_config.x_display);
|
||||
+ const char mod_appends[] = X_MODULE_APPENDS;
|
||||
+
|
||||
+ char *mod_path;
|
||||
+ int pathlen = strlen(bb_config.mod_path);
|
||||
+ if (pathlen == 0) {
|
||||
+ mod_path = mod_appends;
|
||||
+ } else {
|
||||
+ mod_path = malloc(pathlen + 1 + sizeof(mod_appends));
|
||||
+ if (!mod_path) {
|
||||
+ set_bb_error("Could not allocate memory for modules path\n");
|
||||
+ return false;
|
||||
+ }
|
||||
+ strcpy(mod_path, bb_config.mod_path);
|
||||
+ mod_path[pathlen] = ',';
|
||||
+ strcpy(mod_path + pathlen + 1, mod_appends);
|
||||
+ }
|
||||
+
|
||||
char *x_argv[] = {
|
||||
XORG_BINARY,
|
||||
bb_config.x_display,
|
||||
@@ -153,24 +170,24 @@ bool start_secondary(bool need_secondary) {
|
||||
"-sharevts",
|
||||
"-nolisten", "tcp",
|
||||
"-noreset",
|
||||
+ "-logfile", "/var/log/X.bumblebee.log",
|
||||
"-verbose", "3",
|
||||
"-isolateDevice", pci_id,
|
||||
- "-modulepath", bb_config.mod_path, // keep last
|
||||
+ "-modulepath", mod_path,
|
||||
NULL
|
||||
};
|
||||
enum {n_x_args = sizeof(x_argv) / sizeof(x_argv[0])};
|
||||
- if (!*bb_config.mod_path) {
|
||||
- x_argv[n_x_args - 3] = 0; //remove -modulepath if not set
|
||||
- }
|
||||
//close any previous pipe, if it (still) exists
|
||||
if (bb_status.x_pipe[0] != -1){close(bb_status.x_pipe[0]); bb_status.x_pipe[0] = -1;}
|
||||
if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}
|
||||
//create a new pipe
|
||||
if (pipe2(bb_status.x_pipe, O_NONBLOCK | O_CLOEXEC)){
|
||||
set_bb_error("Could not create output pipe for X");
|
||||
+ if (pathlen > 0) free(mod_path);
|
||||
return false;
|
||||
}
|
||||
bb_status.x_pid = bb_run_fork_ld_redirect(x_argv, bb_config.ld_path, bb_status.x_pipe[1]);
|
||||
+ if (pathlen > 0) free(mod_path);
|
||||
//close the end of the pipe that is not ours
|
||||
if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue