postgresql-typed icon indicating copy to clipboard operation
postgresql-typed copied to clipboard

Nix build is broken (2019/11/20)

Open szg251 opened this issue 5 years ago • 3 comments

I use postgresql-typed in one of my projects. When used with stack, it works perfectly, but when I tried to migrate to nix, it seems to be broken. The package itself is marked as broken in the nixpkgs. If I ignore the warning, I get the following error message:

test/Main.hs:1:1: error:
    Exception when trying to run compile-time code:
      Network.Socket.connect: <socket: 12>: does not exist (No such file or directory)
    Code: template-haskell-2.14.0.0:Language.Haskell.TH.Quote.quoteDec
            pgSQL "!CREATE TYPE myenum AS enum ('abc', 'DEF', 'XX_ye')"
  |
1 | {-# LANGUAGE OverloadedStrings, FlexibleInstances, MultiParamTypeClasses, DataKinds, DeriveDataTypeable, TypeFamilies, PatternGuards, StandaloneDeriving #-}
  | ^

builder for '/nix/store/ghbmalyqp9511ps05f6c7mvx5d6wwpnk-postgresql-typed-0.6.1.0.drv' failed with exit code 1

My guess is that, some post build scripts need a running postgres server.

Nixpkgs rev: 58fb23f72ad916c8bbfa3c3bc2d0c83c9cfcdd16

szg251 avatar Dec 01 '19 07:12 szg251

Your guess is right. The building and running the tests require a running postgres server. A quick workaround is to disable the package's tests in a nix overlay.

Nix is used to test postgresql-typed in CI so you can also take a look at https://github.com/dylex/postgresql-typed/blob/master/nix/default.nix and https://github.com/dylex/postgresql-typed/blob/4ef29b9357d749fc0c07d25b70dada85ea7afde0/nix/utilities.nix#L93-L165 to see how a running postgres can be created to run the tests using Nix instead of disabling them.

albertov avatar Dec 01 '19 08:12 albertov

Thank you for the prompt reply. I'll try to start a postgres server with nix.

szg251 avatar Dec 01 '19 11:12 szg251

See databrary for some notes about starting a postgres instance in nix

ghost avatar Nov 14 '20 22:11 ghost