nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

package.nix (3967B)


      1 {
      2   lib,
      3   stdenv,
      4   fetchFromGitHub,
      5   fetchpatch,
      6   desktopToDarwinBundle,
      7   db,
      8   fig2dev,
      9   giflib,
     10   gsettings-desktop-schemas,
     11   gtkmm3,
     12   imagemagick,
     13   jansson,
     14   curl,
     15   libiconv,
     16   libjpeg,
     17   libpng,
     18   librsvg,
     19   libtiff,
     20   libxml2,
     21   libzip,
     22   perlPackages,
     23   pkg-config,
     24   proj,
     25   shapelib,
     26   sqlite,
     27   unzip,
     28   wrapGAppsHook3,
     29 }:
     30 
     31 let
     32   libs = fetchFromGitHub {
     33     owner = "slazav";
     34     repo = "mapsoft2-libs";
     35     rev = "a33c77c793f3f46b61d9129f91e2441316059fdc";
     36     hash = "sha256-ecbxB8gMZen1kZTku8U45amOH4DP3B+uedK6rG2R8xc=";
     37   };
     38 in
     39 stdenv.mkDerivation (finalAttrs: {
     40   pname = "mapsoft2";
     41   version = "2.10-alt1-unstable-2025-09-28";
     42 
     43   src = fetchFromGitHub {
     44     owner = "slazav";
     45     repo = "mapsoft2";
     46     rev = "e217d77bce2c0a3e64ca96156efdf20533b656ad";
     47     hash = "sha256-/sWScmKxeVEI1+vEyZEXwqgEk99SS5CBOGeyENylSNw=";
     48   };
     49 
     50   prePatch = ''
     51     cp -r ${libs}/* modules
     52     chmod -R +w modules
     53   '';
     54 
     55   patches = [
     56     # https://github.com/slazav/mapsoft2-libs/commit/c0c13a537d4aa6f8d8af530f29408a0ae8c5512c#r152084247
     57     (fetchpatch {
     58       url = "https://github.com/slazav/mapsoft2-libs/commit/c0c13a537d4aa6f8d8af530f29408a0ae8c5512c.patch";
     59       hash = "sha256-uTJnLPwPupUy3c8zr/nx87lA97YQKhQ1nQsr3ltOUE8=";
     60       revert = true;
     61       stripLen = 1;
     62       extraPrefix = "modules/";
     63     })
     64     ./0002-fix-build.patch
     65   ]
     66   ++ lib.optional (!finalAttrs.doCheck) ./0003-notests.patch;
     67 
     68   postPatch =
     69     let
     70       srcFiles = [
     71         "docs/man/ms2render.htm"
     72         "docs/man/ms2view.htm"
     73         "docs/man/ms2view.txt"
     74         "docs/man/ms2vmap.htm"
     75         "docs/man/ms2vmapdb.htm"
     76         "modules/mapview/action_manager.cpp"
     77         "modules/mapview/mapview.cpp"
     78         "modules/vmap2/vmap2gobj.cpp"
     79         "modules/vmap2/vmap2types.cpp"
     80         "vmap_data/scripts/vmaps.sh"
     81         "vmap_data/scripts/vmaps_diff"
     82         "vmap_data/scripts/vmaps_get_fig"
     83         "vmap_data/scripts/vmaps_img"
     84         "vmap_data/scripts/vmaps_in"
     85         "vmap_data/scripts/vmaps_index"
     86         "vmap_data/scripts/vmaps_out"
     87         "vmap_data/scripts/vmaps_pack_img"
     88         "vmap_data/scripts/vmaps_pack_mbtiles"
     89         "vmap_data/scripts/vmaps_pack_sqlitedb"
     90         "vmap_data/scripts/vmaps_png"
     91         "vmap_data/scripts/vmaps_preview"
     92         "vmap_data/scripts/vmaps_rend_mbtiles"
     93         "vmap_data/scripts/vmaps_tiles"
     94         "vmap_data/scripts/vmaps_tlist"
     95         "vmap_data/scripts/vmaps_wp_update"
     96       ];
     97     in
     98     ''
     99       ${lib.concatStringsSep "\n" (map (file: ''substituteInPlace ${file} --subst-var out'') srcFiles)}
    100 
    101       substituteInPlace modules/opt/Makefile --replace-fail "SIMPLE_TESTS := opt" ""
    102       substituteInPlace modules/tmpdir/Makefile --replace-fail "SCRIPT_TESTS := tmpdir" ""
    103       substituteInPlace modules/get_deps --replace-fail "/usr/bin/perl" "${perlPackages.perl}/bin/perl"
    104       patchShebangs .
    105     '';
    106 
    107   nativeBuildInputs = [
    108     fig2dev
    109     imagemagick
    110     perlPackages.perl
    111     pkg-config
    112     unzip
    113     wrapGAppsHook3
    114   ]
    115   ++ lib.optional stdenv.isDarwin desktopToDarwinBundle;
    116 
    117   buildInputs = [
    118     db
    119     giflib
    120     gsettings-desktop-schemas
    121     gtkmm3
    122     jansson
    123     curl
    124     libjpeg
    125     libpng
    126     librsvg
    127     libtiff
    128     libxml2
    129     libzip
    130     proj
    131     shapelib
    132     sqlite
    133   ]
    134   ++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
    135 
    136   env = {
    137     SKIP_IMG_DIFFS = 1;
    138     NIX_CFLAGS_COMPILE = "-std=c++17";
    139     NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-liconv";
    140   };
    141 
    142   enableParallelBuilding = true;
    143 
    144   makeFlags = [ "prefix=$(out)" ];
    145 
    146   doCheck = true;
    147 
    148   dontWrapGApps = true;
    149 
    150   postFixup = ''
    151     for f in $out/bin/ms2*; do
    152       wrapGApp $f
    153     done
    154   '';
    155 
    156   meta = {
    157     description = "A collection of tools and libraries for working with maps and geo-data";
    158     homepage = "http://slazav.github.io/mapsoft2";
    159     license = lib.licenses.gpl3;
    160     maintainers = [ lib.maintainers.sikmir ];
    161     platforms = lib.platforms.unix;
    162     skip.ci = true;
    163   };
    164 })