1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

dmenu: allow config file argument

fix: formated dmenu package
This commit is contained in:
David Mieres 2024-06-20 11:42:07 +02:00
parent f89624d338
commit ca726da66b

View file

@ -1,7 +1,7 @@
{ lib, stdenv, fetchurl, libX11, libXinerama, libXft, zlib, patches ? null
# update script dependencies
, gitUpdater
}:
{ lib, stdenv, fetchurl, libX11, libXinerama, libXft, zlib, writeText
, conf ? null, patches ? null
# update script dependencies
, 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";
};