-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
141 lines (127 loc) · 4.55 KB
/
flake.nix
File metadata and controls
141 lines (127 loc) · 4.55 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
description = "QGIS";
nixConfig = {
# extra-substituters = [ "https://example.cachix.org" ];
# extra-trusted-public-keys = [ "example.cachix.org-1:xxxx=" ];
bash-prompt = "\\[\\033[1m\\][qgis-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"
"aarch64-linux"
"aarch64-darwin"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
(final: prev: {
# Build with libspatialindex 2.0.0
# https://github.com/qgis/QGIS/pull/63196
libspatialindex = prev.libspatialindex.overrideAttrs (prev: rec {
version = "2.0.0";
src = final.fetchFromGitHub {
owner = "libspatialindex";
repo = "libspatialindex";
rev = "refs/tags/${version}";
hash = "sha256-hZyAXz1ddRStjZeqDf4lYkV/g0JLqLy7+GrSUh75k20=";
};
}); # end of libspatialindex
})
];
config = { };
};
packages = rec {
qgis = pkgs.qt6Packages.callPackage ./nix/package.nix { };
docs = pkgs.qt6Packages.callPackage ./nix/documentation.nix {
qgisMinorVersion = "master";
};
default = qgis;
};
apps = {
docs =
let
wwwLauncher = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${pkgs.lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self'.packages.docs}
'';
};
in
{
type = "app";
program = "${wwwLauncher}/bin/website";
meta.description = "QGIS documentation";
};
};
devShells.default =
let
nixPatches = pkgs.lib.concatStringsSep " " self'.packages.qgis.passthru.unwrapped.patches;
in
pkgs.mkShell {
inputsFrom = [
self'.packages.qgis
self'.packages.qgis.passthru.unwrapped
];
shellHook = ''
echo "Applying Nix patches ..."
for p in ${nixPatches}; do
echo "patch: $p"
patch --reverse --reject-file - --strip 1 < $p &> /dev/null || true
patch --strip 1 < $p
done
export QT_PLUGIN_PATH="${pkgs.qt6Packages.qtbase}/${pkgs.qt6Packages.qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM_PLUGIN_PATH="${pkgs.qt6Packages.qtbase}/${pkgs.qt6Packages.qtbase.qtPluginPrefix}/platforms"
# TODO: take inspiration from
# https://github.com/qgis/QGIS/blob/798f63fc3c0d2616a5fbc8f47139fbeb5db7c052/.docker/docker-qgis-build.sh#L79
function dev-help {
echo -e "\nWelcome to the QGIS development environment !"
echo "Build QGIS using following commands:"
echo
echo " 1. mkdir build && cd build"
echo " 2. cmake \
-G Ninja \
-D CMAKE_BUILD_TYPE=Debug \
-D WITH_3D=True \
-D WITH_PDAL=True \
-D WITH_QTWEBENGINE=True \
-D CMAKE_INSTALL_PREFIX=\$(pwd)/app \
-D QT_PLUGINS_DIR=${pkgs.qt6Packages.qtbase}/${pkgs.qt6Packages.qtbase.qtPluginPrefix} .."
echo " 3. ninja"
echo " 4. ninja install"
echo
echo "Run tests:"
echo
echo "1. ninja test"
echo
echo "Note: run 'nix flake update' to update dependencies."
echo
echo "Run 'dev-help' to see this message again."
}
dev-help
'';
};
checks = {
inherit (config.packages) qgis docs;
};
};
flake = { };
};
}