Skip to content

Commit 4f0a68d

Browse files
committed
chore: nix fmt
1 parent a89bfe4 commit 4f0a68d

File tree

16 files changed

+299
-312
lines changed

16 files changed

+299
-312
lines changed

nix/ext/gdal.nix

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ stdenv.mkDerivation rec {
4747
zlib
4848
];
4949

50-
cmakeFlags =
51-
[
52-
"-DGDAL_USE_INTERNAL_LIBS=OFF"
53-
"-DGEOTIFF_INCLUDE_DIR=${lib.getDev libgeotiff}/include"
54-
"-DGEOTIFF_LIBRARY_RELEASE=${lib.getLib libgeotiff}/lib/libgeotiff${stdenv.hostPlatform.extensions.sharedLibrary}"
55-
"-DBUILD_PYTHON_BINDINGS=OFF"
56-
]
57-
++ lib.optionals (!stdenv.isDarwin) [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ]
58-
++ lib.optionals stdenv.isDarwin [ "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON" ];
50+
cmakeFlags = [
51+
"-DGDAL_USE_INTERNAL_LIBS=OFF"
52+
"-DGEOTIFF_INCLUDE_DIR=${lib.getDev libgeotiff}/include"
53+
"-DGEOTIFF_LIBRARY_RELEASE=${lib.getLib libgeotiff}/lib/libgeotiff${stdenv.hostPlatform.extensions.sharedLibrary}"
54+
"-DBUILD_PYTHON_BINDINGS=OFF"
55+
]
56+
++ lib.optionals (!stdenv.isDarwin) [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ]
57+
++ lib.optionals stdenv.isDarwin [ "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON" ];
5958

6059
enableParallelBuilding = true;
6160

nix/ext/pg_net.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ let
2323
buildInputs = [
2424
curl
2525
postgresql
26-
] ++ lib.optional (version == "0.6") libuv;
26+
]
27+
++ lib.optional (version == "0.6") libuv;
2728

2829
src = fetchFromGitHub {
2930
owner = "supabase";

nix/ext/pgaudit.nix

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,20 @@ buildEnv {
184184
echo "Found control version: $controlVer from package ${pkg}"
185185
186186
# Create migrations from control version to all supported versions on this PG major
187-
${
188-
lib.concatMapStringsSep "\n" (targetVer: ''
189-
# Skip if control version equals target version
190-
if [[ "$controlVer" != "${targetVer}" ]]; then
191-
# Skip if migration already exists
192-
if [[ ! -f "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" ]]; then
193-
# Create symlink to migration if target SQL exists
194-
if [[ -f "$out/share/postgresql/extension/${pname}--${targetVer}.sql" ]]; then
195-
echo "Creating migration symlink from control version $controlVer to ${targetVer}"
196-
ln -s "$out/share/postgresql/extension/${pname}--${targetVer}.sql" \
197-
"$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql"
198-
fi
187+
${lib.concatMapStringsSep "\n" (targetVer: ''
188+
# Skip if control version equals target version
189+
if [[ "$controlVer" != "${targetVer}" ]]; then
190+
# Skip if migration already exists
191+
if [[ ! -f "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" ]]; then
192+
# Create symlink to migration if target SQL exists
193+
if [[ -f "$out/share/postgresql/extension/${pname}--${targetVer}.sql" ]]; then
194+
echo "Creating migration symlink from control version $controlVer to ${targetVer}"
195+
ln -s "$out/share/postgresql/extension/${pname}--${targetVer}.sql" \
196+
"$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql"
199197
fi
200198
fi
201-
'') versions
202-
}
199+
fi
200+
'') versions}
203201
fi
204202
'') packages}
205203

nix/ext/pgroonga/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ let
6060
msgpack-c
6161
supabase-groonga
6262
mecab
63-
] ++ lib.optionals stdenv.isDarwin [ xxHash ];
63+
]
64+
++ lib.optionals stdenv.isDarwin [ xxHash ];
6465

6566
propagatedBuildInputs = [
6667
supabase-groonga

nix/ext/pgroonga/groonga.nix

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,20 @@ stdenv.mkDerivation (finalAttrs: {
3636
pkg-config
3737
makeWrapper
3838
];
39-
buildInputs =
40-
[
41-
rapidjson
42-
xxHash
43-
zstd
44-
mecab
45-
kytea
46-
msgpack-c
47-
]
48-
++ lib.optionals lz4Support [ lz4 ]
49-
++ lib.optional zlibSupport [ zlib ]
50-
++ lib.optionals suggestSupport [
51-
zeromq
52-
libevent
53-
];
39+
buildInputs = [
40+
rapidjson
41+
xxHash
42+
zstd
43+
mecab
44+
kytea
45+
msgpack-c
46+
]
47+
++ lib.optionals lz4Support [ lz4 ]
48+
++ lib.optional zlibSupport [ zlib ]
49+
++ lib.optionals suggestSupport [
50+
zeromq
51+
libevent
52+
];
5453
cmakeFlags = [
5554
"-DWITH_MECAB=ON"
5655
"-DMECAB_DICDIR=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic"

nix/ext/pgrouting/default.nix

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,15 @@ let
5858
stdenv.isDarwin && lib.versionAtLeast postgresql.version "16"
5959
) "-Wno-error=int-conversion -Wno-error=incompatible-pointer-types";
6060

61-
cmakeFlags =
62-
[
63-
"-DPOSTGRESQL_VERSION=${postgresql.version}"
64-
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
65-
]
66-
++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") [
67-
"-DCMAKE_MACOSX_RPATH=ON"
68-
"-DCMAKE_SHARED_MODULE_SUFFIX=.dylib"
69-
"-DCMAKE_SHARED_LIBRARY_SUFFIX=.dylib"
70-
];
61+
cmakeFlags = [
62+
"-DPOSTGRESQL_VERSION=${postgresql.version}"
63+
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
64+
]
65+
++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") [
66+
"-DCMAKE_MACOSX_RPATH=ON"
67+
"-DCMAKE_SHARED_MODULE_SUFFIX=.dylib"
68+
"-DCMAKE_SHARED_LIBRARY_SUFFIX=.dylib"
69+
];
7170

7271
preConfigure = lib.optionalString (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") ''
7372
export DLSUFFIX=.dylib

nix/ext/plv8/default.nix

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ let
5454
inherit hash;
5555
};
5656

57-
patches =
58-
[
59-
# Allow building with system v8.
60-
# https://github.com/plv8/plv8/pull/505 (rejected)
61-
./0001-build-Allow-using-V8-from-system-${version}.patch
62-
]
63-
++ lib.optionals (builtins.compareVersions "3.1.10" version >= 0) [
64-
# Apply https://github.com/plv8/plv8/pull/552/ patch to fix extension upgrade problems
65-
./0001-fix-upgrade-related-woes-with-GUC-redefinitions-${version}.patch
66-
];
57+
patches = [
58+
# Allow building with system v8.
59+
# https://github.com/plv8/plv8/pull/505 (rejected)
60+
./0001-build-Allow-using-V8-from-system-${version}.patch
61+
]
62+
++ lib.optionals (builtins.compareVersions "3.1.10" version >= 0) [
63+
# Apply https://github.com/plv8/plv8/pull/552/ patch to fix extension upgrade problems
64+
./0001-fix-upgrade-related-woes-with-GUC-redefinitions-${version}.patch
65+
];
6766

68-
nativeBuildInputs =
69-
[ perl ]
70-
++ lib.optionals stdenv.isDarwin [
71-
clang
72-
xcbuild
73-
];
67+
nativeBuildInputs = [
68+
perl
69+
]
70+
++ lib.optionals stdenv.isDarwin [
71+
clang
72+
xcbuild
73+
];
7474

7575
buildInputs = [
7676
(if (builtins.compareVersions "3.1.10" version >= 0) then v8 else nodejs_20.libv8)
@@ -79,19 +79,18 @@ let
7979

8080
buildFlags = [ "all" ];
8181

82-
makeFlags =
83-
[
84-
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
85-
"USE_SYSTEM_V8=1"
86-
"V8_OUTDIR=${v8}/lib"
87-
"PG_CONFIG=${postgresql}/bin/pg_config"
88-
]
89-
++ lib.optionals stdenv.isDarwin [
90-
"CC=${clang}/bin/clang"
91-
"CXX=${clang}/bin/clang++"
92-
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib -Wl,-headerpad_max_install_names"
93-
]
94-
++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ];
82+
makeFlags = [
83+
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
84+
"USE_SYSTEM_V8=1"
85+
"V8_OUTDIR=${v8}/lib"
86+
"PG_CONFIG=${postgresql}/bin/pg_config"
87+
]
88+
++ lib.optionals stdenv.isDarwin [
89+
"CC=${clang}/bin/clang"
90+
"CXX=${clang}/bin/clang++"
91+
"SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib -Wl,-headerpad_max_install_names"
92+
]
93+
++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ];
9594

9695
NIX_LDFLAGS = lib.optionals stdenv.isDarwin [
9796
"-L${postgresql}/lib"
@@ -142,11 +141,9 @@ let
142141
install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/$LIB_NAME
143142
''}
144143
145-
${
146-
lib.optionalString (!stdenv.isDarwin) ''
147-
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME
148-
''
149-
}
144+
${lib.optionalString (!stdenv.isDarwin) ''
145+
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME
146+
''}
150147
else
151148
${lib.optionalString stdenv.isDarwin ''
152149
install_name_tool -add_rpath "${v8}/lib" $out/lib/$LIB_NAME
@@ -155,11 +152,9 @@ let
155152
install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/$LIB_NAME
156153
''}
157154
158-
${
159-
lib.optionalString (!stdenv.isDarwin) ''
160-
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME
161-
''
162-
}
155+
${lib.optionalString (!stdenv.isDarwin) ''
156+
${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME
157+
''}
163158
fi
164159
165160
# plv8 3.2.x removed support for coffeejs and livescript

nix/ext/postgis.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ let
7979
protobufc
8080
pcre2.dev
8181
sfcgal
82-
] ++ lib.optional stdenv.isDarwin libiconv;
82+
]
83+
++ lib.optional stdenv.isDarwin libiconv;
8384
nativeBuildInputs = [
8485
perl
8586
pkg-config

nix/ext/tests/lib.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def assert_version_matches(self, expected_version: str):
9696
AssertionError: If the installed version does not match the expected version
9797
"""
9898
installed_version = self.get_installed_version()
99-
assert (
100-
installed_version == expected_version
101-
), f"Expected version {expected_version}, but found {installed_version}"
99+
assert installed_version == expected_version, (
100+
f"Expected version {expected_version}, but found {installed_version}"
101+
)
102102

103103
def check_upgrade_path(self, pg_version: str):
104104
"""Test the complete upgrade path for a PostgreSQL version.
@@ -166,27 +166,27 @@ def check_switch_extension_with_background_worker(
166166
f"No versions available for PostgreSQL version {pg_version}"
167167
)
168168
last_version = available_versions[-1]
169-
assert ext_version.endswith(
170-
f"{self.lib_name}-{last_version}.so"
171-
), f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
169+
assert ext_version.endswith(f"{self.lib_name}-{last_version}.so"), (
170+
f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
171+
)
172172

173173
# Switch to the first version
174174
first_version = available_versions[0]
175175
self.vm.succeed(f"switch_{self.extension_name}_version {first_version}")
176176

177177
# Check that we are using the first version now
178178
ext_version = self.vm.succeed(f"readlink -f {extension_lib_path}").strip()
179-
assert ext_version.endswith(
180-
f"{self.lib_name}-{first_version}.so"
181-
), f"Expected {self.extension_name} version {first_version}, but found {ext_version}"
179+
assert ext_version.endswith(f"{self.lib_name}-{first_version}.so"), (
180+
f"Expected {self.extension_name} version {first_version}, but found {ext_version}"
181+
)
182182

183183
# Switch to the last version
184184
self.vm.succeed(f"switch_{self.extension_name}_version {last_version}")
185185
# Check that we are using the last version now
186186
ext_version = self.vm.succeed(f"readlink -f {extension_lib_path}").strip()
187-
assert ext_version.endswith(
188-
f"{self.lib_name}-{last_version}.so"
189-
), f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
187+
assert ext_version.endswith(f"{self.lib_name}-{last_version}.so"), (
188+
f"Expected {self.extension_name} version {last_version}, but found {ext_version}"
189+
)
190190

191191
def check_pg_regress(self, pg_regress: Path, pg_version: str, test_name: str):
192192
"""Run pg_regress tests for the extension on a given PostgreSQL version.

nix/ext/tests/pgroonga.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ self.inputs.nixpkgs.lib.nixos.runTest {
8484
self.packages.${pkgs.system}.mecab-naist-jdic
8585
}/lib/mecab/dic/naist-jdic";
8686
systemd.services.postgresql.environment.MECAB_CONFIG = "${pkgs.mecab}/bin/mecab-config";
87-
systemd.services.postgresql.environment.GRN_PLUGINS_DIR = "${(installedExtension "15").passthru.groonga}/lib/groonga/plugins";
87+
systemd.services.postgresql.environment.GRN_PLUGINS_DIR =
88+
"${(installedExtension "15").passthru.groonga}/lib/groonga/plugins";
8889

8990
specialisation.postgresql17.configuration = {
9091
services.postgresql = {

0 commit comments

Comments
 (0)