Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
aws-region: "us-east-1"
output-credentials: true
role-duration-seconds: 7200
- name: write secret key
# use python so we don't interpolate the secret into the workflow logs, in case of bugs
run: |
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 32 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,42 @@
#This variable works the same as 'oriole_pkgs' but builds using the upstream
#nixpkgs builds of postgresql 15 and 16 + the overlays listed below
pkgs = import nixpkgs {
config = { allowUnfree = true; };
config = {
allowUnfree = true;
permittedInsecurePackages = [
"v8-9.7.106.18"
];
};
inherit system;
overlays = [
# NOTE (aseipp): add any needed overlays here. in theory we could
# pull them from the overlays/ directory automatically, but we don't
# want to have an arbitrary order, since it might matter. being
# explicit is better.

(final: prev: {
libxml2 = final.callPackage ./nix/libxml2.nix { };
postgresql = final.callPackage ./nix/postgresql/default.nix {
inherit (final) lib;
inherit (final) stdenv;
inherit (final) fetchurl;
inherit (final) makeWrapper;
inherit (final) callPackage;
inherit (final) libxml2;
};
})
(import ./nix/overlays/cargo-pgrx-0-11-3.nix)
# (import ./nix/overlays/postgis.nix)
#(import ./nix/overlays/gdal-small.nix)

];
};


postgresql_15 = pkgs.postgresql.postgresql_15;
postgresql_16 = pkgs.postgresql.postgresql_16;
postgresql = pkgs.postgresql.postgresql_15;
sfcgal = pkgs.callPackage ./nix/ext/sfcgal/sfcgal.nix { };
pg_regress = pkgs.callPackage ./nix/ext/pg_regress.nix { };
pg_regress = pkgs.callPackage ./nix/ext/pg_regress.nix { inherit postgresql; };

# Our list of PostgreSQL extensions which come from upstream Nixpkgs.
# These are maintained upstream and can easily be used here just by
Expand Down Expand Up @@ -128,7 +148,12 @@
#this var is a convenience setting to import the orioledb patched version of postgresql
postgresql_orioledb_16 = oriole_pkgs.postgresql_orioledb_16;
#postgis_override = pkgs.postgis_override;
# Function to map PostgreSQL versions
getPostgresqlPackage = version:
pkgs.postgresql."postgresql_${version}";

# List of supported PostgreSQL versions
supportedVersions = [ "15" "16" ];
# Create a 'receipt' file for a given postgresql package. This is a way
# of adding a bit of metadata to the package, which can be used by other
# tools to inspect what the contents of the install are: the PSQL
Expand Down Expand Up @@ -170,7 +195,7 @@
in map (path: pkgs.callPackage path { inherit postgresql; }) orioledbExtension;

makeOurPostgresPkgs = version:
let postgresql = pkgs."postgresql_${version}";
let postgresql = getPostgresqlPackage version;
in map (path: pkgs.callPackage path { inherit postgresql; }) ourExtensions;

# Create an attrset that contains all the extensions included in a server for the orioledb version of postgresql + extension.
Expand Down Expand Up @@ -202,7 +227,7 @@
# basis for building extensions, etc.
makePostgresBin = version:
let
postgresql = pkgs."postgresql_${version}";
postgresql = getPostgresqlPackage version;
upstreamExts = map
(ext: {
name = postgresql.pkgs."${ext}".pname;
Expand Down Expand Up @@ -273,6 +298,7 @@
sfcgal = sfcgal;
pg_regress = pg_regress;
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
postgresql_15 = postgresql_15;
# Start a version of the server.
start-server =
let
Expand Down Expand Up @@ -493,6 +519,7 @@
# NOTE: comes from our cargo-pgrx-0-11-3.nix overlay
cargo-pgrx_0_11_3;


};

# The list of exported 'checks' that are run with every run of 'nix
Expand Down
1 change: 1 addition & 0 deletions nix/ext/pg_graphql.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ buildPgrxExtension_0_11_3 rec {
env = lib.optionalAttrs stdenv.isDarwin {
POSTGRES_LIB = "${postgresql}/lib";
RUSTFLAGS = "-C link-arg=-undefined -C link-arg=dynamic_lookup";
PGPORT = "5434";
};
cargoHash = "sha256-WkHufMw8OvinMRYd06ZJACnVvY9OLi069nCgq3LSmMY=";

Expand Down
1 change: 1 addition & 0 deletions nix/ext/pg_jsonschema.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ buildPgrxExtension_0_11_3 rec {
env = lib.optionalAttrs stdenv.isDarwin {
POSTGRES_LIB = "${postgresql}/lib";
RUSTFLAGS = "-C link-arg=-undefined -C link-arg=dynamic_lookup";
PGPORT = "5433";
};
cargoHash = "sha256-VcS+efMDppofuFW2zNrhhsbC28By3lYekDFquHPta2g=";

Expand Down
2 changes: 1 addition & 1 deletion nix/ext/pg_regress.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ stdenv.mkDerivation {
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}
}
4 changes: 1 addition & 3 deletions nix/ext/plv8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ stdenv.mkDerivation (finalAttrs: {
];

buildInputs = [
(v8.overrideAttrs (oldAttrs: {
version = "9.7.106.18";
}))
v8
postgresql
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
Expand Down
123 changes: 123 additions & 0 deletions nix/libxml2.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{ stdenv
, lib
, fetchurl
, pkg-config
, autoreconfHook
, libintl
, python3
, gettext
, ncurses
, findXMLCatalogs
, libiconv
, pythonSupport ? enableShared &&
(stdenv.hostPlatform == stdenv.buildPlatform || stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isWasi)
, icuSupport ? false
, icu
, enableShared ? !stdenv.hostPlatform.isMinGW && !stdenv.hostPlatform.isStatic
, enableStatic ? !enableShared
, gnome
, testers
, enableHttp ? false
, python ? null # accept 'python' as an argument
}:

let
# If 'python' is provided, use it; otherwise use 'python3'
pythonEnv = python3;
in

stdenv.mkDerivation (finalAttrs: {
pname = "libxml2";
version = "2.13.3";

outputs = [ "bin" "dev" "out" "devdoc" ]
++ lib.optional pythonSupport "py"
++ lib.optional (enableStatic && enableShared) "static";
outputMan = "bin";

src = fetchurl {
url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor finalAttrs.version}/libxml2-${finalAttrs.version}.tar.xz";
hash = "sha256-CAXXwYDPCcqtcWZsekWKdPBBVhpTKQJFTaUEfYOUgTg=";
};

strictDeps = true;

nativeBuildInputs = [
pkg-config
autoreconfHook
];

buildInputs = lib.optionals pythonSupport [
pythonEnv
ncurses
];

propagatedBuildInputs = [
findXMLCatalogs
] ++ lib.optionals stdenv.isDarwin [
libiconv
] ++ lib.optionals icuSupport [
icu
];

configureFlags = [
"--exec-prefix=${placeholder "dev"}"
(lib.enableFeature enableStatic "static")
(lib.enableFeature enableShared "shared")
(lib.withFeature icuSupport "icu")
(lib.withFeature pythonSupport "python")
(lib.optionalString pythonSupport "PYTHON=${pythonEnv.pythonOnBuildForHost.interpreter}")
] ++ lib.optional enableHttp "--with-http";

installFlags = lib.optionals pythonSupport [
"pythondir=\"${placeholder "py"}/${pythonEnv.sitePackages}\""
"pyexecdir=\"${placeholder "py"}/${pythonEnv.sitePackages}\""
];

enableParallelBuilding = true;

doCheck =
(stdenv.hostPlatform == stdenv.buildPlatform) &&
stdenv.hostPlatform.libc != "musl";
preCheck = lib.optional stdenv.isDarwin ''
export DYLD_LIBRARY_PATH="$PWD/.libs:$DYLD_LIBRARY_PATH"
'';

preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
MACOSX_DEPLOYMENT_TARGET=10.16
'';

preInstall = lib.optionalString pythonSupport ''
substituteInPlace python/libxml2mod.la --replace-fail "$dev/${pythonEnv.sitePackages}" "$py/${pythonEnv.sitePackages}"
'';

postFixup = ''
moveToOutput bin/xml2-config "$dev"
moveToOutput lib/xml2Conf.sh "$dev"
'' + lib.optionalString (enableStatic && enableShared) ''
moveToOutput lib/libxml2.a "$static"
'';

passthru = {
inherit pythonSupport;

updateScript = gnome.updateScript {
packageName = "libxml2";
versionPolicy = "none";
};
tests = {
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
};

meta = with lib; {
homepage = "https://gitlab.gnome.org/GNOME/libxml2";
description = "XML parsing library for C";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ jtojnar ];
pkgConfigModules = [ "libxml-2.0" ];
};
})
4 changes: 4 additions & 0 deletions nix/postgresql/15.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ./generic.nix {
version = "15.8";
hash = "sha256-RANRX5pp7rPv68mPMLjGlhIr/fiV6Ss7I/W452nty2o=";
}
4 changes: 4 additions & 0 deletions nix/postgresql/16.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ./generic.nix {
version = "16.4";
hash = "sha256-lxdm1kWqc+k7nvTjvkQgG09FtUdwlbBJElQD+fM4bW8=";
}
21 changes: 21 additions & 0 deletions nix/postgresql/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
self:
let
#adapted from the postgresql nixpkgs package
versions = {
postgresql_15 = ./15.nix;
postgresql_16 = ./16.nix;
};

mkAttributes = jitSupport:
self.lib.mapAttrs' (version: path:
let
attrName = if jitSupport then "${version}_jit" else version;
in
self.lib.nameValuePair attrName (import path {
inherit jitSupport self;
})
) versions;

in
# variations without and with JIT
(mkAttributes false) // (mkAttributes true)
Loading
Loading