summary refs log tree commit diff
path: root/pkgs/development/libraries/nco
diff options
context:
space:
mode:
authorTaylor Viti <tviti@hawaii.edu>2020-05-05 15:12:02 -1000
committerTaylor Viti <tviti@hawaii.edu>2020-05-05 15:22:12 -1000
commit5377640490d1c02cb06a555dd0f08ab2cdee6d89 (patch)
tree91b2e67e32a5fd2c8d7fffba84a5742dbf18c0de /pkgs/development/libraries/nco
parentfce7562cf46727fdaf801b232116bc9ce0512049 (diff)
downloadnixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar.gz
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar.bz2
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar.lz
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar.xz
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.tar.zst
nixpkgs-5377640490d1c02cb06a555dd0f08ab2cdee6d89.zip
nco: Patch hardcoded paths cp and mv
Commit b83ed3efe81525302469a3052982f41393a616e0 in the nco source
repo, hard-coded the paths to cp and mv, so as to point to their FHS
locations, which resulted in ncrename throwing a "file not found"
error when invoked outside of an FHS sandbox.

This nixpkgs commit patches the src/nco_fl_utl.c to instead point the
associated nixpkgs.coreutils locations. The hard-coded paths actually
occur in a number of other locations, but this is enough to quash the
error w/ ncrename (and presumably the other CLI nco tooling, although
this isn't tested).
Diffstat (limited to 'pkgs/development/libraries/nco')
-rw-r--r--pkgs/development/libraries/nco/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/development/libraries/nco/default.nix b/pkgs/development/libraries/nco/default.nix
index 321e4e0560d..629c064404b 100644
--- a/pkgs/development/libraries/nco/default.nix
+++ b/pkgs/development/libraries/nco/default.nix
@@ -1,17 +1,24 @@
-{ stdenv, fetchzip, netcdf, netcdfcxx4, gsl, udunits, antlr, which, curl, flex }:
+{ stdenv, fetchzip, netcdf, netcdfcxx4, gsl, udunits, antlr, which, curl, flex, coreutils }:
 
 stdenv.mkDerivation rec {
   version = "4.9.2";
   pname = "nco";
 
   nativeBuildInputs = [ flex which ];
-  buildInputs = [ netcdf netcdfcxx4 gsl udunits antlr curl ];
+  buildInputs = [ netcdf netcdfcxx4 gsl udunits antlr curl coreutils ];
 
   src = fetchzip {
     url = "https://github.com/nco/nco/archive/${version}.tar.gz";
     sha256 = "0nip9dmdx3d5nc30bz1d2w9his1dph136l53r160aa3bmb29xwqn";
   };
 
+  prePatch = ''
+    substituteInPlace src/nco/nco_fl_utl.c \
+      --replace "/bin/cp" "${coreutils}/bin/cp"
+    substituteInPlace src/nco/nco_fl_utl.c \
+      --replace "/bin/mv" "${coreutils}/bin/mv"
+  '';
+  
   meta = {
     description = "NetCDF Operator toolkit";
     longDescription = "The NCO (netCDF Operator) toolkit manipulates and analyzes data stored in netCDF-accessible formats, including DAP, HDF4, and HDF5";