nixpkgs/pkgs/by-name/me/merkaartor/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

78 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
gdal,
proj,
protobuf,
qt5,
withGeoimage ? true,
exiv2,
withGpsdlib ? (!stdenv.hostPlatform.isDarwin),
gpsd,
withLibproxy ? false,
libproxy,
withZbar ? false,
zbar,
}:
stdenv.mkDerivation rec {
pname = "merkaartor";
version = "0.20.0";
src = fetchFromGitHub {
owner = "openstreetmap";
repo = "merkaartor";
rev = version;
hash = "sha256-oxLGhIE1qJ9+GOztD1HvrLGRGVO3gyy7Rc6CyzKTFec=";
};
nativeBuildInputs = [
cmake
pkg-config
qt5.qttools
qt5.wrapQtAppsHook
];
buildInputs =
[
gdal
proj
protobuf
qt5.qtnetworkauth
qt5.qtsvg
qt5.qtwebengine
]
++ lib.optional withGeoimage exiv2
++ lib.optional withGpsdlib gpsd
++ lib.optional withLibproxy libproxy
++ lib.optional withZbar zbar;
cmakeFlags = [
(lib.cmakeBool "GEOIMAGE" withGeoimage)
(lib.cmakeBool "GPSD" withGpsdlib)
(lib.cmakeBool "LIBPROXY" withLibproxy)
(lib.cmakeBool "WEBENGINE" true)
(lib.cmakeBool "ZBAR" withZbar)
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/{Applications,bin}
mv $out/merkaartor.app $out/Applications
# Prevent wrapping, otherwise plugins will not be loaded
chmod -x $out/Applications/merkaartor.app/Contents/plugins/background/*.dylib
makeWrapper $out/{Applications/merkaartor.app/Contents/MacOS,bin}/merkaartor
'';
meta = {
description = "OpenStreetMap editor";
homepage = "http://merkaartor.be/";
license = lib.licenses.gpl2Plus;
mainProgram = "merkaartor";
maintainers = with lib.maintainers; [ sikmir ];
platforms = lib.platforms.unix;
};
}