Compare commits

...

9 Commits

Author SHA1 Message Date
Suzanne Soy
b93246bced regenerated flake.lock, added another Nvidia version & hash in a comment 2020-11-10 20:13:19 +00:00
Suzanne Soy
68e1819b88 flake (part 2 with changes to flake.nix) 2020-11-10 01:51:06 +00:00
Suzanne Soy
7dcd280d44 flake (part 1 with rename) 2020-11-10 01:50:48 +00:00
Guillaume Bouchard
210c6a8a54
Merge pull request #59 from tudurom/master
Use runtimeShell instead of #!/usr/bin/env sh
2020-07-27 11:12:54 +02:00
Guillaume Bouchard
6fab1faca5
Merge pull request #57 from yilinwei/patch-1
Update README.md
2020-07-24 22:56:58 +02:00
Yilin Wei
ab5c39d32e
Update README.md
vulkan-loader doesn't have vulkaninfo
2020-07-19 18:30:37 +01:00
Guillaume Bouchard
e7039bfb2c
Merge pull request #56 from guibou/nvidia_main_libs_only
Do not build nvidia linux module for nixGLNvidia
2020-07-02 17:23:34 +02:00
Guillaume Bouchard
410cd5b482 Do not build nvidia linux module for nixGLNvidia
Partial fix for #55.

This commit does not build the nvidia kernel module for `nixGLNvidia`
using `libsOnly = true`.

This cannot be applied to `nixGLNvidiaBumblebee` which needs some stuffs
in `nvidia_x11.bin` which only appears if it is built with `libsOnly =
false`.
2020-06-10 17:23:31 +02:00
Tudor Roman
339c6c5795
use runtimeShell instead of #!/usr/bin/env sh 2020-06-08 14:05:27 +03:00
6 changed files with 138 additions and 45 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/result

View File

@ -101,7 +101,7 @@ After installing `nixVulkanIntel`.
```bash
$ sudo apt install mesa-vulkan-drivers
...
$ nixVulkanIntel $(nix-build '<nixpkgs>' --no-out-link -A vulkan-loader)/bin/vulkaninfo | grep VkPhysicalDeviceProperties -A 7
$ nixVulkanIntel $(nix-build '<nixpkgs>' --no-out-link -A vulkan-tools)/bin/vulkaninfo | grep VkPhysicalDeviceProperties -A 7
VkPhysicalDeviceProperties:
===========================
apiVersion = 0x400036 (1.0.54)

View File

@ -1,29 +0,0 @@
{ ## Nvidia informations.
# Version of the system kernel module. Let it to null to enable auto-detection.
nvidiaVersion ? null,
# Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# will be more reproducible and more efficient.
nvidiaHash ? null,
# Alternatively, you can pass a path that points to a nvidia version file
# and let nixGL extract the version from it. That file must be a copy of
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# https://github.com/NixOS/nix/issues/3539 ).
nvidiaVersionFile ? 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,
# Make sure to enable config.allowUnfree to the instance of nixpkgs to be
# able to access the nvidia drivers.
pkgs ? import <nixpkgs> {
config = { allowUnfree = true; };
}
}:
pkgs.callPackage ./nixGL.nix {
inherit
nvidiaVersion
nvidiaVersionFile
nvidiaHash
enable32bits
;
}

72
flake.lock Normal file
View File

@ -0,0 +1,72 @@
{
"nodes": {
"lowdown-src": {
"flake": false,
"locked": {
"lastModified": 1598695561,
"narHash": "sha256-gyH/5j+h/nWw0W8AcR2WKvNBUsiQ7QuxqSJNXAwV+8E=",
"owner": "kristapsdz",
"repo": "lowdown",
"rev": "1705b4a26fbf065d9574dce47a94e8c7c79e052f",
"type": "github"
},
"original": {
"owner": "kristapsdz",
"repo": "lowdown",
"type": "github"
}
},
"nix": {
"inputs": {
"lowdown-src": "lowdown-src",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1604964115,
"narHash": "sha256-ANcswniHS4eYeMNyCGdiG3z0M35vEyvWoCsdLnTvObA=",
"owner": "NixOS",
"repo": "nix",
"rev": "0ed7c957bed18d963df65d55f0c0ffc79dee656d",
"type": "github"
},
"original": {
"id": "nix",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1602702596,
"narHash": "sha256-fqJ4UgOb4ZUnCDIapDb4gCrtAah5Rnr2/At3IzMitig=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ad0d20345219790533ebe06571f82ed6b034db31",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-20.09-small",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"narHash": "sha256-wLDweKqbmufa2wonCKBf4Wfl8I0eS1CGS7WdR5tPHKo=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/60330b60655b3fa3a18624bdd7069855bb37af99.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/60330b60655b3fa3a18624bdd7069855bb37af99.tar.gz"
}
},
"root": {
"inputs": {
"nix": "nix",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

49
flake.nix Normal file
View File

@ -0,0 +1,49 @@
{
description = "";
inputs = {
nixpkgs.url = https://github.com/NixOS/nixpkgs/archive/60330b60655b3fa3a18624bdd7069855bb37af99.tar.gz;
};
outputs = { nixpkgs, nix, self, ... }@inputs : {
defaultPackage.x86_64-linux =
let pkgs = import nixpkgs { system = "x86_64-linux"; config = { allowUnfree = true; }; }; in
(pkgs.callPackage ./nixGL.nix {
nvidiaVersionFile = null;
nvidiaVersion = "455.28"; nvidiaHash = "03ysf61qrb272yqkn7bhn9d65lcfhmqc2c0dbh5prp5f2ndlkqg4";
# nvidiaVersion = "455.23.04"; nvidiaHash = "0rvbb9s4ijb0gyiscd93chbgim4lqmy4ksfy15b4abf078qk7q4g";
# …
enable32bits = true;
}).nixGLIntel; # nixGLNvidia;
# nixpkgs.stdenv.mkDerivation {
# builsInputs = [];
# { ## Nvidia informations.
# # Version of the system kernel module. Let it to null to enable auto-detection.
# nvidiaVersion ? null,
# # Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# # will be more reproducible and more efficient.
# nvidiaHash ? null,
# # Alternatively, you can pass a path that points to a nvidia version file
# # and let nixGL extract the version from it. That file must be a copy of
# # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# # https://github.com/NixOS/nix/issues/3539 ).
# nvidiaVersionFile ? 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,
# # Make sure to enable config.allowUnfree to the instance of nixpkgs to be
# # able to access the nvidia drivers.
# pkgs ? import <nixpkgs> {
# config = { allowUnfree = true; };
# }
# }:
# pkgs.callPackage ./nixGL.nix {
# inherit
# nvidiaVersion
# nvidiaVersionFile
# nvidiaHash
# enable32bits
# ;
# };
# };
};
}

View File

@ -14,7 +14,7 @@
# bit the size of nixGL closure.
enable32bits ? true,
writeTextFile, shellcheck, pcre, runCommand, linuxPackages, fetchurl, lib,
bumblebee, libglvnd, vulkan-validation-layers, mesa_drivers,
runtimeShell, bumblebee, libglvnd, vulkan-validation-layers, mesa_drivers,
pkgsi686Linux,zlib, libdrm, xorg, wayland, gcc
}:
@ -97,7 +97,7 @@ in
nixGLNvidiaBumblebee = addNvidiaVersion (writeExecutable {
name = "nixGLNvidiaBumblebee";
text = ''
#!/usr/bin/env sh
#!${runtimeShell}
export LD_LIBRARY_PATH=${lib.makeLibraryPath [nvidia]}:$LD_LIBRARY_PATH
${bumblebee.override {nvidia_x11 = nvidia; nvidia_x11_i686 = nvidia.lib32;}}/bin/optirun --ldpath ${lib.makeLibraryPath ([libglvnd nvidia] ++ lib.optionals enable32bits [nvidia.lib32 pkgsi686Linux.libglvnd])} "$@"
'';
@ -107,15 +107,15 @@ in
nixNvidiaWrapper = api: addNvidiaVersion (writeExecutable {
name = "nix${api}Nvidia";
text = ''
#!/usr/bin/env sh
#!${runtimeShell}
${lib.optionalString (api == "Vulkan") ''export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d''}
${lib.optionalString (api == "Vulkan") ''export VK_ICD_FILENAMES=${nvidia}/share/vulkan/icd.d/nvidia.json${lib.optionalString enable32bits ":${nvidia.lib32}/share/vulkan/icd.d/nvidia.json"}:$VK_ICD_FILENAMES''}
${lib.optionalString (api == "Vulkan") ''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia.json${lib.optionalString enable32bits ":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia.json"}:$VK_ICD_FILENAMES''}
export LD_LIBRARY_PATH=${lib.makeLibraryPath ([
libglvnd
nvidiaLibsOnly
] ++ lib.optional (api == "Vulkan") vulkan-validation-layers
++ lib.optionals enable32bits [nvidia.lib32 pkgsi686Linux.libglvnd])
++ lib.optionals enable32bits [nvidiaLibsOnly.lib32 pkgsi686Linux.libglvnd])
}:''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
"$@"
'';
@ -133,7 +133,7 @@ in
text = let
drivers = [mesa_drivers] ++ lib.optional enable32bits pkgsi686Linux.mesa_drivers;
in ''
#!/usr/bin/env sh
#!${runtimeShell}
export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" drivers}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath drivers
@ -158,7 +158,7 @@ in
+ ''cat f | xargs | sed "s/ /:/g" > $out''
);
in ''
#!/usr/bin/env bash
#!${runtimeShell}
if [ -n "$LD_LIBRARY_PATH" ]; then
echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2
fi
@ -179,14 +179,14 @@ in
};
nixGLCommon = nixGL:
runCommand "nixGLCommon" {
buildInuts = [nixGL];
}
''
mkdir -p "$out/bin"
# star because nixGLNvidia... have version prefixed name
cp ${nixGL}/bin/* "$out/bin/nixGL";
'';
runCommand "nixGLCommon" {
buildInuts = [nixGL];
}
''
mkdir -p "$out/bin"
# star because nixGLNvidia... have version prefixed name
cp ${nixGL}/bin/* "$out/bin/nixGL";
'';
# The output derivation contains nixGL which point either to
# nixGLNvidia or nixGLIntel using an heuristic.