-
-
Notifications
You must be signed in to change notification settings - Fork 313
/
flake.nix
66 lines (52 loc) · 1.96 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
description = "GRASS GIS";
nixConfig = {
extra-substituters = [ "https://osgeo-grass.cachix.org" ];
extra-trusted-public-keys = [ "osgeo-grass.cachix.org-1:rLnUl3u0ikSIudZ/oBfTqTL7mb3qwYmfmtuwexPpHjw=" ];
bash-prompt = "\\[\\033[1m\\][grass-dev]\\[\\033\[m\\]\\040\\w >\\040";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
packages.grass = pkgs.callPackage ./package.nix { };
devShells.default =
let
pyPackages = pkgs.python311Packages;
in
pkgs.mkShell {
inputsFrom = [ self'.packages.grass ];
# additional packages
buildInputs = with pyPackages; [
pytest
];
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
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 = { };
};
}