4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
53 lines
1.4 KiB
Nix
53 lines
1.4 KiB
Nix
{ lib, stdenv, fetchFromGitHub, fetchpatch
|
|
, libX11, libGL, mesa
|
|
, nvidia_x11 ? null
|
|
, libglvnd
|
|
}:
|
|
|
|
let
|
|
aPackage =
|
|
if nvidia_x11 == null then libGL
|
|
else if nvidia_x11.useGLVND then libglvnd
|
|
else nvidia_x11;
|
|
|
|
in stdenv.mkDerivation {
|
|
name = "primus-lib-2015-04-28";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "amonakov";
|
|
repo = "primus";
|
|
rev = "d1afbf6fce2778c0751eddf19db9882e04f18bfd";
|
|
sha256 = "118jm57ccawskb8vjq3a9dpa2gh72nxzvx2zk7zknpy0arrdznj1";
|
|
};
|
|
|
|
patches = [
|
|
# Bump buffer size for long library paths.
|
|
(fetchpatch {
|
|
url = "https://github.com/abbradar/primus/commit/2f429e232581c556df4f4bf210aee8a0c99c60b7.patch";
|
|
sha256 = "1da6ynz7r7x98495i329sf821308j1rpy8prcdraqahz7p4c89nc";
|
|
})
|
|
];
|
|
|
|
buildInputs = [ libX11 libGL ];
|
|
|
|
makeFlags = [ "LIBDIR=$(out)/lib"
|
|
"PRIMUS_libGLa=${aPackage}/lib/libGL.so"
|
|
"PRIMUS_libGLd=${libGL}/lib/libGL.so"
|
|
"PRIMUS_LOAD_GLOBAL=${mesa}/lib/libglapi.so"
|
|
];
|
|
|
|
installPhase = ''
|
|
ln -s $out/lib/libGL.so.1 $out/lib/libGL.so
|
|
'';
|
|
|
|
passthru.glvnd = if nvidia_x11 != null && nvidia_x11.useGLVND then nvidia_x11 else null;
|
|
|
|
meta = with lib; {
|
|
description = "Low-overhead client-side GPU offloading";
|
|
homepage = "https://github.com/amonakov/primus";
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
|
license = licenses.bsd2;
|
|
maintainers = with maintainers; [ abbradar ];
|
|
};
|
|
}
|