Add support for 32bit in nixGLIntel

This closes #30. OpenGL support for 32bit is unconditionnally added to
nixGLIntel.

- Nvidia with bumblebee seems to work out of the box. I don't know why.
- I don't have the hardware to test vulkan.
- I don't have the hardware to test pure nvidia.
This commit is contained in:
Guillaume Bouchard 2020-04-26 16:29:46 +02:00
parent 3ef7bffcae
commit 1ba64e0199

View File

@ -1,6 +1,10 @@
{ system ? builtins.currentSystem, { system ? builtins.currentSystem,
nvidiaVersion ? null, nvidiaVersion ? null,
nvidiaHash ? null, nvidiaHash ? null,
# Enable 32 bits driver
# This is one by default, you can switch it to off if you want to reduce a
# bit the size of nixGL closure.
enable32bits ? true,
pkgs ? import <nixpkgs> pkgs ? import <nixpkgs>
}: }:
@ -51,6 +55,7 @@ rec {
kernel = null; kernel = null;
}; };
# TODO: 32bit version? Looks like it works fine without anything special.
nixGLNvidiaBumblebee = writeExecutable { nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee"; name = "nixGLNvidiaBumblebee";
text = '' text = ''
@ -60,6 +65,7 @@ rec {
''; '';
}; };
# TODO: 32bit version? Not tested.
nixNvidiaWrapper = api: writeExecutable { nixNvidiaWrapper = api: writeExecutable {
name = "nix${api}Nvidia"; name = "nix${api}Nvidia";
text = '' text = ''
@ -75,23 +81,28 @@ rec {
''; '';
}; };
# TODO: 32bit version? Not tested.
nixGLNvidia = nixNvidiaWrapper "GL"; nixGLNvidia = nixNvidiaWrapper "GL";
# TODO: 32bit version? Not tested.
nixVulkanNvidia = nixNvidiaWrapper "Vulkan"; nixVulkanNvidia = nixNvidiaWrapper "Vulkan";
nixGLIntel = writeExecutable { nixGLIntel = writeExecutable {
name = "nixGLIntel"; name = "nixGLIntel";
text = '' # add the 32 bits drivers if needed
text = let
drivers = [mesa_drivers] ++ lib.optional enable32bits pkgsi686Linux.mesa_drivers;
in ''
#!/usr/bin/env sh #!/usr/bin/env sh
export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" [mesa_drivers]} export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" drivers}
export LD_LIBRARY_PATH=${ export LD_LIBRARY_PATH=${
lib.makeLibraryPath [ lib.makeLibraryPath drivers
mesa_drivers]
}:$LD_LIBRARY_PATH }:$LD_LIBRARY_PATH
"$@" "$@"
''; '';
}; };
# TODO: 32 bit version? Not tested.
nixVulkanIntel = writeExecutable { nixVulkanIntel = writeExecutable {
name = "nixVulkanIntel"; name = "nixVulkanIntel";
text = '' text = ''