Unverified Commit 6d7be3ce authored by Ramses's avatar Ramses Committed by GitHub
Browse files

dwlb: add option to set custom config.h (#349363)

parents f2f325db e42bafcc
Loading
Loading
Loading
Loading
+30 −6
Original line number Diff line number Diff line
@@ -3,12 +3,17 @@
  lib,
  fetchFromGitHub,
  pkg-config,
  wayland,
  wayland-scanner,
  wayland-protocols,
  unstableGitUpdater,
  pixman,
  fcft,
  wayland,
  writeText,
  # Boolean flags
  withCustomConfigH ? (configH != null),
  # Configurable options
  configH ? null,
}:

stdenv.mkDerivation {
@@ -26,10 +31,6 @@ stdenv.mkDerivation {
    pkg-config
  ];

  env = {
    PREFIX = placeholder "out";
  };

  buildInputs = [
    wayland-scanner
    wayland-protocols
@@ -38,6 +39,26 @@ stdenv.mkDerivation {
    wayland
  ];

  # Allow alternative config.def.h usage. Taken from dwl.nix.
  postPatch =
    let
      configFile =
        if lib.isDerivation configH || builtins.isPath configH then
          configH
        else
          writeText "config.h" configH;
    in
    lib.optionalString withCustomConfigH "cp ${configFile} config.h";

  env = {
    PREFIX = placeholder "out";
  };

  outputs = [
    "out"
    "man"
  ];

  passthru.updateScript = unstableGitUpdater { };

  meta = {
@@ -45,7 +66,10 @@ stdenv.mkDerivation {
    homepage = "https://github.com/kolunmi/dwlb";
    license = lib.licenses.gpl3Plus;
    mainProgram = "dwlb";
    maintainers = with lib.maintainers; [ bot-wxt1221 ];
    maintainers = with lib.maintainers; [
      bot-wxt1221
      lonyelon
    ];
    platforms = wayland.meta.platforms;
  };
}