Skip to content

Build a scala-native project with the devshell #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
};
in
{
inherit devShells;
checks = devShells;
checks = devShells // (import ./tests {
inherit pkgs;
inherit typelevelShell;
});
};
in
{
Expand Down
5 changes: 5 additions & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ pkgs, typelevelShell, ... }:

{
native = pkgs.callPackage ./scala-native { inherit typelevelShell; };
}
20 changes: 20 additions & 0 deletions tests/scala-native/default.nix
Original file line number Diff line number Diff line change
@@ -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
''