1 import ./make-test-python.nix ({ pkgs, lib, package, ... }:
3 qgisPackage = package.override { withServer = true; };
4 testScript = pkgs.writeTextFile {
6 text = (builtins.readFile ../../pkgs/applications/gis/qgis/test.py);
12 maintainers = with lib; [ teams.geospatial.members ];
16 machine = { config, pkgs, ... }:
19 qgisServerUser = config.services.nginx.user;
20 qgisServerSocket = "/run/qgis_mapserv.socket";
23 virtualisation.diskSize = 2 * 1024;
25 imports = [ ./common/x11.nix ];
26 environment.systemPackages = [
30 systemd.sockets.qgis-server = {
31 listenStreams = [ qgisServerSocket ];
34 SocketUser = qgisServerUser;
37 wantedBy = ["sockets.target" "qgis-server.service"];
38 before = [ "qgis-server.service" ];
41 systemd.services.qgis-server = {
42 description = "QGIS server";
44 User = qgisServerUser;
45 StandardOutput = "null";
46 StandardError = "journal";
47 StandardInput = "socket";
49 "QT_QPA_PLATFORM_PLUGIN_PATH=${pkgs.libsForQt5.qt5.qtbase}/${pkgs.libsForQt5.qt5.qtbase.qtPluginPrefix}/platforms"
50 "QGIS_SERVER_LOG_LEVEL=0"
51 "QGIS_SERVER_LOG_STDERR=1"
53 ExecStart = "${qgisPackage}/lib/cgi-bin/qgis_mapserv.fcgi";
55 after = [ "network.target" ];
56 wantedBy = [ "multi-user.target" ];
61 virtualHosts."qgis" = {
62 locations."~".extraConfig = ''
64 include ${pkgs.nginx}/conf/fastcgi_params;
65 include ${pkgs.nginx}/conf/fastcgi.conf;
66 fastcgi_pass unix:${qgisServerSocket};
77 machine.succeed("${qgisPackage}/bin/qgis --version | grep 'QGIS ${qgisPackage.version}'")
78 machine.succeed("${qgisPackage}/bin/qgis --code ${testScript}")
81 machine.succeed("${qgisPackage}/bin/qgis_mapserver --version | grep 'QGIS ${qgisPackage.version}'")
83 machine.succeed("curl --head http://localhost | grep 'Server:.*${qgisPackage.version}'")
84 machine.succeed("curl http://localhost/index.json | grep 'Landing page as JSON'")