Skip to content

Commit

Permalink
nix: pin python version to 3.11 (OSGeo#4017)
Browse files Browse the repository at this point in the history
* nix: pin python version to 3.11

* nix: update flake.lock file

* nix: use default wxpython version for package
  • Loading branch information
imincik authored Jul 10, 2024
1 parent 6ebeb4b commit 152f493
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 45 deletions.
20 changes: 10 additions & 10 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 36 additions & 31 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,42 @@

packages.grass = pkgs.callPackage ./package.nix { };

devShells.default = pkgs.mkShell {
inputsFrom = [ self'.packages.grass ];

# additional packages
buildInputs = with pkgs.python3Packages; [
pytest
];

shellHook = ''
function dev-help {
echo -e "\nWelcome to a GRASS development environment !"
echo "Build GRASS using following commands:"
echo
echo " 1. ./configure --prefix=\$(pwd)/app"
echo " 2. make -j$(nproc)"
echo " 3. make install"
echo
echo "Run tests:"
echo
echo " 1. export PYTHONPATH=\$(app/bin/grass --config python_path):\$PYTHONPATH"
echo " 2. export LD_LIBRARY_PATH=\$(app/bin/grass --config path)/lib:\$LD_LIBRARY_PATH"
echo " 3. pytest"
echo
echo "Note: run 'nix flake update' from time to time to update dependencies."
echo
echo "Run 'dev-help' to see this message again."
}
dev-help
'';
};
devShells.default =
let
pyPackages = pkgs.python311Packages;

in
pkgs.mkShell {
inputsFrom = [ self'.packages.grass ];

# additional packages
buildInputs = with pyPackages; [
pytest
];

shellHook = ''
function dev-help {
echo -e "\nWelcome to a GRASS development environment !"
echo "Build GRASS using following commands:"
echo
echo " 1. ./configure --prefix=\$(pwd)/app"
echo " 2. make -j$(nproc)"
echo " 3. make install"
echo
echo "Run tests:"
echo
echo " 1. export PYTHONPATH=\$(app/bin/grass --config python_path):\$PYTHONPATH"
echo " 2. export LD_LIBRARY_PATH=\$(app/bin/grass --config path)/lib:\$LD_LIBRARY_PATH"
echo " 3. pytest"
echo
echo "Note: run 'nix flake update' from time to time to update dependencies."
echo
echo "Run 'dev-help' to see this message again."
}
dev-help
'';
};
};

flake = { };
Expand Down
12 changes: 8 additions & 4 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@
, pkg-config
, postgresql
, proj
, python3Packages
, python311Packages
, readline
, sqlite
, wxGTK32
, zlib
, zstd

}:


let
pyPackages = python311Packages;

in
stdenv.mkDerivation (finalAttrs: {
pname = "grass";
version = "dev";
Expand All @@ -61,7 +65,7 @@ stdenv.mkDerivation (finalAttrs: {
geos # for `geos-config`
netcdf # for `nc-config`
pkg-config
] ++ (with python3Packages; [ python-dateutil numpy wxPython_4_2 ]);
] ++ (with pyPackages; [ python-dateutil numpy wxpython ]);

buildInputs = [
blas
Expand Down Expand Up @@ -137,7 +141,7 @@ stdenv.mkDerivation (finalAttrs: {
postInstall = ''
wrapProgram $out/bin/grass \
--set PYTHONPATH $PYTHONPATH \
--set GRASS_PYTHON ${python3Packages.python.interpreter} \
--set GRASS_PYTHON ${pyPackages.python.interpreter} \
--suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
ln -s $out/grass*/lib $out/lib
ln -s $out/grass*/include $out/include
Expand Down

0 comments on commit 152f493

Please sign in to comment.