Commit 3281455a authored by Kiskae's avatar Kiskae
Browse files

nvidiaPackages: format generic.nix

parent f409967b
Loading
Loading
Loading
Loading
+87 −55
Original line number Diff line number Diff line
@@ -27,8 +27,17 @@
, brokenOpen ? broken
}@args:

{ lib, stdenv, callPackage, pkgs, pkgsi686Linux, fetchurl
, kernel ? null, perl, nukeReferences, which, libarchive
{ lib
, stdenv
, callPackage
, pkgs
, pkgsi686Linux
, fetchurl
, kernel ? null
, perl
, nukeReferences
, which
, libarchive
, # Whether to build the libraries only (i.e. not the kernel module or
  # nvidia-settings).  Used to support 32-bit binaries on 64-bit
  # Linux.
@@ -42,7 +51,8 @@
  # firmware
, firmware ? openSha256 != null || useFabricmanager
  # Whether the user accepts the NVIDIA Software License
, config, acceptLicense ? config.nvidia.acceptLicense or false
, config
, acceptLicense ? config.nvidia.acceptLicense or false
}:

with lib;
@@ -60,9 +70,18 @@ let
  i686bundled = versionAtLeast version "391" && !disable32Bit;

  libPathFor = pkgs: lib.makeLibraryPath (with pkgs; [
    libdrm xorg.libXext xorg.libX11
    xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc
    wayland mesa libGL openssl
    libdrm
    xorg.libXext
    xorg.libX11
    xorg.libXv
    xorg.libXrandr
    xorg.libxcb
    zlib
    stdenv.cc.cc
    wayland
    mesa
    libGL
    openssl
    dbus # for nvidia-powerd
  ]);

@@ -94,7 +113,8 @@ let
    src =
      if !acceptLicense && (openSha256 == null) then throwLicense else
      if stdenv.hostPlatform.system == "x86_64-linux" then
        fetchurl {
        fetchurl
          {
            urls = if args ? url then [ args.url ] else [
              "https://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run"
              "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run"
@@ -102,7 +122,8 @@ let
            sha256 = sha256_64bit;
          }
      else if stdenv.hostPlatform.system == "i686-linux" then
        fetchurl {
        fetchurl
          {
            urls = if args ? url then [ args.url ] else [
              "https://us.download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run"
              "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run"
@@ -110,7 +131,8 @@ let
            sha256 = sha256_32bit;
          }
      else if stdenv.hostPlatform.system == "aarch64-linux" && sha256_aarch64 != null then
        fetchurl {
        fetchurl
          {
            urls = if args ? url then [ args.url ] else [
              "https://us.download.nvidia.com/XFree86/aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run"
              "https://download.nvidia.com/XFree86/Linux-aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run"
@@ -154,21 +176,30 @@ let

    disallowedReferences = optionals (!libsOnly) [ kernel.dev ];

    passthru = {
      open = mapNullable (hash: callPackage ./open.nix {
    passthru =
      {
        open = mapNullable
          (hash: callPackage ./open.nix {
            inherit hash;
            nvidia_x11 = self;
            broken = brokenOpen;
      }) openSha256;
      settings = if useSettings then
        (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) {
          })
          openSha256;
        settings =
          if useSettings then
            (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256)
              {
                withGtk2 = preferGtk2;
                withGtk3 = !preferGtk2;
              } else { };
      persistenced = if usePersistenced then
        mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256
        persistenced =
          if usePersistenced then
            mapNullable
              (hash: callPackage (import ./persistenced.nix self hash) { })
              persistencedSha256
          else { };
      fabricmanager = if useFabricmanager then
        fabricmanager =
          if useFabricmanager then
            mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256
          else { };
        inherit persistencedVersion settingsVersion;
@@ -191,4 +222,5 @@ let
    };
  };

in self
in
self