linux/hardened/patches/6.6: v6.6.73-hardened1 -> v6.6.75-hardened1
[NixPkgs.git] / pkgs / by-name / fa / fastfetch / package.nix
blobe5bd1138f0fc5d318cea3c7c5d1e8f88c8cd8886
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   apple-sdk_15,
6   chafa,
7   cmake,
8   dbus,
9   dconf,
10   ddcutil,
11   glib,
12   hwdata,
13   imagemagick,
14   libXrandr,
15   libdrm,
16   libglvnd,
17   libpulseaudio,
18   libselinux,
19   libsepol,
20   libxcb,
21   makeBinaryWrapper,
22   moltenvk,
23   nix-update-script,
24   ocl-icd,
25   opencl-headers,
26   pcre,
27   pcre2,
28   pkg-config,
29   python3,
30   rpm,
31   sqlite,
32   util-linux,
33   versionCheckHook,
34   vulkan-loader,
35   wayland,
36   xfce,
37   xorg,
38   yyjson,
39   zlib,
40   rpmSupport ? false,
41   vulkanSupport ? true,
42   waylandSupport ? true,
43   x11Support ? true,
44   flashfetchSupport ? false,
46 stdenv.mkDerivation (finalAttrs: {
47   pname = "fastfetch";
48   version = "2.35.0";
50   src = fetchFromGitHub {
51     owner = "fastfetch-cli";
52     repo = "fastfetch";
53     tag = finalAttrs.version;
54     hash = "sha256-ChuK5DHRj1qJIjRo3oB5gdCxox2mDffCVM0wRGc5t1o=";
55   };
57   outputs = [
58     "out"
59     "man"
60   ];
62   nativeBuildInputs = [
63     cmake
64     makeBinaryWrapper
65     pkg-config
66     python3
67   ];
69   buildInputs =
70     [
71       chafa
72       imagemagick
73       pcre
74       pcre2
75       sqlite
76       yyjson
77     ]
78     ++ lib.optionals stdenv.hostPlatform.isLinux [
79       dbus
80       dconf
81       ddcutil
82       glib
83       hwdata
84       libdrm
85       libpulseaudio
86       libselinux
87       libsepol
88       ocl-icd
89       opencl-headers
90       util-linux
91       zlib
92     ]
93     ++ lib.optionals rpmSupport [ rpm ]
94     ++ lib.optionals vulkanSupport [ vulkan-loader ]
95     ++ lib.optionals waylandSupport [ wayland ]
96     ++ lib.optionals x11Support [
97       libXrandr
98       libglvnd
99       libxcb
100       xorg.libXau
101       xorg.libXdmcp
102       xorg.libXext
103     ]
104     ++ lib.optionals (x11Support && (!stdenv.hostPlatform.isDarwin)) [ xfce.xfconf ]
105     ++ lib.optionals stdenv.hostPlatform.isDarwin [
106       apple-sdk_15
107       moltenvk
108     ];
110   cmakeFlags =
111     [
112       (lib.cmakeOptionType "filepath" "CMAKE_INSTALL_SYSCONFDIR" "${placeholder "out"}/etc")
113       (lib.cmakeBool "ENABLE_DIRECTX_HEADERS" false)
114       (lib.cmakeBool "ENABLE_DRM" false)
115       (lib.cmakeBool "ENABLE_IMAGEMAGICK6" false)
116       (lib.cmakeBool "ENABLE_OSMESA" false)
117       (lib.cmakeBool "ENABLE_SYSTEM_YYJSON" true)
118       (lib.cmakeBool "ENABLE_GLX" x11Support)
119       (lib.cmakeBool "ENABLE_RPM" rpmSupport)
120       (lib.cmakeBool "ENABLE_VULKAN" x11Support)
121       (lib.cmakeBool "ENABLE_WAYLAND" waylandSupport)
122       (lib.cmakeBool "ENABLE_X11" x11Support)
123       (lib.cmakeBool "ENABLE_XCB" x11Support)
124       (lib.cmakeBool "ENABLE_XCB_RANDR" x11Support)
125       (lib.cmakeBool "ENABLE_XFCONF" (x11Support && (!stdenv.hostPlatform.isDarwin)))
126       (lib.cmakeBool "ENABLE_XRANDR" x11Support)
127       (lib.cmakeBool "BUILD_FLASHFETCH" flashfetchSupport)
128     ]
129     ++ lib.optionals stdenv.hostPlatform.isLinux [
130       (lib.cmakeOptionType "filepath" "CUSTOM_PCI_IDS_PATH" "${hwdata}/share/hwdata/pci.ids")
131       (lib.cmakeOptionType "filepath" "CUSTOM_AMDGPU_IDS_PATH" "${libdrm}/share/libdrm/amdgpu.ids")
132     ];
134   postPatch = ''
135     substituteInPlace completions/fastfetch.fish --replace-fail python3 '${python3.interpreter}'
136   '';
138   postInstall =
139     ''
140       wrapProgram $out/bin/fastfetch \
141         --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath finalAttrs.buildInputs}"
142     ''
143     + lib.optionalString flashfetchSupport ''
144       wrapProgram $out/bin/flashfetch \
145         --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath finalAttrs.buildInputs}"
146     '';
148   nativeInstallCheckInputs = [ versionCheckHook ];
149   versionCheckProgramArg = "--version";
150   doInstallCheck = true;
152   passthru.updateScript = nix-update-script { };
154   meta = {
155     description = "An actively maintained, feature-rich and performance oriented, neofetch like system information tool";
156     homepage = "https://github.com/fastfetch-cli/fastfetch";
157     changelog = "https://github.com/fastfetch-cli/fastfetch/releases/tag/${finalAttrs.version}";
158     license = lib.licenses.mit;
159     maintainers = with lib.maintainers; [
160       luftmensch-luftmensch
161       khaneliman
162     ];
163     platforms = lib.platforms.all;
164     mainProgram = "fastfetch";
165   };