aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/default.nix15
-rw-r--r--nix/pkgs.nix31
2 files changed, 46 insertions, 0 deletions
diff --git a/nix/default.nix b/nix/default.nix
new file mode 100644
index 0000000..ba8291d
--- /dev/null
+++ b/nix/default.nix
@@ -0,0 +1,15 @@
+{
+ system ? builtins.currentSystem,
+ pkgs ? import ./pkgs.nix { inherit system; }
+}:
+let
+ lib = pkgs.lib;
+ shell = pkgs.mkShell {
+ name = "portable-postgresql";
+ buildInputs = with pkgs; [
+ ppq_postgresql
+ ];
+ };
+in {
+ inherit shell pkgs;
+}
diff --git a/nix/pkgs.nix b/nix/pkgs.nix
new file mode 100644
index 0000000..cd15894
--- /dev/null
+++ b/nix/pkgs.nix
@@ -0,0 +1,31 @@
+{
+ system ? builtins.currentSystem,
+ nixpkgs ? builtins.fetchTarball {
+ url = "https://github.com/NixOS/nixpkgs/archive/22.11.tar.gz";
+ sha256 = "11w3wn2yjhaa5pv20gbfbirvjq6i3m7pqrq2msf0g7cv44vijwgw";
+ }
+}:
+let
+ # use the first version in the list for each component
+ getMajorVersion = builtins.getEnv "PPQ_POSTGRES_VERSION";
+
+ overlay = self: super: {
+ # NOTE: Overlaying `postgresql` is not possible anymore, leads to
+ # error: infinite recursion encountered
+ #
+ # TODO: Make extension packages more easily configurable. For now
+ # just load whatever we've ever needed.
+ ppq_postgresql = super."postgresql_${getMajorVersion}".withPackages (p: [
+ p.postgis
+ ]);
+ };
+
+ pkgs =
+ import nixpkgs {
+ inherit system;
+ overlays = [
+ overlay
+ ];
+ };
+in
+pkgs