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 ### Tools
cabalTools =
pkgs.callPackage nix/tools/cabalTools.nix { inherit devCabalOptions postgrest; };
# Development tools. # Development tools.
devtools = devTools =
pkgs.callPackage nix/tools/devtools.nix { inherit tests style devCabalOptions hsie; }; pkgs.callPackage nix/tools/devTools.nix { inherit tests style devCabalOptions hsie; };
# Docker images and loading script. # Docker images and loading script.
docker = docker =
@@ -127,7 +130,7 @@ rec {
# Utility for updating the pinned version of Nixpkgs. # Utility for updating the pinned version of Nixpkgs.
nixpkgsTools = nixpkgsTools =
pkgs.callPackage nix/tools/nixpkgstools.nix { }; pkgs.callPackage nix/tools/nixpkgsTools.nix { };
# Scripts for publishing new releases. # Scripts for publishing new releases.
release = release =
@@ -149,5 +152,5 @@ rec {
}; };
withTools = 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 | ${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 = check =
checkedShellScript checkedShellScript
{ {
@@ -176,13 +138,10 @@ let
in in
buildToolbox buildToolbox
{ {
name = "postgrest-devtools"; name = "postgrest-dev";
tools = [ tools = [
watch watch
pushCachix pushCachix
build
run
clean
check check
dumpMinimalImports dumpMinimalImports
hsieMinimalImports hsieMinimalImports
@@ -48,6 +48,6 @@ let
in in
buildToolbox buildToolbox
{ {
name = "postgrest-nixpkgstools"; name = "postgrest-nixpkgs";
tools = [ upgrade ]; tools = [ upgrade ];
} }
@@ -127,7 +127,7 @@ let
in in
buildToolbox buildToolbox
{ {
name = "postgrest-withtools"; name = "postgrest-with";
tools = [ withAll ] ++ withVersions; tools = [ withAll ] ++ withVersions;
extra = { extra = {
# make withTools.latest available for other nix files # make withTools.latest available for other nix files
+2 -1
View File
@@ -25,7 +25,8 @@ let
toolboxes = toolboxes =
[ [
postgrest.devtools postgrest.cabalTools
postgrest.devTools
postgrest.nixpkgsTools postgrest.nixpkgsTools
postgrest.style postgrest.style
postgrest.tests postgrest.tests