From 800ebdc964a6e096cb2daa87521f0a7aa9657fcb Mon Sep 17 00:00:00 2001 From: "Ross A. Baker" Date: Thu, 6 Oct 2022 00:57:17 -0400 Subject: [PATCH] Build a scala-native project with the devshell --- .github/workflows/ci.yml | 5 +---- flake.nix | 6 ++++-- tests/default.nix | 5 +++++ tests/scala-native/default.nix | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tests/default.nix create mode 100644 tests/scala-native/default.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9d4cb9..09247d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,4 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: "Run checks" - run: nix flake check - - - name: "Build dev shells" - run: for shell in library application; do nix develop .#${shell} -c true; done + run: nix -L flake check diff --git a/flake.nix b/flake.nix index 1870443..6c88181 100644 --- a/flake.nix +++ b/flake.nix @@ -47,8 +47,10 @@ }; in { - inherit devShells; - checks = devShells; + checks = devShells // (import ./tests { + inherit pkgs; + inherit typelevelShell; + }); }; in { diff --git a/tests/default.nix b/tests/default.nix new file mode 100644 index 0000000..d7757e7 --- /dev/null +++ b/tests/default.nix @@ -0,0 +1,5 @@ +{ pkgs, typelevelShell, ... }: + +{ + native = pkgs.callPackage ./scala-native { inherit typelevelShell; }; +} diff --git a/tests/scala-native/default.nix b/tests/scala-native/default.nix new file mode 100644 index 0000000..a2bb1ec --- /dev/null +++ b/tests/scala-native/default.nix @@ -0,0 +1,20 @@ +{ pkgs, typelevelShell, ... }: + +let + shell = pkgs.devshell.mkShell { + imports = [ typelevelShell ]; + packages = [ pkgs.which ]; + typelevelShell.native.enable = true; + }; +in pkgs.runCommand "test-scala-native" {} '' + export PRJ_ROOT=$PWD + source ${shell}/entrypoint + export SBT_DEPS=$(mktemp -d) + export SBT_OPTS="-Dsbt.global.base=$SBT_DEPS/project/.sbtboot -Dsbt.boot.directory=$SBT_DEPS/project/.boot -Dsbt.ivy.home=$SBT_DEPS/project/.ivy $SBT_OPTS" + export COURSIER_CACHE=$SBT_DEPS/project/.coursier + mkdir -p $SBT_DEPS/project/{.sbtboot,.boot,.ivy,.coursier} + cp -r ${./.}/. $SBT_DEPS/ + cd $SBT_DEPS + sbt run + touch $out +''