nix(refactor): Split cabalTools from devtools

This allows to use `postgrest-build` in CI without pulling in a lot of dependencies.
This commit is contained in:
Wolfgang Walther
2021-04-24 15:07:13 +02:00
committed by Wolfgang Walther
parent 249d4117e0
commit e5350d2d50
6 changed files with 69 additions and 49 deletions
+7 -4
View File
@@ -113,9 +113,12 @@ rec {
### Tools
cabalTools =
pkgs.callPackage nix/tools/cabalTools.nix { inherit devCabalOptions postgrest; };
# Development tools.
devtools =
pkgs.callPackage nix/tools/devtools.nix { inherit tests style devCabalOptions hsie; };
devTools =
pkgs.callPackage nix/tools/devTools.nix { inherit tests style devCabalOptions hsie; };
# Docker images and loading script.
docker =
@@ -127,7 +130,7 @@ rec {
# Utility for updating the pinned version of Nixpkgs.
nixpkgsTools =
pkgs.callPackage nix/tools/nixpkgstools.nix { };
pkgs.callPackage nix/tools/nixpkgsTools.nix { };
# Scripts for publishing new releases.
release =
@@ -149,5 +152,5 @@ rec {
};
withTools =
pkgs.callPackage nix/tools/withtools.nix { inherit postgresqlVersions; };
pkgs.callPackage nix/tools/withTools.nix { inherit postgresqlVersions; };
}
+57
View File
@@ -0,0 +1,57 @@
{ buildToolbox
, cabal-install
, checkedShellScript
, devCabalOptions
, postgrest
}:
let
build =
checkedShellScript
{
name = "postgrest-build";
docs = "Build PostgREST interactively using cabal-install.";
args = [ "ARG_LEFTOVERS([Cabal arguments])" ];
inRootDir = true;
withEnv = postgrest.env;
}
''
exec ${cabal-install}/bin/cabal v2-build ${devCabalOptions} "''${_arg_leftovers[@]}"
'';
clean =
checkedShellScript
{
name = "postgrest-clean";
docs = "Clean the PostgREST project, including all cabal-install artifacts.";
inRootDir = true;
}
''
# clean old coverage data, too
rm -rf .hpc coverage
exec ${cabal-install}/bin/cabal v2-clean
'';
run =
checkedShellScript
{
name = "postgrest-run";
docs = "Run PostgREST after buidling it interactively with cabal-install";
args = [ "ARG_LEFTOVERS([PostgREST arguments])" ];
inRootDir = true;
withEnv = postgrest.env;
}
''
exec ${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest "''${_arg_leftovers[@]}"
'';
in
buildToolbox
{
name = "postgrest-cabal";
tools = [
build
clean
run
];
}
@@ -57,44 +57,6 @@ let
| ${cachix}/bin/cachix push postgrest
'';
build =
checkedShellScript
{
name = "postgrest-build";
docs = "Build PostgREST interactively using cabal-install.";
args = [ "ARG_LEFTOVERS([Cabal arguments])" ];
inRootDir = true;
}
''
${cabal-install}/bin/cabal v2-build ${devCabalOptions} "''${_arg_leftovers[@]}"
'';
run =
checkedShellScript
{
name = "postgrest-run";
docs = "Run PostgREST after buidling it interactively with cabal-install";
args = [ "ARG_LEFTOVERS([PostgREST arguments])" ];
inRootDir = true;
}
''
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest "''${_arg_leftovers[@]}"
'';
clean =
checkedShellScript
{
name = "postgrest-clean";
docs = "Clean the PostgREST project, including all cabal-install artifacts.";
inRootDir = true;
}
''
${cabal-install}/bin/cabal v2-clean
# clean old coverage data, too
rm -rf .hpc coverage
'';
check =
checkedShellScript
{
@@ -176,13 +138,10 @@ let
in
buildToolbox
{
name = "postgrest-devtools";
name = "postgrest-dev";
tools = [
watch
pushCachix
build
run
clean
check
dumpMinimalImports
hsieMinimalImports
@@ -48,6 +48,6 @@ let
in
buildToolbox
{
name = "postgrest-nixpkgstools";
name = "postgrest-nixpkgs";
tools = [ upgrade ];
}
@@ -127,7 +127,7 @@ let
in
buildToolbox
{
name = "postgrest-withtools";
name = "postgrest-with";
tools = [ withAll ] ++ withVersions;
extra = {
# make withTools.latest available for other nix files
+2 -1
View File
@@ -25,7 +25,8 @@ let
toolboxes =
[
postgrest.devtools
postgrest.cabalTools
postgrest.devTools
postgrest.nixpkgsTools
postgrest.style
postgrest.tests