···27 # It will rebuild itself using the version of this package (NSS) and if
28 # an update is required do the required changes to the expression.
29 # Example: nix-shell ./maintainers/scripts/update.nix --argstr package cacert
30- version = "3.68";
3132in
33stdenv.mkDerivation rec {
···3637 src = fetchurl {
38 url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings [ "." ] [ "_" ] version}_RTM/src/${pname}-${version}.tar.gz";
39- sha256 = "0nvj7h2brcw21p1z99nrsxka056d0r1yy9nqqg0lw0w3mhnb60n4";
40 };
4142 depsBuildBuild = [ buildPackages.stdenv.cc ];
···27 # It will rebuild itself using the version of this package (NSS) and if
28 # an update is required do the required changes to the expression.
29 # Example: nix-shell ./maintainers/scripts/update.nix --argstr package cacert
30+ version = "3.70";
3132in
33stdenv.mkDerivation rec {
···3637 src = fetchurl {
38 url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings [ "." ] [ "_" ] version}_RTM/src/${pname}-${version}.tar.gz";
39+ sha256 = "sha256-K4mruGAe5AW+isW1cD1x8fs4pRw6ZKPYNDh/eLMlURs=";
40 };
4142 depsBuildBuild = [ buildPackages.stdenv.cc ];
···1+{ buildPythonPackage, fetchFromGitHub, lib
2+# propagatedBuildInputs
3+, absl-py, numpy, opt-einsum
4+# checkInputs
5+, jaxlib, pytestCheckHook
6+}:
7+8+buildPythonPackage rec {
9+ pname = "jax";
10+ version = "0.2.19";
11+12+ # Fetching from pypi doesn't allow us to run the test suite. See https://discourse.nixos.org/t/pythonremovetestsdir-hook-being-run-before-checkphase/14612/3.
13+ src = fetchFromGitHub {
14+ owner = "google";
15+ repo = pname;
16+ rev = "jax-v${version}";
17+ sha256 = "sha256-pVn62G7pydR7ybkf7gSbu0FlEq2c0US6H2GTBAljup4=";
18+ };
19+20+ # jaxlib is _not_ included in propagatedBuildInputs because there are
21+ # different versions of jaxlib depending on the desired target hardware. The
22+ # JAX project ships separate wheels for CPU, GPU, and TPU. Currently only the
23+ # CPU wheel is packaged.
24+ propagatedBuildInputs = [ absl-py numpy opt-einsum ];
25+26+ checkInputs = [ jaxlib pytestCheckHook ];
27+ # NOTE: Don't run the tests in the expiremental directory as they require flax
28+ # which creates a circular dependency. See https://discourse.nixos.org/t/how-to-nix-ify-python-packages-with-circular-dependencies/14648/2.
29+ # Not a big deal, this is how the JAX docs suggest running the test suite
30+ # anyhow.
31+ pytestFlagsArray = [ "-W ignore::DeprecationWarning" "tests/" ];
32+33+ meta = with lib; {
34+ description = "Differentiate, compile, and transform Numpy code";
35+ homepage = "https://github.com/google/jax";
36+ license = licenses.asl20;
37+ maintainers = with maintainers; [ samuela ];
38+ };
39+}
···1+# For the moment we only support the CPU and GPU backends of jaxlib. The TPU
2+# backend will require some additional work. Those wheels are located here:
3+# https://storage.googleapis.com/jax-releases/libtpu_releases.html.
4+5+# For future reference, the easiest way to test the GPU backend is to run
6+# NIX_PATH=.. nix-shell -p python3 python3Packages.jax "python3Packages.jaxlib.override { cudaSupport = true; }"
7+# export XLA_FLAGS=--xla_gpu_force_compilation_parallelism=1
8+# python -c "from jax.lib import xla_bridge; assert xla_bridge.get_backend().platform == 'gpu'"
9+# python -c "from jax import random; random.PRNGKey(0)"
10+# python -c "from jax import random; x = random.normal(random.PRNGKey(0), (100, 100)); x @ x"
11+# There's no convenient way to test the GPU backend in the derivation since the
12+# nix build environment blocks access to the GPU. See also:
13+# * https://github.com/google/jax/issues/971#issuecomment-508216439
14+# * https://github.com/google/jax/issues/5723#issuecomment-913038780
15+16+{ addOpenGLRunpath, autoPatchelfHook, buildPythonPackage, config, fetchPypi
17+, fetchurl, isPy39, lib, stdenv
18+# propagatedBuildInputs
19+, absl-py, flatbuffers, scipy, cudatoolkit_11
20+# Options:
21+, cudaSupport ? config.cudaSupport or false
22+}:
23+24+assert cudaSupport -> lib.versionAtLeast cudatoolkit_11.version "11.1";
25+26+let
27+ device = if cudaSupport then "gpu" else "cpu";
28+in
29+buildPythonPackage rec {
30+ pname = "jaxlib";
31+ version = "0.1.71";
32+ format = "wheel";
33+34+ # At the time of writing (8/19/21), there are releases for 3.7-3.9. Supporting
35+ # all of them is a pain, so we focus on 3.9, the current nixpkgs python3
36+ # version.
37+ disabled = !isPy39;
38+39+ src = {
40+ cpu = fetchurl {
41+ url = "https://storage.googleapis.com/jax-releases/nocuda/jaxlib-${version}-cp39-none-manylinux2010_x86_64.whl";
42+ sha256 = "sha256:0rqhs6qabydizlv5d3rb20dbv6612rr7dqfniy9r6h4kazdinsn6";
43+ };
44+ gpu = fetchurl {
45+ url = "https://storage.googleapis.com/jax-releases/cuda111/jaxlib-${version}+cuda111-cp39-none-manylinux2010_x86_64.whl";
46+ sha256 = "sha256:065kyzjsk9m84d138p99iymdiiicm1qz8a3iwxz8rspl43rwrw89";
47+ };
48+ }.${device};
49+50+ # Prebuilt wheels are dynamically linked against things that nix can't find.
51+ # Run `autoPatchelfHook` to automagically fix them.
52+ nativeBuildInputs = [ autoPatchelfHook ] ++ lib.optional cudaSupport addOpenGLRunpath;
53+ # Dynamic link dependencies
54+ buildInputs = [ stdenv.cc.cc ];
55+56+ # jaxlib contains shared libraries that open other shared libraries via dlopen
57+ # and these implicit dependencies are not recognized by ldd or
58+ # autoPatchelfHook. That means we need to sneak them into rpath. This step
59+ # must be done after autoPatchelfHook and the automatic stripping of
60+ # artifacts. autoPatchelfHook runs in postFixup and auto-stripping runs in the
61+ # patchPhase. Dependencies:
62+ # * libcudart.so.11.0 -> cudatoolkit_11.lib
63+ # * libcublas.so.11 -> cudatoolkit_11
64+ # * libcuda.so.1 -> opengl driver in /run/opengl-driver/lib
65+ preInstallCheck = lib.optional cudaSupport ''
66+ shopt -s globstar
67+68+ addOpenGLRunpath $out/**/*.so
69+70+ for file in $out/**/*.so; do
71+ rpath=$(patchelf --print-rpath $file)
72+ # For some reason `makeLibraryPath` on `cudatoolkit_11` maps to
73+ # <cudatoolkit_11.lib>/lib which is different from <cudatoolkit_11>/lib.
74+ patchelf --set-rpath "$rpath:${cudatoolkit_11}/lib:${lib.makeLibraryPath [ cudatoolkit_11.lib ]}" $file
75+ done
76+ '';
77+78+ # pip dependencies and optionally cudatoolkit.
79+ propagatedBuildInputs = [ absl-py flatbuffers scipy ] ++ lib.optional cudaSupport cudatoolkit_11;
80+81+ pythonImportsCheck = [ "jaxlib" ];
82+83+ meta = with lib; {
84+ description = "XLA library for JAX";
85+ homepage = "https://github.com/google/jax";
86+ license = licenses.asl20;
87+ maintainers = with maintainers; [ samuela ];
88+ platforms = [ "x86_64-linux" ];
89+ };
90+}
···1-{ stdenv, lib, fetchFromGitHub, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep
2 # rocminfo requires that the calling user have a password and be in
3 # the video group. If we let rocm_agent_enumerator rely upon
4 # rocminfo's output, then it, too, has those requirements. Instead,
···35 '' + lib.optionalString (defaultTargets != []) ''
36 echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
37 '';
00000000000000038}
···1+{ stdenv, lib, fetchFromGitHub, writeScript, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep
2 # rocminfo requires that the calling user have a password and be in
3 # the video group. If we let rocm_agent_enumerator rely upon
4 # rocminfo's output, then it, too, has those requirements. Instead,
···35 '' + lib.optionalString (defaultTargets != []) ''
36 echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
37 '';
38+39+ passthru.updateScript = writeScript "update.sh" ''
40+ #!/usr/bin/env nix-shell
41+ #!nix-shell -i bash -p curl jq common-updater-scripts
42+ version="$(curl -sL "https://api.github.com/repos/RadeonOpenCompute/rocminfo/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
43+ update-source-version rocminfo "$version"
44+ '';
45+46+ meta = with lib; {
47+ description = "ROCm Application for Reporting System Info";
48+ homepage = "https://github.com/RadeonOpenCompute/rocminfo";
49+ license = licenses.ncsa;
50+ maintainers = with maintainers; [ lovesegfault ];
51+ platforms = platforms.linux;
52+ };
53}