mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
qgis: add server support
This commit is contained in:
parent
b143f151ab
commit
9067c29c9a
@ -845,8 +845,8 @@ in {
|
||||
qemu-vm-volatile-root = runTest ./qemu-vm-volatile-root.nix;
|
||||
qemu-vm-external-disk-image = runTest ./qemu-vm-external-disk-image.nix;
|
||||
qemu-vm-store = runTest ./qemu-vm-store.nix;
|
||||
qgis = handleTest ./qgis.nix { qgisPackage = pkgs.qgis; };
|
||||
qgis-ltr = handleTest ./qgis.nix { qgisPackage = pkgs.qgis-ltr; };
|
||||
qgis = handleTest ./qgis.nix { package = pkgs.qgis; };
|
||||
qgis-ltr = handleTest ./qgis.nix { package = pkgs.qgis-ltr; };
|
||||
qownnotes = handleTest ./qownnotes.nix {};
|
||||
qtile = handleTestOn ["x86_64-linux" "aarch64-linux"] ./qtile/default.nix {};
|
||||
quake3 = handleTest ./quake3.nix {};
|
||||
|
@ -1,5 +1,6 @@
|
||||
import ./make-test-python.nix ({ pkgs, lib, qgisPackage, ... }:
|
||||
import ./make-test-python.nix ({ pkgs, lib, package, ... }:
|
||||
let
|
||||
qgisPackage = package.override { withServer = true; };
|
||||
testScript = pkgs.writeTextFile {
|
||||
name = "qgis-test.py";
|
||||
text = (builtins.readFile ../../pkgs/applications/gis/qgis/test.py);
|
||||
@ -12,19 +13,74 @@ import ./make-test-python.nix ({ pkgs, lib, qgisPackage, ... }:
|
||||
};
|
||||
|
||||
nodes = {
|
||||
machine = { pkgs, ... }: {
|
||||
machine = { config, pkgs, ... }:
|
||||
|
||||
let
|
||||
qgisServerUser = config.services.nginx.user;
|
||||
qgisServerSocket = "/run/qgis_mapserv.socket";
|
||||
in
|
||||
{
|
||||
virtualisation.diskSize = 2 * 1024;
|
||||
|
||||
imports = [ ./common/x11.nix ];
|
||||
environment.systemPackages = [ qgisPackage ];
|
||||
environment.systemPackages = [
|
||||
qgisPackage
|
||||
];
|
||||
|
||||
systemd.sockets.qgis-server = {
|
||||
listenStreams = [ qgisServerSocket ];
|
||||
socketConfig = {
|
||||
Accept = false;
|
||||
SocketUser = qgisServerUser;
|
||||
SocketMode = 0600;
|
||||
};
|
||||
wantedBy = ["sockets.target" "qgis-server.service"];
|
||||
before = [ "qgis-server.service" ];
|
||||
};
|
||||
|
||||
systemd.services.qgis-server = {
|
||||
description = "QGIS server";
|
||||
serviceConfig = {
|
||||
User = qgisServerUser;
|
||||
StandardOutput = "null";
|
||||
StandardError = "journal";
|
||||
StandardInput = "socket";
|
||||
Environment = [
|
||||
"QT_QPA_PLATFORM_PLUGIN_PATH=${pkgs.libsForQt5.qt5.qtbase}/${pkgs.libsForQt5.qt5.qtbase.qtPluginPrefix}/platforms"
|
||||
"QGIS_SERVER_LOG_LEVEL=0"
|
||||
"QGIS_SERVER_LOG_STDERR=1"
|
||||
];
|
||||
ExecStart = "${qgisPackage}/lib/cgi-bin/qgis_mapserv.fcgi";
|
||||
};
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."qgis" = {
|
||||
locations."~".extraConfig = ''
|
||||
gzip off;
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
fastcgi_pass unix:${qgisServerSocket};
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
# test desktop
|
||||
machine.succeed("${qgisPackage}/bin/qgis --version | grep 'QGIS ${qgisPackage.version}'")
|
||||
machine.succeed("${qgisPackage}/bin/qgis --code ${testScript}")
|
||||
|
||||
# test server
|
||||
machine.succeed("${qgisPackage}/bin/qgis_mapserver --version | grep 'QGIS ${qgisPackage.version}'")
|
||||
|
||||
machine.succeed("curl --head http://localhost | grep 'Server:.*${qgisPackage.version}'")
|
||||
machine.succeed("curl http://localhost/index.json | grep 'Landing page as JSON'")
|
||||
'';
|
||||
})
|
||||
|
@ -8,11 +8,13 @@
|
||||
|
||||
# unwrapped package parameters
|
||||
, withGrass ? false
|
||||
, withServer ? false
|
||||
, withWebKit ? false
|
||||
}:
|
||||
let
|
||||
qgis-unwrapped = libsForQt5.callPackage ./unwrapped.nix {
|
||||
withGrass = withGrass;
|
||||
withServer = withServer;
|
||||
withWebKit = withWebKit;
|
||||
};
|
||||
in symlinkJoin rec {
|
||||
|
@ -8,11 +8,13 @@
|
||||
|
||||
# unwrapped package parameters
|
||||
, withGrass ? false
|
||||
, withServer ? false
|
||||
, withWebKit ? false
|
||||
}:
|
||||
let
|
||||
qgis-ltr-unwrapped = libsForQt5.callPackage ./unwrapped-ltr.nix {
|
||||
withGrass = withGrass;
|
||||
withServer = withServer;
|
||||
withWebKit = withWebKit;
|
||||
};
|
||||
in symlinkJoin rec {
|
||||
|
@ -7,6 +7,7 @@
|
||||
, wrapQtAppsHook
|
||||
|
||||
, withGrass
|
||||
, withServer
|
||||
, withWebKit
|
||||
|
||||
, bison
|
||||
@ -155,7 +156,10 @@ in mkDerivation rec {
|
||||
"-DWITH_PDAL=True"
|
||||
"-DENABLE_TESTS=False"
|
||||
] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
|
||||
++ lib.optional withGrass (let
|
||||
++ lib.optional withServer [
|
||||
"-DWITH_SERVER=True"
|
||||
"-DQGIS_CGIBIN_SUBDIR=${placeholder "out"}/lib/cgi-bin"
|
||||
] ++ lib.optional withGrass (let
|
||||
gmajor = lib.versions.major grass.version;
|
||||
gminor = lib.versions.minor grass.version;
|
||||
in "-DGRASS_PREFIX${gmajor}=${grass}/grass${gmajor}${gminor}"
|
||||
|
@ -7,6 +7,7 @@
|
||||
, wrapQtAppsHook
|
||||
|
||||
, withGrass
|
||||
, withServer
|
||||
, withWebKit
|
||||
|
||||
, bison
|
||||
@ -157,7 +158,10 @@ in mkDerivation rec {
|
||||
"-DENABLE_TESTS=False"
|
||||
"-DQT_PLUGINS_DIR=${qtbase}/${qtbase.qtPluginPrefix}"
|
||||
] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
|
||||
++ lib.optional withGrass (let
|
||||
++ lib.optional withServer [
|
||||
"-DWITH_SERVER=True"
|
||||
"-DQGIS_CGIBIN_SUBDIR=${placeholder "out"}/lib/cgi-bin"
|
||||
] ++ lib.optional withGrass (let
|
||||
gmajor = lib.versions.major grass.version;
|
||||
gminor = lib.versions.minor grass.version;
|
||||
in "-DGRASS_PREFIX${gmajor}=${grass}/grass${gmajor}${gminor}"
|
||||
|
Loading…
Reference in New Issue
Block a user