nur-packages

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

default.nix (2078B)


      1 {
      2   lib,
      3   stdenv,
      4   cctools,
      5   fetchFromGitHub,
      6   fetchgit,
      7   gn,
      8   linkFarm,
      9   ninja,
     10   python3,
     11   removeReferencesTo,
     12   runCommand,
     13   rustPlatform,
     14 }:
     15 
     16 rustPlatform.buildRustPackage (finalAttrs: {
     17   pname = "cassini";
     18   version = "0.13.0";
     19 
     20   src = fetchFromGitHub {
     21     owner = "NicoRio42";
     22     repo = "cassini";
     23     tag = finalAttrs.version;
     24     hash = "sha256-up4JCejl+/0t/8F4tG1DaX3aNz6anD2kDb2aO5DdnIE=";
     25   };
     26 
     27   cargoHash = "sha256-JLHHkad0kXY5yFITGnB+g2RIGLnIJmx3cwPnt7idVM8=";
     28 
     29   nativeBuildInputs = [
     30     python3 # skia
     31     removeReferencesTo
     32   ]
     33   ++ lib.optionals stdenv.hostPlatform.isDarwin [
     34     cctools.libtool
     35   ];
     36 
     37   buildInputs = [
     38     rustPlatform.bindgenHook
     39   ];
     40 
     41   postFixup = ''
     42     # library skia embeds the path to its sources
     43     remove-references-to -t "$SKIA_SOURCE_DIR" \
     44       $out/bin/cassini
     45   '';
     46 
     47   env = {
     48     SKIA_SOURCE_DIR =
     49       let
     50         repo = fetchFromGitHub {
     51           owner = "rust-skia";
     52           repo = "skia";
     53           # see rust-skia:skia-bindings/Cargo.toml#package.metadata skia
     54           rev = "refs/tags/m126-0.74.2";
     55           hash = "sha256-4l6ekAJy+pG27hBGT6A6LLRwbsyKinJf6PP6mMHwaAs=";
     56         };
     57         # The externals for skia are taken from skia/DEPS
     58         # Reduced to only what's necessary
     59         externals = linkFarm "skia-externals" (
     60           lib.mapAttrsToList (name: value: {
     61             inherit name;
     62             path = fetchgit value;
     63           }) (lib.importJSON ./skia-externals.json)
     64         );
     65       in
     66       runCommand "source" { } ''
     67         cp -R ${repo} $out
     68         chmod -R +w $out
     69         ln -s ${externals} $out/third_party/externals
     70       '';
     71     SKIA_GN_COMMAND = lib.getExe gn;
     72     SKIA_NINJA_COMMAND = lib.getExe ninja;
     73   };
     74 
     75   disallowedReferences = [ finalAttrs.env.SKIA_SOURCE_DIR ];
     76 
     77   meta = {
     78     description = "A software that generates highly accurate topographic maps from LiDAR and Shapefile data";
     79     homepage = "https://cassini-map.com";
     80     license = lib.licenses.gpl3;
     81     maintainers = [ lib.maintainers.sikmir ];
     82     broken = stdenv.hostPlatform.isLinux;
     83   };
     84 })