nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# This file contains all runtime glue: Bindings to optional runtime dependencies
2# for pdfSupport, presentationSupport, and media playback.
3{ lib, mkDerivation, wrapGAppsHook, python3Packages
4
5# qt deps
6, qtbase, qtmultimedia
7
8# optional deps
9, pdfSupport ? false, mupdf # alternatively could use ghostscript
10, presentationSupport ? false, libreoffice-unwrapped
11, vlcSupport ? false
12, gstreamerSupport ? false, gst_all_1, gstPlugins ? (gst: [
13 gst.gst-plugins-base
14 gst.gst-plugins-good
15 gst.gst-plugins-bad
16 gst.gst-plugins-ugly
17 ])
18
19#, enableMySql ? false # Untested. If interested, contact maintainer.
20#, enablePostgreSql ? false # Untested. If interested, contact maintainer.
21#, enableJenkinsApi ? false # Untested. If interested, contact maintainer.
22}:
23
24let p = gstPlugins gst_all_1;
25# If gstreamer is activated but no plugins are given, it will at runtime
26# create the false illusion of being usable.
27in assert gstreamerSupport -> (builtins.isList p && builtins.length p > 0);
28
29let
30 # optional packages
31 libreofficePath = "${libreoffice-unwrapped}/lib/libreoffice/program";
32
33 # lib functions
34 inherit (lib.lists) optional optionals;
35 wrapSetVar = var: ''--set ${var} "''$${var}"'';
36
37 # base pkg/lib
38 baseLib = python3Packages.callPackage ./lib.nix { };
39in mkDerivation {
40 pname = baseLib.pname + lib.optionalString (pdfSupport && presentationSupport && vlcSupport && gstreamerSupport) "-full";
41 inherit (baseLib) version src;
42
43 nativeBuildInputs = [ python3Packages.wrapPython wrapGAppsHook ];
44 buildInputs = [ qtbase ] ++ optionals gstreamerSupport
45 ([ qtmultimedia.bin gst_all_1.gstreamer ] ++ gstPlugins gst_all_1);
46 propagatedBuildInputs = optional pdfSupport mupdf
47 ++ optional presentationSupport libreoffice-unwrapped;
48 pythonPath = [ baseLib ] ++ optional vlcSupport python3Packages.python-vlc;
49 # ++ optional enableMySql mysql-connector # Untested. If interested, contact maintainer.
50 # ++ optional enablePostgreSql psycopg2 # Untested. If interested, contact maintainer.
51 # ++ optional enableJenkinsApi jenkinsapi # Untested. If interested, contact maintainer.
52
53 PYTHONPATH = libreofficePath;
54 URE_BOOTSTRAP = "vnd.sun.star.pathname:${libreofficePath}/fundamentalrc";
55 UNO_PATH = libreofficePath;
56 LD_LIBRARY_PATH = libreofficePath;
57 JAVA_HOME = "${libreoffice-unwrapped.jdk.home}";
58
59 dontWrapQtApps = true;
60 dontWrapGApps = true;
61
62 # defined in gappsWrapperHook
63 wrapPrefixVariables = optionals presentationSupport
64 [ "PYTHONPATH" "LD_LIBRARY_PATH" "JAVA_HOME" ];
65 makeWrapperArgs = [
66 "\${gappsWrapperArgs[@]}"
67 "\${qtWrapperArgs[@]}"
68 ] ++ optionals presentationSupport
69 ([ "--prefix PATH : ${libreoffice-unwrapped}/bin" ]
70 ++ map wrapSetVar [ "URE_BOOTSTRAP" "UNO_PATH" ]);
71
72 installPhase = ''
73 install -D openlp.py $out/bin/openlp
74 '';
75
76 preFixup = ''
77 wrapPythonPrograms
78 '';
79
80 meta = baseLib.meta // {
81 hydraPlatforms = [ ]; # this is only the wrapper; baseLib gets built
82 };
83
84 passthru = {
85 inherit baseLib;
86 };
87}