about summary refs log tree commit diff
path: root/pkgs/by-name/fu/furmark/package.nix
blob: c3e84546f826bbcddb2a5ef1d87f41f0da94e1df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
  autoPatchelfHook,
  copyDesktopItems,
  fetchurl,
  fetchzip,
  lib,
  libGL,
  libGLU,
  libxcrypt-legacy,
  makeDesktopItem,
  makeWrapper,
  stdenv,
  testers,
  vulkan-loader,
}:

let
  description = "OpenGL and Vulkan Benchmark and Stress Test";

  versions = {
    "x86_64-linux" = "2.3.0.0";
    "aarch64-linux" = "2.3.0.0";
    "i686-linux" = "2.0.16";
  };

  sources = {
    "x86_64-linux" = {
      url = "https://gpumagick.com/downloads/files/2024/furmark2/FurMark_${versions.x86_64-linux}_linux64.zip";
      hash = "sha256-9xwnOo8gh6XlX2uTwvEorXsx9FafaeCyCPPPJLJGeuE=";
    };
    "aarch64-linux" = {
      url = "https://gpumagick.com/downloads/files/2024/furmark2/FurMark_${versions.x86_64-linux}_rpi64.zip";
      hash = "sha256-az4prQbg9I+6rt2y1OTy3t21/VHyZS++57r4Ahe3fcQ=";
    };
    "i686-linux" = {
      url = "https://gpumagick.com/downloads/files/2024/furmark2/FurMark_${versions.i686-linux}_linux32.zip";
      hash = "sha256-yXd90FgL3WbTga5x0mXT40BonA2NQtqLzRVzn4s4lLc=";
    };
  };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "furmark";
  version =
    versions.${stdenv.hostPlatform.system}
      or (throw "Furmark is not available on ${stdenv.hostPlatform.system}");

  src = fetchzip sources.${stdenv.hostPlatform.system};

  nativeBuildInputs = [
    autoPatchelfHook
    copyDesktopItems
    makeWrapper
  ];

  buildInputs = [
    libGL
    libGLU
  ] ++ lib.optionals stdenv.isAarch64 [ libxcrypt-legacy ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/share/furmark
    cp -rp * $out/share/furmark

    mkdir -p $out/bin
    for i in $(find $out/share/furmark -maxdepth 1 -type f -executable); do
      ln -s "$i" "$out/bin/$(basename "$i")"
    done

    runHook postInstall
  '';

  appendRunpaths = [ (lib.makeLibraryPath [ vulkan-loader ]) ];

  desktopItems = [
    (makeDesktopItem rec {
      name = "FurMark";
      exec = "FurMark_GUI";
      comment = description;
      desktopName = name;
      genericName = name;
      icon = fetchurl {
        url = "https://www.geeks3d.com/furmark/i/20240220-furmark-logo-02.png";
        hash = "sha256-EqhWQgTEmF/2AcqDxgGtr2m5SMYup28hPEhI6ssFw7g=";
      };
      categories = [
        "System"
        "Monitor"
      ];
    })
  ];

  passthru = {
    tests.version = testers.testVersion {
      package = finalAttrs.finalPackage;
      command = "furmark --version";
    };
  };

  meta = {
    homepage = "https://www.geeks3d.com/furmark/v2/";
    license = lib.licenses.unfree;
    mainProgram = "FurMark_GUI";
    maintainers = with lib.maintainers; [ surfaceflinger ];
    platforms = [
      "aarch64-linux"
      "i686-linux"
      "x86_64-linux"
    ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    inherit description;
  };
})