nixpkgs/pkgs/applications/misc/mepo/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
1.7 KiB
Nix
Raw Normal View History

2022-01-13 09:00:46 +00:00
{ lib
, stdenv
, fetchFromSourcehut
, pkg-config
, zig
2022-03-24 11:45:59 +00:00
, makeWrapper
2022-01-13 09:00:46 +00:00
, curl
, SDL2
2022-01-31 07:43:17 +00:00
, SDL2_gfx
2022-01-13 09:00:46 +00:00
, SDL2_image
, SDL2_ttf
2022-03-24 11:45:59 +00:00
, jq
, ncurses
, inconsolata-nerdfont
, dmenu
, xdotool
, bemenu
, withX11 ? false
2022-01-13 09:00:46 +00:00
}:
2022-03-24 11:45:59 +00:00
let
menuInputs = if withX11 then [ dmenu xdotool ] else [ bemenu ];
in stdenv.mkDerivation rec {
2022-01-13 09:00:46 +00:00
pname = "mepo";
2022-05-10 05:18:11 +01:00
version = "0.4.2";
2022-01-13 09:00:46 +00:00
src = fetchFromSourcehut {
owner = "~mil";
repo = pname;
rev = version;
2022-05-10 05:18:11 +01:00
hash = "sha256-k6YXaqB3EwbDPlTvijZf10q+IYwt4/MiqGXL495KIcY=";
2022-01-13 09:00:46 +00:00
};
2022-03-24 11:45:59 +00:00
nativeBuildInputs = [ pkg-config zig makeWrapper ];
2022-01-13 09:00:46 +00:00
2022-03-24 11:45:59 +00:00
buildInputs = [
curl SDL2 SDL2_gfx SDL2_image SDL2_ttf inconsolata-nerdfont jq ncurses
] ++ menuInputs;
2022-01-13 09:00:46 +00:00
2022-01-31 07:43:17 +00:00
preBuild = ''
2022-01-13 09:00:46 +00:00
export HOME=$TMPDIR
'';
doCheck = true;
checkPhase = ''
runHook preCheck
zig build test
runHook postCheck
'';
installPhase = ''
runHook preInstall
2022-01-31 07:43:17 +00:00
zig build -Drelease-safe=true -Dcpu=baseline --prefix $out install
2022-01-13 09:00:46 +00:00
runHook postInstall
'';
2022-03-24 11:45:59 +00:00
postInstall = ''
wrapProgram $out/bin/mepo_dl.sh\
--suffix PATH : ${lib.makeBinPath [ jq ncurses ]}
wrapProgram $out/bin/mepo_ui_helper_menu.sh\
--suffix PATH : ${lib.makeBinPath menuInputs}
for script in $(grep -l jq out/bin/mepo_ui_menu_*.sh); do
wrapProgram $script --suffix PATH : $out/bin:${lib.makeBinPath [ jq ]}
done
for prog in $out/bin/mepo*; do
if [ ! -f $out/bin/.$(basename $prog)-wrapped ]; then
wrapProgram $prog --suffix PATH : $out/bin
fi
done
'';
2022-01-13 09:00:46 +00:00
meta = with lib; {
description = "Fast, simple, and hackable OSM map viewer";
homepage = "https://sr.ht/~mil/mepo/";
license = licenses.gpl3Plus;
2022-03-24 11:45:59 +00:00
maintainers = with maintainers; [ sikmir McSinyx ];
platforms = platforms.linux;
2022-01-13 09:00:46 +00:00
};
}