Unverified Commit 64481d02 authored by Masum Reza's avatar Masum Reza Committed by GitHub
Browse files

Merge pull request #335424 from JohnRTitor/amdvlk-update

amdvlk: apply nixfmt-rfc-style, move to finalAttrs, pkgs/by-name
parents 1f92ee7a a72194fa
Loading
Loading
Loading
Loading
+89 −71
Original line number Diff line number Diff line
{ stdenv
, callPackage
, lib
, fetchRepoProject
, writeScript
, cmake
, directx-shader-compiler
, glslang
, ninja
, patchelf
, perl
, pkg-config
, python3
, expat
, libdrm
, ncurses
, openssl
, wayland
, xorg
, zlib
{
  stdenv,
  callPackage,
  lib,
  fetchRepoProject,
  writeScript,
  cmake,
  directx-shader-compiler,
  glslang,
  ninja,
  patchelf,
  perl,
  pkg-config,
  python3,
  expat,
  libdrm,
  ncurses,
  openssl,
  wayland,
  xorg,
  zlib,
}:
let

  suffix = if stdenv.system == "x86_64-linux" then "64" else "32";

in stdenv.mkDerivation rec {
in
stdenv.mkDerivation (finalAttrs: {
  pname = "amdvlk";
  version = "2024.Q3.1";

  src = fetchRepoProject {
    name = "${pname}-src";
    name = "amdvlk-src";
    manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
    rev = "refs/tags/v-${version}";
    rev = "refs/tags/v-${finalAttrs.version}";
    sha256 = "IZYv9ZfpIllYUhJ3f7AOFmSl7OfWWY8doaG8pe3GE+4=";
  };

  buildInputs = [
  buildInputs =
    [
      expat
      libdrm
      ncurses
      openssl
      wayland
    xorg.libX11
    xorg.libxcb
    xorg.xcbproto
    xorg.libXext
    xorg.libXrandr
    xorg.libXft
    xorg.libxshmfence
      zlib
  ];
    ]
    ++ (with xorg; [
      libX11
      libxcb
      xcbproto
      libXext
      libXrandr
      libXft
      libxshmfence
    ]);

  nativeBuildInputs = [
  nativeBuildInputs =
    [
      cmake
      directx-shader-compiler
      glslang
@@ -59,20 +65,25 @@ in stdenv.mkDerivation rec {
      perl
      pkg-config
      python3
  ] ++ (with python3.pkgs; [
    ]
    ++ (with python3.pkgs; [
      jinja2
      ruamel-yaml
    ]);

  rpath = lib.makeLibraryPath [
  rpath = lib.makeLibraryPath (
    [
      libdrm
      openssl
      stdenv.cc.cc.lib
    xorg.libX11
    xorg.libxcb
    xorg.libxshmfence
      zlib
  ];
    ]
    ++ (with xorg; [
      libX11
      libxcb
      libxshmfence
    ])
  );

  cmakeDir = "../drivers/xgl";

@@ -95,26 +106,33 @@ in stdenv.mkDerivation rec {
    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p coreutils curl gnused jq common-updater-scripts

    packagePath="pkgs/by-name/am/amdvlk/package.nix"

    function setHash() {
      sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's,sha256 = "[^'"'"'"]*",sha256 = "'"$1"'",'
      sed -i $packagePath -e 's,sha256 = "[^'"'"'"]*",sha256 = "'"$1"'",'
    }

    version="$(curl -sL "https://api.github.com/repos/GPUOpen-Drivers/AMDVLK/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
    sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's/version = "[^'"'"'"]*"/version = "'"$version"'"/'
    sed -i $packagePath -e 's/version = "[^'"'"'"]*"/version = "'"$version"'"/'

    setHash "$(nix-instantiate --eval -A lib.fakeSha256 | xargs echo)"
    hash="$(nix to-base64 $(nix-build -A amdvlk 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true))"
    setHash "$hash"
  '';

  passthru.impureTests = { amdvlk = callPackage ./test.nix {}; };
  passthru.impureTests = {
    amdvlk = callPackage ./test.nix { };
  };

  meta = with lib; {
  meta = {
    description = "AMD Open Source Driver For Vulkan";
    homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";
    changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${version}";
    license = licenses.mit;
    platforms = [ "x86_64-linux" "i686-linux" ];
    maintainers = with maintainers; [ Flakebi ];
    changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${finalAttrs.version}";
    license = lib.licenses.mit;
    platforms = [
      "x86_64-linux"
      "i686-linux"
    ];
    maintainers = with lib.maintainers; [ Flakebi ];
  };
}
})
+0 −2
Original line number Diff line number Diff line
@@ -19421,8 +19421,6 @@ with pkgs;
  allegro4 = callPackage ../development/libraries/allegro { };
  allegro5 = callPackage ../development/libraries/allegro/5.nix { };
  amdvlk = callPackage ../development/libraries/amdvlk { };
  amf-headers = callPackage ../development/libraries/amf-headers { };
  aml = callPackage ../development/libraries/aml { };