nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 pkg-config,
6 gtk-doc,
7 nixosTests,
8 pkgsCross,
9 curl,
10 glib,
11 xz,
12 e2fsprogs,
13 libsoup_3,
14 gpgme,
15 which,
16 makeWrapper,
17 autoconf,
18 automake,
19 libtool,
20 fuse3,
21 util-linuxMinimal,
22 libselinux,
23 libsodium,
24 libarchive,
25 libcap,
26 bzip2,
27 bison,
28 libxslt,
29 docbook-xsl-nons,
30 docbook_xml_dtd_42,
31 python3,
32 buildPackages,
33 withComposefs ? false,
34 composefs,
35 withGjs ? lib.meta.availableOn stdenv.hostPlatform gjs,
36 gjs,
37 withIntrospection ?
38 lib.meta.availableOn stdenv.hostPlatform gobject-introspection
39 && stdenv.hostPlatform.emulatorAvailable buildPackages,
40 gobject-introspection,
41 withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
42 systemd,
43 replaceVars,
44 openssl,
45 ostree-full,
46}:
47
48let
49 testPython = python3.withPackages (
50 p: with p; [
51 pyyaml
52 ]
53 );
54in
55stdenv.mkDerivation (finalAttrs: {
56 pname = "ostree";
57 version = "2025.2";
58
59 outputs = [
60 "out"
61 "dev"
62 "man"
63 "installedTests"
64 ];
65
66 src = fetchurl {
67 url = "https://github.com/ostreedev/ostree/releases/download/v${finalAttrs.version}/libostree-${finalAttrs.version}.tar.xz";
68 hash = "sha256-8kSkCMkJmYp3jhJ/zCLBtQK00BPxXyaUj0fMcv/i7vQ=";
69 };
70
71 patches = [
72 # Workarounds for installed tests failing in pseudoterminal
73 # https://github.com/ostreedev/ostree/issues/1592
74 ./fix-1592.patch
75
76 # Hard-code paths in installed tests
77 (replaceVars ./fix-test-paths.patch {
78 python3 = testPython.interpreter;
79 openssl = "${openssl}/bin/openssl";
80 })
81 ];
82
83 nativeBuildInputs = [
84 autoconf
85 automake
86 libtool
87 pkg-config
88 glib
89 gtk-doc
90 which
91 makeWrapper
92 bison
93 libxslt
94 docbook-xsl-nons
95 docbook_xml_dtd_42
96 ]
97 ++ lib.optionals withIntrospection [
98 gobject-introspection
99 ];
100
101 buildInputs = [
102 curl
103 glib
104 e2fsprogs
105 libsoup_3 # for trivial-httpd for tests
106 gpgme
107 fuse3
108 libselinux
109 libsodium
110 libcap
111 libarchive
112 bzip2
113 xz
114 util-linuxMinimal # for libmount
115
116 # for installed tests
117 testPython
118 ]
119 ++ lib.optionals withComposefs [
120 (lib.getDev composefs)
121 ]
122 ++ lib.optionals withGjs [
123 gjs
124 ]
125 ++ lib.optionals withSystemd [
126 systemd
127 ];
128
129 enableParallelBuilding = true;
130
131 configureFlags = [
132 "--with-curl"
133 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
134 "--with-systemdsystemgeneratordir=${placeholder "out"}/lib/systemd/system-generators"
135 "--enable-installed-tests"
136 "--with-ed25519-libsodium"
137 ]
138 ++ lib.optionals withComposefs [
139 "--with-composefs"
140 ];
141
142 makeFlags = [
143 "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/libostree"
144 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/libostree"
145 # Setting this flag was required as workaround for a clang bug, but seems not relevant anymore.
146 # https://github.com/ostreedev/ostree/commit/fd8795f3874d623db7a82bec56904648fe2c1eb7
147 # See also Makefile-libostree.am
148 "INTROSPECTION_SCANNER_ENV="
149 ];
150
151 preConfigure = ''
152 env NOCONFIGURE=1 ./autogen.sh
153 '';
154
155 postFixup =
156 let
157 typelibPath = lib.makeSearchPath "/lib/girepository-1.0" [
158 (placeholder "out")
159 glib.out
160 ];
161 in
162 lib.optionalString withIntrospection ''
163 for test in $installedTests/libexec/installed-tests/libostree/*.js; do
164 wrapProgram "$test" --prefix GI_TYPELIB_PATH : "${typelibPath}"
165 done
166 '';
167
168 passthru = {
169 tests = {
170 musl = pkgsCross.musl64.ostree;
171 installedTests = nixosTests.installed-tests.ostree;
172 inherit ostree-full;
173 };
174 };
175
176 meta = with lib; {
177 description = "Git for operating system binaries";
178 homepage = "https://ostreedev.github.io/ostree/";
179 license = licenses.lgpl2Plus;
180 platforms = platforms.linux;
181 maintainers = [ ];
182 };
183})