1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 config,
7 pciutils,
8 cudaSupport ? config.cudaSupport,
9 cudaPackages,
10 installShellFiles,
11 autoAddDriverRunpath,
12 gitUpdater,
13 versionCheckHook,
14 zlib,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "gpufetch";
19 version = "0.25";
20
21 src = fetchFromGitHub {
22 owner = "Dr-Noob";
23 repo = "gpufetch";
24 tag = "v${finalAttrs.version}";
25 hash = "sha256-1j23h3TDxa2xu03o37fXfRL3XFYyhMWFGupAlkrYpBY=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 installShellFiles
31 ]
32 ++ lib.optionals cudaSupport [
33 cudaPackages.cuda_nvcc
34 autoAddDriverRunpath
35 ];
36
37 buildInputs = [
38 zlib
39 pciutils
40 ]
41 ++ lib.optionals cudaSupport [
42 cudaPackages.cuda_cudart
43 cudaPackages.cuda_nvml_dev
44 ];
45
46 installPhase = ''
47 runHook preInstall
48
49 installManPage ${finalAttrs.src}/gpufetch.1
50 install -Dm755 ./gpufetch $out/bin/gpufetch
51
52 runHook postInstall
53 '';
54
55 nativeInstallCheckInputs = [
56 versionCheckHook
57 ];
58 versionCheckProgramArg = "--version";
59 doInstallCheck = true;
60
61 passthru = {
62 updateScript = gitUpdater { rev-prefix = "v"; };
63 };
64
65 meta = {
66 description = "Simple yet fancy GPU architecture fetching tool";
67 homepage = "https://github.com/Dr-Noob/gpufetch";
68 license = lib.licenses.gpl2Only;
69 mainProgram = "gpufetch";
70 maintainers = with lib.maintainers; [ bot-wxt1221 ];
71 platforms = [ "x86_64-linux" ];
72 };
73})