Skip to content

Commit 535ea32

Browse files
committed
Add Nix package for PyQGIS API Documentation builder
1 parent c81f710 commit 535ea32

File tree

4 files changed

+472
-1
lines changed

4 files changed

+472
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ You can either:
2525

2626
* export the PYTHONPATH yourself
2727
* export your QGIS build directory with ``export QGIS_BUILD_DIR=~/dev/QGIS/build``
28-
* or provide QGIS build directory as argument to the script: ``./build-docs.sh -qgis-build-dir ~/dev/QGIS/build``
28+
* or provide QGIS build directory as argument to the script: ``./scripts/build-docs.sh -qgis-build-dir ~/dev/QGIS/build``
2929

3030
### Testing & development
3131

flake.lock

+234
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
description = "PyQGIS API Documentation";
3+
4+
nixConfig = {
5+
# extra-substituters = [ "https://example.cachix.org" ];
6+
# extra-trusted-public-keys = [ "example.cachix.org-1:xxxx=" ];
7+
8+
# IFD is required for QGIS repo.
9+
allow-import-from-derivation = true;
10+
};
11+
12+
inputs = {
13+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
14+
15+
# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
16+
qgisMaster = {
17+
url = "github:imincik/QGIS/nix-package-master";
18+
};
19+
20+
# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
21+
qgisLatest = {
22+
url = "github:imincik/QGIS/nix-package-release-3_42";
23+
};
24+
25+
# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
26+
qgisLtr = {
27+
url = "github:imincik/QGIS/nix-package-release-3_40";
28+
};
29+
};
30+
31+
outputs = inputs@{ self, nixpkgs, qgisMaster, qgisLatest, qgisLtr }:
32+
33+
let
34+
# Flake system
35+
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
36+
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
37+
nixpkgsFor = forAllSystems (system: import nixpkgs {
38+
inherit system;
39+
config.allowUnfree = true;
40+
});
41+
42+
in
43+
{
44+
#
45+
### PACKAGES
46+
#
47+
48+
packages = forAllSystems (system:
49+
let
50+
pkgs = nixpkgsFor.${system};
51+
52+
in
53+
{
54+
docs-master = pkgs.callPackage ./package.nix {
55+
qgis = inputs.qgisMaster.packages.${system}.qgis;
56+
qgisRepo = qgisMaster;
57+
qgisIsMasterVersion = true;
58+
};
59+
60+
docs-latest = pkgs.callPackage ./package.nix {
61+
qgis = inputs.qgisLatest.packages.${system}.qgis;
62+
qgisRepo = qgisLatest;
63+
};
64+
65+
docs-ltr = pkgs.callPackage ./package.nix {
66+
qgis = inputs.qgisLtr.packages.${system}.qgis;
67+
qgisRepo = qgisLtr;
68+
};
69+
});
70+
71+
72+
#
73+
### APPS
74+
#
75+
76+
apps = forAllSystems (system:
77+
let
78+
pkgs = nixpkgsFor.${system};
79+
inherit (nixpkgs) lib;
80+
81+
wwwLauncherMaster = pkgs.writeShellApplication {
82+
name = "website";
83+
runtimeInputs = [ pkgs.python3 ];
84+
text = ''
85+
exec ${lib.getExe pkgs.python3} \
86+
-m http.server 8000 \
87+
-d ${self.packages.${system}.docs-master}/
88+
'';
89+
};
90+
91+
wwwLauncherLatest = pkgs.writeShellApplication {
92+
name = "website";
93+
runtimeInputs = [ pkgs.python3 ];
94+
text = ''
95+
exec ${lib.getExe pkgs.python3} \
96+
-m http.server 8000 \
97+
-d ${self.packages.${system}.docs-latest}/
98+
'';
99+
};
100+
101+
wwwLauncherLtr = pkgs.writeShellApplication {
102+
name = "website";
103+
runtimeInputs = [ pkgs.python3 ];
104+
text = ''
105+
exec ${lib.getExe pkgs.python3} \
106+
-m http.server 8000 \
107+
-d ${self.packages.${system}.docs-ltr}/
108+
'';
109+
};
110+
111+
in
112+
rec {
113+
website-master = {
114+
type = "app";
115+
program = "${wwwLauncherMaster}/bin/website";
116+
};
117+
118+
website-latest = {
119+
type = "app";
120+
program = "${wwwLauncherLatest}/bin/website";
121+
};
122+
123+
website-ltr = {
124+
type = "app";
125+
program = "${wwwLauncherLtr}/bin/website";
126+
};
127+
128+
default = website-master;
129+
});
130+
131+
132+
#
133+
### SHELLS
134+
#
135+
136+
devShells = forAllSystems (system:
137+
let
138+
pkgs = nixpkgsFor.${system};
139+
140+
in
141+
{
142+
# Development environment
143+
default = pkgs.mkShell {
144+
buildInputs = [ ];
145+
};
146+
});
147+
};
148+
}

0 commit comments

Comments
 (0)