|
|
|
@ -1,8 +1,18 @@ |
|
|
|
|
{ stdenv, lib, fetchFromGitHub, help2man, xrandr }: |
|
|
|
|
{ lib |
|
|
|
|
, bash |
|
|
|
|
, coreutils |
|
|
|
|
, fetchFromGitHub |
|
|
|
|
, gawk |
|
|
|
|
, gnugrep |
|
|
|
|
, gnused |
|
|
|
|
, help2man |
|
|
|
|
, resholve |
|
|
|
|
, xrandr |
|
|
|
|
}: |
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec { |
|
|
|
|
resholve.mkDerivation rec { |
|
|
|
|
pname = "mons"; |
|
|
|
|
version = "20200320"; |
|
|
|
|
version = "unstable-2020-03-20"; |
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub { |
|
|
|
|
owner = "Ventto"; |
|
|
|
@ -12,17 +22,64 @@ stdenv.mkDerivation rec { |
|
|
|
|
fetchSubmodules = true; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
patches = [ |
|
|
|
|
# Substitute xrandr path with @xrandr@ so we can replace it with |
|
|
|
|
# real path in substituteInPlace |
|
|
|
|
./xrandr.patch |
|
|
|
|
]; |
|
|
|
|
/* |
|
|
|
|
Remove reference to `%LIBDIR%/liblist.sh`. This would be linked to the |
|
|
|
|
non-resholved of the library in the final derivation. |
|
|
|
|
|
|
|
|
|
Patching out the library check; it's bad on multiple levels: |
|
|
|
|
1. The check literally breaks if it fails. |
|
|
|
|
See https://github.com/Ventto/mons/pull/49 |
|
|
|
|
2. It doesn't need to do this; source would fail with a |
|
|
|
|
sensible message if the script was missing. |
|
|
|
|
3. resholve can't wrestle with test/[] (at least until |
|
|
|
|
https://github.com/abathur/resholve/issues/78) |
|
|
|
|
*/ |
|
|
|
|
postPatch = '' |
|
|
|
|
substituteInPlace mons.sh --replace '@xrandr@' '${xrandr}/bin/xrandr' |
|
|
|
|
substituteInPlace mons.sh \ |
|
|
|
|
--replace "lib='%LIBDIR%/liblist.sh'" "" \ |
|
|
|
|
--replace '[ ! -r "$lib" ] && { "$lib: library not found."; exit 1; }' "" |
|
|
|
|
''; |
|
|
|
|
|
|
|
|
|
solutions = { |
|
|
|
|
mons = { |
|
|
|
|
scripts = [ "bin/mons" "lib/libshlist/liblist.sh" ]; |
|
|
|
|
interpreter = "${bash}/bin/sh"; |
|
|
|
|
inputs = [ |
|
|
|
|
bash |
|
|
|
|
coreutils |
|
|
|
|
gawk |
|
|
|
|
gnugrep |
|
|
|
|
gnused |
|
|
|
|
xrandr |
|
|
|
|
]; |
|
|
|
|
fix = { |
|
|
|
|
"$lib" = [ "lib/libshlist/liblist.sh" ]; |
|
|
|
|
"$XRANDR" = [ "xrandr" ]; |
|
|
|
|
}; |
|
|
|
|
keep = { |
|
|
|
|
/* |
|
|
|
|
has a whole slate of *flag variables that it sets to either |
|
|
|
|
the true or false builtin and then executes... |
|
|
|
|
*/ |
|
|
|
|
"$aFlag" = true; |
|
|
|
|
"$dFlag" = true; |
|
|
|
|
"$eFlag" = true; |
|
|
|
|
"$mFlag" = true; |
|
|
|
|
"$nFlag" = true; |
|
|
|
|
"$oFlag" = true; |
|
|
|
|
"$sFlag" = true; |
|
|
|
|
"$OFlag" = true; |
|
|
|
|
"$SFlag" = true; |
|
|
|
|
"$pFlag" = true; |
|
|
|
|
"$iFlag" = true; |
|
|
|
|
"$xFlag" = true; |
|
|
|
|
"$is_flag" = true; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ help2man ]; |
|
|
|
|
|
|
|
|
|
makeFlags = [ |
|
|
|
|
"DESTDIR=$(out)" |
|
|
|
|
"PREFIX=" |
|
|
|
@ -33,5 +90,6 @@ stdenv.mkDerivation rec { |
|
|
|
|
homepage = "https://github.com/Ventto/mons.git"; |
|
|
|
|
license = licenses.mit; |
|
|
|
|
maintainers = with maintainers; [ mschneider thiagokokada ]; |
|
|
|
|
platforms = platforms.unix; |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|