Bump nixpkgs and simplify/clean up nix setup (#1529)

* Refactor tests and fix README

* fix linting hints from new hlint version

* postgrest-style with new nixpkgs-fmt
This commit is contained in:
Remo Rechkemmer
2020-05-20 21:30:20 -05:00
committed by GitHub
parent e6874c866d
commit 48c9ac36b1
27 changed files with 268 additions and 344 deletions
+29 -26
View File
@@ -28,9 +28,10 @@ let
overlays =
[
(import nix/overlays/postgresql-default.nix)
(import nix/overlays/postgresql-legacy.nix)
(import nix/overlays/gitignore.nix)
(import nix/overlays/haskell-packages)
(import nix/overlays/haskell-packages { inherit compiler; })
];
# Evaluated expression of the Nixpkgs repository.
@@ -38,25 +39,29 @@ let
import nixpkgs { inherit overlays; };
postgresqlVersions =
[
pkgs.postgresql_12
pkgs.postgresql_11
pkgs.postgresql_10
pkgs.postgresql_9_6
pkgs.postgresql_9_5
pkgs.postgresql_9_4
];
{
postgresql-12 = pkgs.postgresql_12;
postgresql-11 = pkgs.postgresql_11;
postgresql-10 = pkgs.postgresql_10;
"postgresql-9.6" = pkgs.postgresql_9_6;
"postgresql-9.5" = pkgs.postgresql_9_5;
"postgresql-9.4" = pkgs.postgresql_9_4;
};
patches =
pkgs.callPackage nix/patches {};
pkgs.callPackage nix/patches { };
# Base dynamic derivation for the PostgREST package.
drv =
lib.enableCabalFlag (pkgs.haskellPackages.callCabal2nix name src {}) "FailOnWarn";
pkgs.haskell.packages."${compiler}".callCabal2nix name src { };
# Static set of Haskell Packages based on nh2/static-haskell-nix
staticHaskellPackages =
import nix/static-haskell-packages.nix { inherit nixpkgs compiler patches; };
# Static derivation for the PostgREST executable.
drvStatic =
import nix/static { inherit nixpkgs name src compiler patches; };
staticHaskellPackages.callCabal2nix name src { };
lib =
pkgs.haskell.lib;
@@ -67,15 +72,15 @@ rec {
# Derivation for the PostgREST Haskell package, including the executable,
# libraries and documentation. We disable running the test suite on Nix
# builds, as they require a database to be set up.
postgrestWithLib =
lib.dontCheck drv;
postgrestPackage =
lib.dontCheck (lib.enableCabalFlag drv "FailOnWarn");
# Derivation for just the PostgREST binary, where we strip all dynamic
# libraries and documentation, leaving only the executable. Note that the
# executable is static with regards to Haskell libraries, but not system
# libraries like glibc and libpq.
postgrest =
lib.justStaticExecutables postgrestWithLib;
lib.justStaticExecutables postgrestPackage;
# Static executable.
postgrestStatic =
@@ -98,18 +103,16 @@ rec {
# Utility for updating the pinned version of Nixpkgs.
nixpkgsUpgrade =
pkgs.callPackage nix/nixpkgs-upgrade.nix {};
pkgs.callPackage nix/nixpkgs-upgrade.nix { };
# Scripts for running tests.
tests =
pkgs.callPackage nix/tests.nix
{
inherit postgresqlVersions;
postgrestBuildEnv = env;
};
pkgs.callPackage nix/tests.nix {
inherit postgresqlVersions;
postgrestBuildEnv = env;
};
style =
pkgs.callPackage nix/style.nix {};
lint =
pkgs.callPackage nix/lint.nix {};
# Development tools, including linting and styling scripts.
devtools =
pkgs.callPackage nix/devtools.nix { };
}