nur-packages

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

package.nix (1746B)


      1 {
      2   lib,
      3   stdenv,
      4   fetchFromGitHub,
      5   makeWrapper,
      6   python3Packages,
      7 }:
      8 
      9 stdenv.mkDerivation (finalAttrs: {
     10   pname = "mountains";
     11   version = "0-unstable-2025-10-16";
     12 
     13   __structuredAttrs = true;
     14 
     15   src = fetchFromGitHub {
     16     owner = "akirmse";
     17     repo = "mountains";
     18     rev = "f58bc6205ea2e6fc94e8185f8cc1a6cb442f33c5";
     19     hash = "sha256-WRL9pwzSb4NLAzweQJ4dcReEofRuGnMIV8W/cyOpga0=";
     20   };
     21 
     22   sourceRoot = "${finalAttrs.src.name}/code";
     23 
     24   postPatch = ''
     25     substituteInPlace Makefile \
     26       --replace-fail "ar -r" "${stdenv.cc.targetPrefix}ar -r"
     27     substituteInPlace ../scripts/run_prominence.py \
     28       --replace-fail "'--binary_dir', default='release'" "'--binary_dir', default='$out/bin'"
     29   '';
     30 
     31   nativeBuildInputs = [ makeWrapper ];
     32 
     33   makeFlags = [
     34     "CC:=$(CC)"
     35     "LINK=$(CXX)"
     36   ];
     37 
     38   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=stringop-overflow";
     39 
     40   installPhase =
     41     let
     42       pythonEnv = python3Packages.python.withPackages (
     43         p: with p; [
     44           gdal
     45         ]
     46       );
     47     in
     48     ''
     49       install -Dm755 release/{isolation,prominence,merge_divide_trees,filter_points,compute_parents} -t $out/bin
     50 
     51       site_packages=$out/lib/${python3Packages.python.libPrefix}/site-packages
     52       mkdir -p $site_packages
     53       cp ../scripts/*.py $site_packages
     54 
     55       makeWrapper ${pythonEnv.interpreter} $out/bin/run_prominence \
     56         --add-flags "$site_packages/run_prominence.py"
     57     '';
     58 
     59   meta = {
     60     description = "Code to compute the prominence and isolation of mountains from digital elevation data";
     61     homepage = "https://github.com/akirmse/mountains";
     62     license = lib.licenses.mit;
     63     maintainers = [ lib.maintainers.sikmir ];
     64     platforms = lib.platforms.unix;
     65   };
     66 })