Merge pull request #197275 from laalsaas/master

This commit is contained in:
Sandro 2022-11-07 22:03:43 +01:00 committed by GitHub
commit db76c8377c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 26 deletions

View File

@ -457,6 +457,14 @@
<link linkend="opt-services.uptime-kuma.enable">services.uptime-kuma</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://mepo.milesalan.com">Mepo</link>, a
fast, simple, hackable OSM map viewer for mobile and desktop
Linux. Available as
<link linkend="opt-programs.mepo.enable">programs.mepo.enable</link>.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-22.11-incompatibilities">

View File

@ -149,6 +149,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).
- [Uptime Kuma](https://uptime.kuma.pet/), a fancy self-hosted monitoring tool. Available as [services.uptime-kuma](#opt-services.uptime-kuma.enable).
- [Mepo](https://mepo.milesalan.com), a fast, simple, hackable OSM map viewer for mobile and desktop Linux. Available as [programs.mepo.enable](#opt-programs.mepo.enable).
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
## Backward Incompatibilities {#sec-release-22.11-incompatibilities}

View File

@ -187,6 +187,7 @@
./programs/liboping.nix
./programs/light.nix
./programs/mdevctl.nix
./programs/mepo.nix
./programs/mosh.nix
./programs/mininet.nix
./programs/msmtp.nix

View File

@ -0,0 +1,46 @@
{ pkgs, config, lib, ...}:
with lib;
let
cfg = config.programs.mepo;
in
{
options.programs.mepo = {
enable = mkEnableOption (mdDoc "Mepo");
locationBackends = {
gpsd = mkOption {
type = types.bool;
default = false;
description = mdDoc ''
Whether to enable location detection via gpsd.
This may require additional configuration of gpsd, see [here](#opt-services.gpsd.enable)
'';
};
geoclue = mkOption {
type = types.bool;
default = true;
description = mdDoc "Whether to enable location detection via geoclue";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
mepo
] ++ lib.optional cfg.locationBackends.geoclue geoclue2-with-demo-agent
++ lib.optional cfg.locationBackends.gpsd gpsd;
services.geoclue2 = mkIf cfg.locationBackends.geoclue {
enable = true;
appConfig.where-am-i = {
isAllowed = true;
isSystem = false;
};
};
services.gpsd.enable = cfg.locationBackends.gpsd;
};
meta.maintainers = with maintainers; [ laalsaas ];
}

View File

@ -4,38 +4,38 @@
, pkg-config
, zig
, makeWrapper
, busybox
, curl
, SDL2
, SDL2_gfx
, SDL2_image
, SDL2_ttf
, findutils
, jq
, ncurses
, inconsolata-nerdfont
, dmenu
, xdotool
, bemenu
, withX11 ? false
, gnome
, xorg
, util-linux
, gpsd
, geoclue2-with-demo-agent
}:
let
menuInputs = if withX11 then [ dmenu xdotool ] else [ bemenu ];
in stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
pname = "mepo";
version = "0.4.2";
version = "1.1";
src = fetchFromSourcehut {
owner = "~mil";
repo = pname;
rev = version;
hash = "sha256-k6YXaqB3EwbDPlTvijZf10q+IYwt4/MiqGXL495KIcY=";
hash = "sha256-OIZ617QLjiTiDwcsn0DnRussYtjDkVyifr2mdSqA98A=";
};
nativeBuildInputs = [ pkg-config zig makeWrapper ];
buildInputs = [
curl SDL2 SDL2_gfx SDL2_image SDL2_ttf inconsolata-nerdfont jq ncurses
] ++ menuInputs;
curl SDL2 SDL2_gfx SDL2_image SDL2_ttf jq ncurses
];
preBuild = ''
export HOME=$TMPDIR
@ -54,30 +54,33 @@ in stdenv.mkDerivation rec {
runHook preInstall
zig build -Drelease-safe=true -Dcpu=baseline --prefix $out install
install -d $out/share/man/man1
$out/bin/mepo -docman > $out/share/man/man1/mepo.1
runHook postInstall
'';
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
substituteInPlace $out/bin/mepo_ui_menu_user_pin_updater.sh \
--replace /usr/libexec/geoclue-2.0 ${geoclue2-with-demo-agent}/libexec/geoclue-2.0
substituteInPlace $out/bin/mepo_ui_central_menu.sh \
--replace "grep mepo_" "grep '^\.mepo_\|^mepo_'" \
--replace " ls " " ls -a " #circumvent wrapping for script detection
for program in $out/bin/* ; do
wrapProgram $program \
--suffix PATH : $out/bin:${lib.makeBinPath ([ jq ncurses curl busybox findutils util-linux gpsd gnome.zenity xorg.xwininfo ])}
done
'';
meta = with lib; {
description = "Fast, simple, and hackable OSM map viewer";
homepage = "https://sr.ht/~mil/mepo/";
longDescription = ''
It is recommended to use the corresponding NixOS module.
'';
homepage = "https://mepo.milesalan.com";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ sikmir McSinyx ];
maintainers = with maintainers; [ sikmir McSinyx laalsaas ];
platforms = platforms.linux;
};
}

View File

@ -30244,7 +30244,6 @@ with pkgs;
merkaartor = libsForQt5.callPackage ../applications/misc/merkaartor { };
mepo = callPackage ../applications/misc/mepo { };
mepo-x11 = callPackage ../applications/misc/mepo { withX11 = true; };
meshcentral = callPackage ../tools/admin/meshcentral { };