Remove the need for an overlay
nvidia_x11 was overrode in an overlay. It is no longer the case and the override is now explicit. This will allows the creation of a `nixGL.nix` file callable with `callPackage`. This change is a preliminary work for inclusion in `nixpkgs`, as requested in #16. It will also highly improve the use on nixGL in other project because user won't have to pass a non initialized `nixpkgs`.
This commit is contained in:
parent
237b47397f
commit
ae5bc98bb7
36
default.nix
36
default.nix
|
@ -39,26 +39,7 @@ let
|
||||||
name = oldAttrs.name + "-${_nvidiaVersion}";
|
name = oldAttrs.name + "-${_nvidiaVersion}";
|
||||||
});
|
});
|
||||||
|
|
||||||
overlay = self: super:
|
nixpkgs = pkgs {config = {allowUnfree = true;};};
|
||||||
{
|
|
||||||
linuxPackages = super.linuxPackages //
|
|
||||||
{
|
|
||||||
nvidia_x11 = (super.linuxPackages.nvidia_x11.override {
|
|
||||||
}).overrideAttrs(oldAttrs: rec {
|
|
||||||
name = "nvidia-${_nvidiaVersion}";
|
|
||||||
src = let url ="http://download.nvidia.com/XFree86/Linux-x86_64/${_nvidiaVersion}/NVIDIA-Linux-x86_64-${_nvidiaVersion}.run";
|
|
||||||
in if nvidiaHash != null
|
|
||||||
then super.fetchurl {
|
|
||||||
inherit url;
|
|
||||||
sha256 = nvidiaHash;
|
|
||||||
} else
|
|
||||||
builtins.fetchurl url;
|
|
||||||
useGLVND = true;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs = pkgs { overlays = [overlay]; config = {allowUnfree = true;};};
|
|
||||||
|
|
||||||
writeExecutable = { name, text } : nixpkgs.writeTextFile {
|
writeExecutable = { name, text } : nixpkgs.writeTextFile {
|
||||||
inherit name text;
|
inherit name text;
|
||||||
|
@ -81,7 +62,18 @@ let
|
||||||
in
|
in
|
||||||
with nixpkgs;
|
with nixpkgs;
|
||||||
rec {
|
rec {
|
||||||
nvidia = linuxPackages.nvidia_x11;
|
nvidia = (linuxPackages.nvidia_x11.override {
|
||||||
|
}).overrideAttrs(oldAttrs: rec {
|
||||||
|
name = "nvidia-${_nvidiaVersion}";
|
||||||
|
src = let url ="http://download.nvidia.com/XFree86/Linux-x86_64/${_nvidiaVersion}/NVIDIA-Linux-x86_64-${_nvidiaVersion}.run";
|
||||||
|
in if nvidiaHash != null
|
||||||
|
then fetchurl {
|
||||||
|
inherit url;
|
||||||
|
sha256 = nvidiaHash;
|
||||||
|
} else
|
||||||
|
builtins.fetchurl url;
|
||||||
|
useGLVND = true;
|
||||||
|
});
|
||||||
|
|
||||||
nvidiaLibsOnly = nvidia.override {
|
nvidiaLibsOnly = nvidia.override {
|
||||||
libsOnly = true;
|
libsOnly = true;
|
||||||
|
@ -93,7 +85,7 @@ rec {
|
||||||
text = ''
|
text = ''
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
export LD_LIBRARY_PATH=${lib.makeLibraryPath [nvidia]}:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=${lib.makeLibraryPath [nvidia]}:$LD_LIBRARY_PATH
|
||||||
${bumblebee}/bin/optirun --ldpath ${lib.makeLibraryPath ([libglvnd nvidia] ++ lib.optionals enable32bits [nvidia.lib32 pkgsi686Linux.libglvnd])} "$@"
|
${bumblebee.override {nvidia_x11 = nvidia; nvidia_x11_i686 = nvidia.lib32;}}/bin/optirun --ldpath ${lib.makeLibraryPath ([libglvnd nvidia] ++ lib.optionals enable32bits [nvidia.lib32 pkgsi686Linux.libglvnd])} "$@"
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user