Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimescaleDB-0.9.1 fails on NixOS 17.09 with PostgreSQL10 #38469

Closed
Shkiv opened this issue Apr 5, 2018 · 10 comments
Closed

TimescaleDB-0.9.1 fails on NixOS 17.09 with PostgreSQL10 #38469

Shkiv opened this issue Apr 5, 2018 · 10 comments

Comments

@Shkiv
Copy link

Shkiv commented Apr 5, 2018

Issue description

I can add, but cannot enable TimescaleDB from branch master to NixOS 17.09

Steps to reproduce

  1. Copy nixpkgs/pkgs/servers/sql/postgresql/timescaledb/default.nix to nixpkgs folder
  2. Insert in main config.nix
nixpkgs.config.packageOverrides = with pkgs; {
  timescaledb = callPackage <nixpkgs/timescaledb.nix>;
};
  1. Deploy using nixops and it is works.
  2. Try to plug it to PostgreSQL:
services.postgresql = {
...
  extraPlugins = [ pkgs.timescaledb ];
};
  1. Deploy fails:
    error: cannot coerce a function to a string, at /nix/store/ic6pn6y6wv8b94xs31j2spkqzxi7gaxk-nixpkgs-patched/lib/types.nix:177:42

Technical details

Your nixpkgs is -6 days old before latest channel, (channel is at commit 21693048d7258c315c7fa6e48f193677e544942c)
NIX_PATH was pinned to nixpkgs=/nix/store/ic6pn6y6wv8b94xs31j2spkqzxi7gaxk-nixpkgs-patched:fleet=/home/mrom/production/fleet (from https://github.com/NixOS/nixpkgs/archive/12512f25e9ecdf6e8fc97a80297a4d2fa89e2f99.tar.gz)
- with patch 'nixos-shell' (https://github.com/NixOS/nixpkgs/compare/master...danbst:nixos-shell.diff)
- with patch 'create journald cursor before system activation' (/nix/store/ifyqivd75a4r0rbfp9rav73knqm02m8x-patch-journal-cursor)
- with patch 'service wrapper' (https://github.com/NixOS/nixpkgs/pull/20423.diff)
- with patch 'pgbouncer' (https://github.com/NixOS/nixpkgs/commit/5eed14303630499386c391da8fcb8de887ff2200.patch)
 - system: `"x86_64-linux"`
 - host os: `Linux 4.9.86, NixOS, 17.09pre-git (Hummingbird)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 1.11.16`
 - channels(root): `"nixos-17.09.2752.fea24301317"`
 - nixpkgs: `/nix/store/ic6pn6y6wv8b94xs31j2spkqzxi7gaxk-nixpkgs-patched`
@Shkiv Shkiv changed the title TimescaleDB on NixOS 17.09 TimescaleDB fail on NixOS 17.09 Apr 5, 2018
@Mic92
Copy link
Member

Mic92 commented Apr 5, 2018

untested fix:

nixpkgs.config.packageOverrides = with pkgs; {
-  timescaledb = callPackage <nixpkgs/timescaledb.nix>;
+  timescaledb = callPackage <nixpkgs/timescaledb.nix> {};
};

@Shkiv
Copy link
Author

Shkiv commented Apr 5, 2018

rm: cannot remove '/nix/store/yyhwaqwg0bj1q4kyhkn8aifxqgdq71ln-postgresql-and-plugins-10.2/bin/pg_config': Permission denied
rm: cannot remove '/nix/store/yyhwaqwg0bj1q4kyhkn8aifxqgdq71ln-postgresql-and-plugins-10.2/bin/postgres': Permission denied
rm: cannot remove '/nix/store/yyhwaqwg0bj1q4kyhkn8aifxqgdq71ln-postgresql-and-plugins-10.2/bin/pg_ctl': Permission denied

@Shkiv Shkiv changed the title TimescaleDB fail on NixOS 17.09 TimescaleDB fails on NixOS 17.09 Apr 5, 2018
@Mic92
Copy link
Member

Mic92 commented Apr 5, 2018

again untested:

diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index 0dcbfe2e47a..884a9a64395 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -16,7 +16,7 @@ let
       postBuild =
         ''
           mkdir -p $out/bin
-          rm $out/bin/{pg_config,postgres,pg_ctl}
+          rm -f $out/bin/{pg_config,postgres,pg_ctl}
           cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
           wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
         '';

@Shkiv
Copy link
Author

Shkiv commented Apr 5, 2018

still the same rm: cannot remove
steps to prepare patch:

  1. touch fleet/nixpkgs/patch-timescaledb
  2. paste the diff from above
  3. Insert
diff -r e996faf62eaa fleet/nixpkgs/default.nix
--- a/fleet/nixpkgs/default.nix Thu Apr 05 11:59:04 2018 +0000
+++ b/fleet/nixpkgs/default.nix Thu Apr 05 16:05:34 2018 +0000
@@ -26,6 +26,9 @@
       url = "https://github.com/NixOS/nixpkgs/commit/5eed14303630499386c391da8fcb8de887ff2200.patch";
       sha256 = "0frsv3kdlmwgzh3pdayjislqc61jcvycw4hfsckvp8a6njk7q6kd";
     }
+    { meta.description = "TimescaleDB";
+      src = ./patch-timescaledb;
+    }
   ];

@Mic92
Copy link
Member

Mic92 commented Apr 5, 2018

what is fleet?

@Shkiv
Copy link
Author

Shkiv commented Apr 5, 2018

fleet is a name of deployment profile, just a folder.
fleet/nixpkgs/default.nix
amazon/nixpkgs/default.nix
kyivstar/nixpkgs/default.nix etc

@Shkiv Shkiv changed the title TimescaleDB fails on NixOS 17.09 TimescaleDB-0.9.1 fails on NixOS 17.09 Apr 6, 2018
@Shkiv Shkiv changed the title TimescaleDB-0.9.1 fails on NixOS 17.09 TimescaleDB-0.9.1 fails on NixOS 17.09 with PostgreSQL10 Apr 6, 2018
@Shkiv
Copy link
Author

Shkiv commented Apr 6, 2018

Hack:
Install one another PostgreSQL extension (postage for example):

extraPlugins = [
  timescaledb
  (pkgs.postage.override { postgresql = pkgs.postgresql100; })
];

then change

- timescaledb = callPackage <fleet/nixpkgs/timescaledb-0.10.nix> { };
+ timescaledb = callPackage <fleet/nixpkgs/timescaledb-0.10.nix> { postgresql = pkgs.postgresql100; };

and it works

@thoughtpolice
Copy link
Member

I didn't see this (I also enabled several other extensions so it masked it). I might take a look since I updated Timescale recently...

thoughtpolice added a commit that referenced this issue Jul 14, 2018
See #22653 or #38469. 'manveru' reported this on IRC again, but unfortunately a
real fix requires a bit more work. In the mean time, this plugs the leak with a
bit of duct tape.

'timescale' is an often desired extension and, in the mean time, this
workaround means you also do not have to install something like postgis (with a
large dependency set) into your closure to get things to work.

Ideally in the mean time, *all* postgresql extensions should have $out/bin
created for them... Doing this will require more ongoing work, or a proper
fix to the buildEnv nonsense going on.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
@thoughtpolice
Copy link
Member

Just as a note, this (and many other issues) are fully solved by #38698.

@danbst
Copy link
Contributor

danbst commented Jul 23, 2019

@Shkiv there is new syntax for using PG plugins and making plugin overrides

See docs #64899

@danbst danbst closed this as completed Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants