Merge pull request #321234 from 0david0mp/dmenu-configfile

dmenu: allow config file argument
This commit is contained in:
Franz Pletz 2024-07-09 17:24:47 +02:00 committed by GitHub
commit 7583e8b826
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 10 deletions

View File

@ -71,6 +71,12 @@
github = "0b11stan";
githubId = 27831931;
};
_0david0mp = {
email = "davidmrpr@proton.me";
github = "0david0mp";
githubId = 54892055;
name = "David mp";
};
_0nyr = {
email = "onyr.maintainer@gmail.com";
github = "0nyr";

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";
};