Commit ca726da6 authored by David Mieres's avatar David Mieres
Browse files

dmenu: allow config file argument

fix: formated dmenu package
parent f89624d3
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, libX11, libXinerama, libXft, zlib, patches ? null
{ lib, stdenv, fetchurl, libX11, libXinerama, libXft, zlib, writeText
, conf ? null, patches ? null
  # update script dependencies
, gitUpdater
}:
, gitUpdater }:

stdenv.mkDerivation rec {
  pname = "dmenu";
@@ -16,9 +16,15 @@ stdenv.mkDerivation rec {

  inherit patches;

  postPatch = ''
  postPatch = let
    configFile = if lib.isDerivation conf || builtins.isPath conf then
      conf
    else
      writeText "config.def.h" conf;
  in ''
    sed -ri -e 's!\<(dmenu|dmenu_path|stest)\>!'"$out/bin"'/&!g' dmenu_run
    sed -ri -e 's!\<stest\>!'"$out/bin"'/&!g' dmenu_path
    ${lib.optionalString (conf != null) "cp ${configFile} config.def.h"}
  '';

  preConfigure = ''
@@ -27,15 +33,14 @@ stdenv.mkDerivation rec {

  makeFlags = [ "CC:=$(CC)" ];

  passthru.updateScript = gitUpdater {
    url = "git://git.suckless.org/dmenu";
  };
  passthru.updateScript = gitUpdater { url = "git://git.suckless.org/dmenu"; };

  meta = with lib; {
    description = "Generic, highly customizable, and efficient menu for the X Window System";
    description =
      "Generic, highly customizable, and efficient menu for the X Window System";
    homepage = "https://tools.suckless.org/dmenu";
    license = licenses.mit;
    maintainers = with maintainers; [ pSub globin qusic ];
    maintainers = with maintainers; [ pSub globin qusic _0david0mp ];
    platforms = platforms.all;
    mainProgram = "dmenu";
  };