Skip to content

Add Nix package for PyQGIS API Documentation builder #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can either:

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

### Testing & development

Expand Down
234 changes: 234 additions & 0 deletions flake.lock

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

148 changes: 148 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
description = "PyQGIS API Documentation";

nixConfig = {
# extra-substituters = [ "https://example.cachix.org" ];
# extra-trusted-public-keys = [ "example.cachix.org-1:xxxx=" ];

# IFD is required for QGIS repo.
allow-import-from-derivation = true;
};

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
qgisMaster = {
url = "github:imincik/QGIS/nix-package-master";
};

# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
qgisLatest = {
url = "github:imincik/QGIS/nix-package-release-3_42";
};

# TODO: https://github.com/qgis/QGIS-Sysadmin-Documentation/issues/129
qgisLtr = {
url = "github:imincik/QGIS/nix-package-release-3_40";
};
};

outputs = inputs@{ self, nixpkgs, qgisMaster, qgisLatest, qgisLtr }:

let
# Flake system
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
config.allowUnfree = true;
});

in
{
#
### PACKAGES
#

packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};

in
{
docs-master = pkgs.callPackage ./package.nix {
qgis = inputs.qgisMaster.packages.${system}.qgis;
qgisRepo = qgisMaster;
qgisIsMasterVersion = true;
};

docs-latest = pkgs.callPackage ./package.nix {
qgis = inputs.qgisLatest.packages.${system}.qgis;
qgisRepo = qgisLatest;
};

docs-ltr = pkgs.callPackage ./package.nix {
qgis = inputs.qgisLtr.packages.${system}.qgis;
qgisRepo = qgisLtr;
};
});


#
### APPS
#

apps = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
inherit (nixpkgs) lib;

wwwLauncherMaster = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self.packages.${system}.docs-master}/
'';
};

wwwLauncherLatest = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self.packages.${system}.docs-latest}/
'';
};

wwwLauncherLtr = pkgs.writeShellApplication {
name = "website";
runtimeInputs = [ pkgs.python3 ];
text = ''
exec ${lib.getExe pkgs.python3} \
-m http.server 8000 \
-d ${self.packages.${system}.docs-ltr}/
'';
};

in
rec {
website-master = {
type = "app";
program = "${wwwLauncherMaster}/bin/website";
};

website-latest = {
type = "app";
program = "${wwwLauncherLatest}/bin/website";
};

website-ltr = {
type = "app";
program = "${wwwLauncherLtr}/bin/website";
};

default = website-master;
});


#
### SHELLS
#

devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};

in
{
# Development environment
default = pkgs.mkShell {
buildInputs = [ ];
};
});
};
}
Loading