python3Packages.pyproj: change data dir priorities#282139
python3Packages.pyproj: change data dir priorities#282139kidanger wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
What about setting multiple paths like this |
The issue is that the env variable is not even considered by pyproj, since it priorities For a non-nix build of pyproj, the folder referenced by |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/week-in-geospatial-team/37035/6 |
|
Do you think this could be proposed upstream? It seems reasonable to me that the env variable always takes precedence. |
Yes, I agree. |
|
Good idea, I have opened an issue upstream to see if they agree. |
|
According to the maintainer, I guess one can always override the pyproj derivation to achieve ones goal (like bundling different datum grids), and don't play with Otherwise, maybe instead of swapping the priorities as I initially proposed in this PR, we can question whether the current patch in nixpkgs is ok or not. Maybe instead of hard-setting the In any case, I don't know if all this is useful for anyone else, it might just be a misunderstanding of pyproj on my part. If that's the case we can close the PR. |
|
I've skimmed very quickly the conversation, and I think there's a misunderstanding. We are talking from a packager POV and snowman2 is thinking about an end-user using the library. |
unless I'm the one misunderstanding it, and you really wanted a different proj dir when using this package? |
Yes, here is an example of what I used when packaging an application to docker: (might be outdated) proj_data = pkgs.stdenv.mkDerivation {
name = "proj_data";
dontUnpack = true;
installPhase = ''
mkdir $out
cp ${pkgs.fetchurl {
url = "https://github.com/OSGeo/PROJ-data/raw/a810a6d00ef4e16186e5db9abebb05ca14f2155d/us_nga/us_nga_egm96_15.tif";
hash = "sha256-20kwJ1YsmwBNciD6iB9WA62tpOHFApuTP6feRUew540=";
}} $out/us_nga_egm96_15.tif
cp -ra ${pkgs.proj}/share/proj/* $out
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-wIwdjOz80BHv0I0E83szpIcgzkw6stVMPOSkTBnaACc=";
};And adding But it's a bit too complex and there might be a simpler way. |
|
Ah, you actually want to embed only a subset of projdata in a docker image, am I right? I guess it's for saving space? In this case, I think we should probably package proj-data, because we don't currently (or I didn't find it), and that's a shame. Then, this derivation would be an arg to proj derivation, probably behind a Then, you could use your derivation with In short, I think that what's missing from the packaging standpoint is actually an argument in the proj derivation. Would that fix your issue? |
Yes, I want to add some data to the default
Indeed, it would solve the issue quite cleanly. |
proj-data PR is here - #290643 . |
Description of changes
Because the
${pkgs.proj}/share/projfolder always exist, the user cannot override the data dir with the environment variablePROJ_DATAas usually possible with proj and pyproj. This PR changes the priority, to first check the environment variable before falling back to proj's folder.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.