Skip to content
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

Add nix-flake and direnv support #6

Merged
merged 1 commit into from
Apr 3, 2022
Merged

Conversation

rossabaker
Copy link
Member

This is based on typelevel-nix. It sets up all the tooling (correct JVM, sbt, compatible metals version) on entering into the project directory.

@@ -8,6 +8,7 @@ scala_version = 2.13.8
other_scala_version = 3.1.1
sbt_version = 1.6.2
sbt_typelevel_version = 0.4.7
jdk_version = 8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this setting could be more smartly integrated into the build.sbt, as well.

JDK8 active support just ended in March 2022, so it also wouldn't be unreasonable to bump this to 11.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not unreasonable. See also typelevel/sbt-typelevel#215.

Copy link
Member Author

@rossabaker rossabaker Apr 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the answer is tlJdkRelease, but I'm not entirely sure what that's going to do to the generated JDKs for CI. I would think that's a sbt-typelevel concern. I'd much rather sort that out in Scala than in g8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same way that we opt'd to default to Scala 2.13 and 3.1.1 I think we should default to JDK 11

Would JDK 17 just be too controversial?

Copy link
Member

@armanbilge armanbilge Apr 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the tlJdkRelease setting any JDK should be fine. 17 has its advantages. fs2 needs it for example. And http4s uses some of those features, so it kind of needs JDK 17 too to "fully exercise" its tests 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to deploy applications to the latest LTS, which is 17.

I generally prefer to support the earliest thing that works in libraries, which is generally 8. Getting past 8 is an unusually hard Java upgrade. But with active support ending a few days ago, I'm done exerting myself to get below 11.

I don't know whether this template is more for apps or libraries, and it may be that we want the devshell JDK to be different from the release JDK and/or the CI set of JDKs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@valencik and I discussed a bit on Discord. I think it makes sense to keep the devshell default in line with the sbt-typelevel default for CI.

In sbt-typelevel 0.5.0 we'll set the tlJdkRelease flag to 8 by default. At that point, we can update both the devshell and CI to JDK 17 as suggested in typelevel/sbt-typelevel#215.

Copy link
Member

@valencik valencik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is cool.

Took me a bit to upgrade my version on nix to support flakes, but that was mostly me being silly.

In a newly created project nix develop yields

warning: creating lock file '/home/andrew/src/quickstart/flake.lock'
🔨 Welcome to quickstart-shell

[general commands]

  menu      - prints this menu
  metals    - Work-in-progress language server for Scala
  sbt       - A build tool for Scala, Java and more
  scala-cli - Command-line tool to interact with the Scala language

[versions]

  Java - 8u272-b10
  Node - 16.14.0

Happy to merge as is an perhaps bump the jdk version later.

@valencik valencik merged commit 304b8be into typelevel:main Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants