Skip to content

Commit

Permalink
Merge pull request #2292 from robx/aeson2
Browse files Browse the repository at this point in the history
Upgrade aeson to 2.0.*
  • Loading branch information
robx authored Jun 14, 2022
2 parents 4dfcb59 + 8d8074d commit bac63f3
Show file tree
Hide file tree
Showing 30 changed files with 324 additions and 154 deletions.
18 changes: 17 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,23 @@ rec {

# Linting and styling tools.
style =
pkgs.callPackage nix/tools/style.nix { inherit hsie; };
let
# keep old version of hlint to not deal with linter changes for now
nixpkgsVersionPrev = {
date = "2021-11-02";
rev = "7053541084bf5ce2921ef307e5585d39d7ba8b3f";
tarballHash = "1flhh5d4zy43x6060hvzjb5hi5cmc51ivc0nwmija9n8d35kcc4x";
};

nixpkgsPrev =
builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${nixpkgsVersionPrev.rev}.tar.gz";
sha256 = nixpkgsVersionPrev.tarballHash;
};
pkgsPrev = import nixpkgsPrev { };
inherit (pkgsPrev) hlint;
in
pkgs.callPackage nix/tools/style.nix { inherit hlint hsie; };

# Scripts for running tests.
tests =
Expand Down
4 changes: 2 additions & 2 deletions nix/hsie/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ let
mkdir -p $out/bin
ln -s $hsie $out/bin/$name
'';
bashCompletion =
bash-completion =
runCommand "${name}-bash-completion" { inherit bin name; }
"$bin/bin/$name --bash-completion-script $bin/bin/$name > $out";
in
hsie // { inherit bashCompletion bin; }
hsie // { inherit bash-completion bin; }
6 changes: 3 additions & 3 deletions nix/nixpkgs-version.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pinned version of Nixpkgs, generated with postgrest-nixpkgs-upgrade.
{
date = "2021-11-02";
rev = "7053541084bf5ce2921ef307e5585d39d7ba8b3f";
tarballHash = "1flhh5d4zy43x6060hvzjb5hi5cmc51ivc0nwmija9n8d35kcc4x";
date = "2022-03-30";
rev = "9a5aa75d56ad4163521f1692469e6dc54b90068c";
tarballHash = "1f3wyldcx1zpyk2q6122mkg16chf9j7swwx1v6f1dg126xz1238f";
}
6 changes: 3 additions & 3 deletions nix/overlays/build-toolbox/build-toolbox.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Creates an environment that exposes bashCompletion arguments from all checkedShellScripts
# Creates an environment that exposes bash-completion arguments from all checkedShellScripts
{ buildEnv }:
{ name
, tools
, extra ? { }
}:
let
bashCompletion = builtins.map (tool: tool.bashCompletion) tools;
bash-completion = builtins.map (tool: tool.bash-completion) tools;

env = buildEnv {
inherit name;
paths = builtins.map (tool: tool.bin) tools;
};

in
env // { inherit bashCompletion; } // extra
env // { inherit bash-completion; } // extra
4 changes: 2 additions & 2 deletions nix/overlays/checked-shell-script/checked-shell-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let
sed '/_positionals_count + 1/a\\t\t\t\tset -- "''${@:1:1}" "--" "''${@:2}"' -i $out
'';

bashCompletion =
bash-completion =
runCommand "${name}-completion" { } (
''
${argbash}/bin/argbash --type completion --strip all ${argsTemplate}/${name}.m4 > $out
Expand Down Expand Up @@ -138,4 +138,4 @@ let
script =
runCommand name { inherit bin name; } "ln -s $bin/bin/$name $out";
in
script // { inherit bin bashCompletion; }
script // { inherit bin bash-completion; }
38 changes: 16 additions & 22 deletions nix/overlays/haskell-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,41 +41,35 @@ let
}
{ };

wai-extra =
configurator-pg =
prev.callHackageDirect
{
pkg = "wai-extra";
ver = "3.1.8";
sha256 = "1ha8sxc2ii7k7xs5nm06wfwqmf4f1p2acp4ya0jnx6yn6551qps4";
pkg = "configurator-pg";
ver = "0.2.6";
sha256 = "sha256-nkamTOpP/w0vQfOXsoQKEstW3n9qyRsv0TocrEerKlU=";
}
{ };

wai-logger =
prev.callHackageDirect
hasql-dynamic-statements =
lib.dontCheck (prev.callHackageDirect
{
pkg = "wai-logger";
ver = "2.3.7";
sha256 = "1d23fdbwbahr3y1vdyn57m1qhljy22pm5cpgb20dy6mlxzdb30xd";
pkg = "hasql-dynamic-statements";
ver = "0.3.1.1";
sha256 = "sha256-jF50GcCtEUV3TN1UsD4LaSBH6arcqfKhxOk+b+c8Bl8=";
}
{ };
{ });

warp =
hasql-implicits =
lib.dontCheck (prev.callHackageDirect
{
pkg = "warp";
ver = "3.3.19";
sha256 = "0y3jj4bhviss6ff9lwxki0zbdcl1rb398bk4s80zvfpnpy7p94cx";
pkg = "hasql-implicits";
ver = "0.1.0.3";
sha256 = "sha256-IpAOVHNdXJ53B/fmo+DeNUKiBSS6Bo7Uha/krpMt64g=";
}
{ });

hasql-dynamic-statements =
lib.dontCheck (lib.unmarkBroken prev.hasql-dynamic-statements);

hasql-implicits =
lib.dontCheck (lib.unmarkBroken prev.hasql-implicits);

ptr =
lib.dontCheck (lib.unmarkBroken prev.ptr);
hspec-wai-json =
lib.dontCheck (lib.unmarkBroken prev.hspec-wai-json);
} // extraOverrides final prev;
in
{
Expand Down
27 changes: 13 additions & 14 deletions nix/overlays/postgresql-legacy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ self: super:
# Overlay that adds legacy versions of PostgreSQL that are supported by
# PostgREST.
{
# PostgreSQL 9.5 was removed from Nixpkgs with
# https://github.com/NixOS/nixpkgs/commit/72ab382fb6b729b0d654f2c03f5eb25b39f11fbb
# PostgreSQL 9.6 was removed from Nixpkgs with
# https://github.com/NixOS/nixpkgs/commit/757dd008b2f2926fc0f7688fa8189f930ea47521
# We pin its parent commit to get the last version that was available.
# postgresql_9_5 =
# let
# rev = "55ac7d4580c9ab67848c98cb9519317a1cc399c8";
# tarballHash = "02ffj9f8s1hwhmxj85nx04sv64qb6jm7w0122a1dz9n32fymgklj";
#
# pinnedPkgs =
# builtins.fetchTarball {
# url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
# sha256 = tarballHash;
# };
# in
# (import pinnedPkgs { }).pkgs.postgresql_9_5;
postgresql_9_6 =
let
rev = "571cbf3d1db477058303cef8754fb85a14e90eb7";
tarballHash = "0q74wn418i1bn5sssacmw8ykpmqvzr0s93sj6pbs3rf6bf134fkz";
pinnedPkgs =
builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
sha256 = tarballHash;
};
in
(import pinnedPkgs { }).pkgs.postgresql_9_6;
}
5 changes: 5 additions & 0 deletions nix/patches/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@
# See: https://github.com/NixOS/nixpkgs/pull/87879
nixpkgs-openssl-split-runtime-dependencies-of-static-builds =
./nixpkgs-openssl-split-runtime-dependencies-of-static-builds.patch;

static-haskell-nix-ncurses =
./static-haskell-nix-ncurses.patch;
static-haskell-nix-isexecutable =
./static-haskell-nix-isexecutable.patch;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/l
index d4be8cc2428..3979698711f 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -50,9 +50,21 @@ let
@@ -43,9 +43,21 @@ let
substituteInPlace crypto/async/arch/async_posix.h \
--replace '!defined(__ANDROID__) && !defined(__OpenBSD__)' \
'!defined(__ANDROID__) && !defined(__OpenBSD__) && 0'
+ '' + optionalString static
+ '' + lib.optionalString static
+ # On static builds, the ENGINESDIR will be empty, but its path will be
+ # compiled into the library. In order to minimize the runtime dependencies
+ # of packages that statically link openssl, we move it into the OPENSSLDIR,
Expand All @@ -17,15 +17,15 @@ index d4be8cc2428..3979698711f 100644
+ 'ENGINESDIR=$(OPENSSLDIR)/engines-{- $sover_dirname -}'
'';

- outputs = [ "bin" "dev" "out" "man" ] ++ optional withDocs "doc";
- outputs = [ "bin" "dev" "out" "man" ] ++ lib.optional withDocs "doc";
+ outputs = [ "bin" "dev" "out" "man" ]
+ ++ optional withDocs "doc"
+ ++ lib.optional withDocs "doc"
+ # Separate output for the runtime dependencies of the static build.
+ ++ optional static "etc";
+ ++ lib.optional static "etc";
setOutputFlags = false;
separateDebugInfo =
!stdenv.hostPlatform.isDarwin &&
@@ -101,7 +113,17 @@ let
@@ -95,7 +107,17 @@ let
configureFlags = [
"shared" # "shared" builds both shared and static libraries
"--libdir=lib"
Expand All @@ -44,7 +44,7 @@ index d4be8cc2428..3979698711f 100644
] ++ lib.optionals withCryptodev [
"-DHAVE_CRYPTODEV"
"-DUSE_CRYPTODEV_DIGESTS"
@@ -131,6 +153,9 @@ let
@@ -126,6 +148,9 @@ let
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
rm "$out/lib/"*.a
fi
Expand All @@ -54,7 +54,7 @@ index d4be8cc2428..3979698711f 100644
'' + lib.optionalString (!stdenv.hostPlatform.isWindows)
# Fix bin/c_rehash's perl interpreter line
#
@@ -152,14 +177,15 @@ let
@@ -147,14 +172,15 @@ let
mv $out/include $dev/

# remove dependency on Perl at runtime
Expand Down
18 changes: 18 additions & 0 deletions nix/patches/static-haskell-nix-isexecutable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/survey/default.nix b/survey/default.nix
index 46d8066..5f7950b 100644
--- a/survey/default.nix
+++ b/survey/default.nix
@@ -85,10 +85,9 @@ let
# Function that tells us if a given Haskell package has an executable.
# Pass only Haskell packages to this!
# Filter away other stuff with `isProperHaskellPackage` first.
- isExecutable = pkg:
- (pkgs.haskell.lib.overrideCabal pkg (drv: {
- passthru.isExecutable = drv.isExecutable or false;
- })).isExecutable;
+ # FIXME postgrest: original fails with our nixpkgs version, we
+ # just hardcode the check to work for a static postgrest build.
+ isExecutable = pkg: pkg.name == "postgrest";

# Turn e.g. `Cabal_1_2_3_4` into `1.2.3.4`.
cabalDottedVersion =
13 changes: 13 additions & 0 deletions nix/patches/static-haskell-nix-ncurses.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/survey/default.nix b/survey/default.nix
index 46d8066..a47f214 100644
--- a/survey/default.nix
+++ b/survey/default.nix
@@ -1519,7 +1519,7 @@ let
[
"--enable-executable-static" # requires `useFixedCabal`
# `enableShared` seems to be required to avoid `recompile with -fPIC` errors on some packages.
- "--extra-lib-dirs=${final.ncurses.override { enableStatic = true; enableShared = true; }}/lib"
+ "--extra-lib-dirs=${final.ncurses}/lib"
]
# TODO Figure out why this and the below libffi are necessary.
# `working` and `workingStackageExecutables` don't seem to need that,
3 changes: 2 additions & 1 deletion nix/static-haskell-package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ let
patches.applyPatches "patched-static-haskell-nix"
static-haskell-nix
[
# No patches currently required.
patches.static-haskell-nix-ncurses
patches.static-haskell-nix-isexecutable
];

patchedNixpkgs =
Expand Down
2 changes: 1 addition & 1 deletion nix/tools/withTools.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ bashCompletion
{ bash-completion
, buildToolbox
, cabal-install
, checkedShellScript
Expand Down
23 changes: 14 additions & 9 deletions postgrest.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ library
build-depends: base >= 4.9 && < 4.16
, HTTP >= 4000.3.7 && < 4000.4
, Ranged-sets >= 0.3 && < 0.5
, aeson >= 1.4.7 && < 1.6
, aeson >= 2.0.3 && < 2.1
, auto-update >= 0.1.4 && < 0.2
, base64-bytestring >= 1 && < 1.3
, bytestring >= 0.10.8 && < 0.11
Expand All @@ -83,16 +83,16 @@ library
, cookie >= 0.4.2 && < 0.5
, either >= 4.4.1 && < 5.1
, gitrev >= 1.2 && < 1.4
, hasql >= 1.4 && < 1.5
, hasql-dynamic-statements == 0.3.1
, hasql >= 1.4 && < 1.6
, hasql-dynamic-statements >= 0.3.1 && < 0.4
, hasql-notifications >= 0.1 && < 0.3
, hasql-pool >= 0.5 && < 0.6
, hasql-transaction >= 1.0.1 && < 1.1
, heredoc >= 0.2 && < 0.3
, http-types >= 0.12.2 && < 0.13
, insert-ordered-containers >= 0.2.2 && < 0.3
, interpolatedstring-perl6 >= 1 && < 1.1
, jose >= 0.8.1 && < 0.9
, jose >= 0.8.5.1 && < 0.10
, lens >= 4.14 && < 5.1
, lens-aeson >= 1.0.1 && < 1.2
, mtl >= 2.2.2 && < 2.3
Expand All @@ -104,7 +104,7 @@ library
, regex-tdfa >= 1.2.2 && < 1.4
, retry >= 0.7.4 && < 0.10
, scientific >= 0.3.4 && < 0.4
, swagger2 >= 2.4 && < 2.7
, swagger2 >= 2.4 && < 2.9
, text >= 1.2.2 && < 1.3
, time >= 1.6 && < 1.11
, unordered-containers >= 0.2.8 && < 0.3
Expand All @@ -113,6 +113,11 @@ library
, wai >= 3.2.1 && < 3.3
, wai-cors >= 0.2.5 && < 0.3
, wai-extra >= 3.1.8 && < 3.2
-- We already depend on wai-logger >= 2.3.7 indirectly via wai-extra,
-- but we want to depend on 2.4.0 which fixes 'unknownSocket' log output
-- for unix sockets; this is tested in test/io/test_io.py. See
-- https://github.com/kazu-yamamoto/logger/commit/3a71ca70afdbb93d4ecf0083eeba1fbbbcab3fc3
, wai-logger >= 2.4.0
, warp >= 3.3.19 && < 3.4
-- -fno-spec-constr may help keep compile time memory use in check,
-- see https://gitlab.haskell.org/ghc/ghc/issues/16017#note_219304
Expand Down Expand Up @@ -206,7 +211,7 @@ test-suite spec
SpecHelper
TestTypes
build-depends: base >= 4.9 && < 4.16
, aeson >= 1.4.7 && < 1.6
, aeson >= 2.0.3 && < 2.1
, aeson-qq >= 0.8.1 && < 0.9
, async >= 2.1.1 && < 2.3
, auto-update >= 0.1.4 && < 0.2
Expand Down Expand Up @@ -249,14 +254,14 @@ test-suite querycost
main-is: QueryCost.hs
other-modules: SpecHelper
build-depends: base >= 4.9 && < 4.16
, aeson >= 1.4.7 && < 1.6
, aeson >= 2.0.3 && < 2.1
, base64-bytestring >= 1 && < 1.3
, bytestring >= 0.10.8 && < 0.11
, case-insensitive >= 1.2 && < 1.3
, containers >= 0.5.7 && < 0.7
, contravariant >= 1.4 && < 1.6
, hasql >= 1.4 && < 1.5
, hasql-dynamic-statements == 0.3.1
, hasql >= 1.4 && < 1.6
, hasql-dynamic-statements >= 0.3.1 && < 0.4
, hasql-pool >= 0.5 && < 0.6
, hasql-transaction >= 1.0.1 && < 1.1
, heredoc >= 0.2 && < 0.3
Expand Down
8 changes: 4 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ lib.overrideDerivation postgrest.env (
''
export HISTFILE=.history
source ${pkgs.bashCompletion}/etc/profile.d/bash_completion.sh
source ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh
source ${pkgs.git}/share/git/contrib/completion/git-completion.bash
source ${postgrest.hsie.bashCompletion}
source ${postgrest.hsie.bash-completion}
''
+ builtins.concatStringsSep "\n" (
builtins.map (bashCompletion: "source ${bashCompletion}") (
builtins.concatLists (builtins.map (toolbox: toolbox.bashCompletion) toolboxes)
builtins.map (bash-completion: "source ${bash-completion}") (
builtins.concatLists (builtins.map (toolbox: toolbox.bash-completion) toolboxes)
)
);
}
Expand Down
Loading

0 comments on commit bac63f3

Please sign in to comment.