Skip to content

Commit

Permalink
Add Scala environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins committed Jul 28, 2022
1 parent 58ace59 commit 7a7d428
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 13 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ nix flake init --template github:the-nix-way/dev-templates#node
# Rust
nix flake init --template github:the-nix-way/dev-templates#rust

# Scala
nix flake init --template github:the-nix-way/dev-templates#scala

# Zig
nix flake init --template github:the-nix-way/dev-templates#rust
nix flake init --template github:the-nix-way/dev-templates#zig
```
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
description = "Rust development environment";
};

zip = {
scala = {
path = ./scala;
description = "Scala development environment";
};

zig = {
path = ./zig;
description = "Zig development environment";
};
Expand Down
2 changes: 1 addition & 1 deletion gleam/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
gleamPkg
];

Expand Down
2 changes: 1 addition & 1 deletion java/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
java
] ++ buildTools;

Expand Down
2 changes: 1 addition & 1 deletion node/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
nodejs
pnpm
(yarn.override { inherit nodejs; })
Expand Down
9 changes: 2 additions & 7 deletions rust/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;

helpers = with pkgs; [ pkg-config ];
helpers = with pkgs; [ openssl pkg-config ];

inherit (pkgs) mkShell;
inherit (pkgs.lib) optionals;
Expand All @@ -30,15 +30,10 @@

devShells = {
default = mkShell {
nativeBuildInputs = [
buildInputs = [
rust
] ++ helpers;

buildInputs = with pkgs; [
openssl
pkgconfig
];

shellHook = ''
${rust}/bin/cargo --version
'';
Expand Down
1 change: 1 addition & 0 deletions scala/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .
42 changes: 42 additions & 0 deletions scala/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions scala/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
description = "A Nix-flake-based Java development environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = "jdk17";
jdkPkg = pkgs.${jdk};

config = {
packageOverrides = p: {
sbt = p.sbt.override {
jre = p.${jdk};
};
scala_3 = p.scala_3.override {
jre = p.${jdk};
};
};
};

pkgs = import nixpkgs { inherit config jdk system; };

inherit (pkgs) mkShell;

scala = pkgs.scala_3;

buildTools = with pkgs; [ sbt ];
in {
devShells = {
default = pkgs.mkShell {
buildInputs = [
scala
jdkPkg
] ++ buildTools;

shellHook = ''
${scala}/bin/scala -version
'';
};
};
}
);
}
2 changes: 1 addition & 1 deletion zig/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
zigPkg
];

Expand Down

0 comments on commit 7a7d428

Please sign in to comment.