Unverified Commit 382f738a authored by Austin Horstman's avatar Austin Horstman Committed by GitHub
Browse files

fastfetch: additional feature flags; fastfetchMinimal: init at 2.42.0 (#403209)

Cross checking https://github.com/fastfetch-cli/fastfetch/wiki/Dependencies and https://github.com/fastfetch-cli/fastfetch/blob/dev/CMakeLists.txt to allow more granular control over the features available for a fastfetch build. Also adding a package alias for feature flags disabled to get a smaller closure for those who don't need a full fat install.
parents 87ec3d4c b524ef13
Loading
Loading
Loading
Loading
+134 −44
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
  libpulseaudio,
  libselinux,
  libsepol,
  libsysprof-capture,
  libxcb,
  makeBinaryWrapper,
  moltenvk,
@@ -37,11 +38,17 @@
  xorg,
  yyjson,
  zlib,
  # Feature flags
  audioSupport ? true,
  flashfetchSupport ? false,
  gnomeSupport ? true,
  imageSupport ? true,
  openclSupport ? true,
  rpmSupport ? false,
  sqliteSupport ? true,
  vulkanSupport ? true,
  waylandSupport ? true,
  x11Support ? true,
  flashfetchSupport ? false,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "fastfetch";
@@ -67,63 +74,131 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  buildInputs =
    [
      chafa
      imagemagick
    let
      commonDeps = [
        pcre
        pcre2
      sqlite
        yyjson
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      ];

      # Cross-platform optional dependencies
      imageDeps = lib.optionals imageSupport [
        chafa
        imagemagick
      ];

      sqliteDeps = lib.optionals sqliteSupport [
        sqlite
      ];

      linuxCoreDeps = lib.optionals stdenv.hostPlatform.isLinux [
        hwdata
        libselinux
        libsepol
        util-linux
        zlib
      ];

      linuxFeatureDeps = lib.optionals stdenv.hostPlatform.isLinux (
        lib.optionals gnomeSupport [
          dbus
          dconf
      ddcutil
          glib
      hwdata
      libdrm
          libsysprof-capture
        ]
        ++ lib.optionals audioSupport [
          libpulseaudio
      libselinux
      libsepol
        ]
        ++ lib.optionals openclSupport [
          ocl-icd
          opencl-headers
      util-linux
      zlib
        ]
    ++ lib.optionals rpmSupport [ rpm ]
    ++ lib.optionals vulkanSupport [ vulkan-loader ]
    ++ lib.optionals waylandSupport [ wayland ]
    ++ lib.optionals x11Support [
        ++ lib.optionals vulkanSupport [
          libdrm
          ddcutil
        ]
        ++ lib.optionals rpmSupport [
          rpm
        ]
      );

      waylandDeps = lib.optionals waylandSupport [
        wayland
      ];

      vulkanDeps = lib.optionals vulkanSupport [
        vulkan-loader
      ];

      x11Deps = lib.optionals x11Support [
        libXrandr
        libglvnd
        libxcb
        xorg.libXau
        xorg.libXdmcp
        xorg.libXext
    ]
    ++ lib.optionals (x11Support && (!stdenv.hostPlatform.isDarwin)) [ xfce.xfconf ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      ];

      x11XfceDeps = lib.optionals (x11Support && (!stdenv.hostPlatform.isDarwin)) [
        xfce.xfconf
      ];

      macosDeps = lib.optionals stdenv.hostPlatform.isDarwin [
        apple-sdk_15
        moltenvk
      ];
    in
    commonDeps
    ++ imageDeps
    ++ sqliteDeps
    ++ linuxCoreDeps
    ++ linuxFeatureDeps
    ++ waylandDeps
    ++ vulkanDeps
    ++ x11Deps
    ++ x11XfceDeps
    ++ macosDeps;

  cmakeFlags =
    [
      (lib.cmakeOptionType "filepath" "CMAKE_INSTALL_SYSCONFDIR" "${placeholder "out"}/etc")
      (lib.cmakeBool "ENABLE_DIRECTX_HEADERS" false)
      (lib.cmakeBool "ENABLE_DRM" false)
      (lib.cmakeBool "ENABLE_IMAGEMAGICK6" false)
      (lib.cmakeBool "ENABLE_OSMESA" false)
      (lib.cmakeBool "ENABLE_SYSTEM_YYJSON" true)
      (lib.cmakeBool "ENABLE_GLX" x11Support)
      (lib.cmakeBool "ENABLE_RPM" rpmSupport)

      # Feature flags
      (lib.cmakeBool "ENABLE_IMAGEMAGICK6" false)
      (lib.cmakeBool "ENABLE_IMAGEMAGICK7" imageSupport)
      (lib.cmakeBool "ENABLE_CHAFA" imageSupport)
      (lib.cmakeBool "ENABLE_ZLIB" imageSupport)

      (lib.cmakeBool "ENABLE_SQLITE3" sqliteSupport)

      (lib.cmakeBool "ENABLE_PULSE" audioSupport)

      (lib.cmakeBool "ENABLE_GIO" gnomeSupport)
      (lib.cmakeBool "ENABLE_DCONF" gnomeSupport)
      (lib.cmakeBool "ENABLE_DBUS" gnomeSupport)

      (lib.cmakeBool "ENABLE_OPENCL" openclSupport)

      (lib.cmakeBool "ENABLE_DRM" vulkanSupport)
      (lib.cmakeBool "ENABLE_DRM_AMDGPU" vulkanSupport)
      (lib.cmakeBool "ENABLE_VULKAN" vulkanSupport)
      (lib.cmakeBool "ENABLE_DDCUTIL" vulkanSupport)
      (lib.cmakeBool "ENABLE_EGL" vulkanSupport)

      (lib.cmakeBool "ENABLE_WAYLAND" waylandSupport)

      (lib.cmakeBool "ENABLE_GLX" x11Support)
      (lib.cmakeBool "ENABLE_X11" x11Support)
      (lib.cmakeBool "ENABLE_XCB" x11Support)
      (lib.cmakeBool "ENABLE_XCB_RANDR" x11Support)
      (lib.cmakeBool "ENABLE_XFCONF" (x11Support && (!stdenv.hostPlatform.isDarwin)))
      (lib.cmakeBool "ENABLE_XRANDR" x11Support)

      (lib.cmakeBool "ENABLE_RPM" rpmSupport)

      (lib.cmakeBool "BUILD_FLASHFETCH" flashfetchSupport)
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
@@ -162,5 +237,20 @@ stdenv.mkDerivation (finalAttrs: {
    ];
    platforms = lib.platforms.all;
    mainProgram = "fastfetch";
    longDescription = ''
      Fast and highly customizable system info script.

      Feature flags (all default to 'true' except rpmSupport and flashfetchSupport):
      * rpmSupport: RPM package detection (default: false)
      * vulkanSupport: Vulkan GPU information and DRM features
      * waylandSupport: Wayland display detection
      * x11Support: X11 display information
      * flashfetchSupport: Build the flashfetch utility (default: false)
      * imageSupport: Image rendering (chafa and imagemagick)
      * sqliteSupport: Package counting via SQLite
      * audioSupport: PulseAudio functionality
      * gnomeSupport: GNOME integration (dconf, dbus, gio)
      * openclSupport: OpenCL features
    '';
  };
})
+13 −0
Original line number Diff line number Diff line
{ fastfetch }:
fastfetch.override {
  audioSupport = false;
  flashfetchSupport = false;
  gnomeSupport = false;
  imageSupport = false;
  openclSupport = false;
  rpmSupport = false;
  sqliteSupport = false;
  vulkanSupport = false;
  waylandSupport = false;
  x11Support = false;
}