1{ lib, stdenv
2, fetchurl
3, substituteAll
4, nixosTests
5
6, autoreconfHook
7, docbook_xml_dtd_412
8, docbook_xml_dtd_42
9, docbook_xml_dtd_43
10, docbook_xsl
11, gettext
12, libxml2
13, libxslt
14, pkg-config
15, xmlto
16
17, acl
18, breezy
19, binutils
20, bzip2
21, coreutils
22, cpio
23, curl
24, debugedit
25, elfutils
26, flatpak
27, gitMinimal
28, glib
29, glibcLocales
30, gnumake
31, gnupg
32, gnutar
33, json-glib
34, libcap
35, libsoup
36, libyaml
37, ostree
38, patch
39, python2
40, rpm
41, unzip
42}:
43
44let
45 installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder";
46 installed_test_metadir = "${placeholder "installedTests"}/share/installed-tests/flatpak-builder";
47in stdenv.mkDerivation rec {
48 pname = "flatpak-builder";
49 version = "1.2.3";
50
51 outputs = [ "out" "doc" "man" "installedTests" ];
52
53 src = fetchurl {
54 url = "https://github.com/flatpak/flatpak-builder/releases/download/${version}/${pname}-${version}.tar.xz";
55 sha256 = "sha256-4leCWkf3o+ceMPsPgPLZrG5IAfdG9VLfrw5WTj7jUcg=";
56 };
57
58 patches = [
59 # patch taken from gtk_doc
60 ./respect-xml-catalog-files-var.patch
61
62 # Hardcode paths
63 (substituteAll {
64 src = ./fix-paths.patch;
65 brz = "${breezy}/bin/brz";
66 cp = "${coreutils}/bin/cp";
67 patch = "${patch}/bin/patch";
68 tar = "${gnutar}/bin/tar";
69 unzip = "${unzip}/bin/unzip";
70 rpm2cpio = "${rpm}/bin/rpm2cpio";
71 cpio = "${cpio}/bin/cpio";
72 git = "${gitMinimal}/bin/git";
73 rofilesfuse = "${ostree}/bin/rofiles-fuse";
74 strip = "${binutils}/bin/strip";
75 eustrip = "${elfutils}/bin/eu-strip";
76 euelfcompress = "${elfutils}/bin/eu-elfcompress";
77 })
78
79 # The test scripts in Flatpak repo were updated so we are basing
80 # this on our patch for Flatpak 0.99.
81 (substituteAll {
82 src = ./fix-test-paths.patch;
83 inherit glibcLocales;
84 # FIXME use python3 for tests that rely on python2
85 # inherit python2;
86 })
87 ];
88
89 nativeBuildInputs = [
90 autoreconfHook
91 docbook_xml_dtd_43
92 docbook_xsl
93 gettext
94 libxml2
95 libxslt
96 pkg-config
97 xmlto
98 ];
99
100 buildInputs = [
101 acl
102 bzip2
103 curl
104 debugedit
105 elfutils
106 flatpak
107 glib
108 json-glib
109 libcap
110 libsoup
111 libxml2
112 libyaml
113 ostree
114 ];
115
116 configureFlags = [
117 "--enable-installed-tests"
118 "--with-system-debugedit"
119 ];
120
121 makeFlags = [
122 "installed_testdir=${installed_testdir}"
123 "installed_test_metadir=${installed_test_metadir}"
124 ];
125
126 # Some scripts used by tests need to use shebangs that are available in Flatpak runtimes.
127 dontPatchShebangs = true;
128
129 enableParallelBuilding = true;
130
131 # Installed tests
132 postFixup = ''
133 for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh}; do
134 patchShebangs $file
135 done
136 '';
137
138 passthru = {
139 installedTestsDependencies = [
140 gnupg
141 ostree
142 # FIXME python2
143 gnumake
144 ];
145
146 tests = {
147 installedTests = nixosTests.installed-tests.flatpak-builder;
148 };
149 };
150
151 meta = with lib; {
152 description = "Tool to build flatpaks from source";
153 homepage = "https://github.com/flatpak/flatpak-builder";
154 license = licenses.lgpl21Plus;
155 maintainers = with maintainers; [ ];
156 platforms = platforms.linux;
157 };
158}