Add Scala environment

This commit is contained in:
Luc Perkins 2022-07-28 23:54:27 +02:00
parent 58ace59505
commit 7a7d428131
No known key found for this signature in database
GPG key ID: 4F102D0C16E232F2
10 changed files with 107 additions and 13 deletions

View file

@ -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
```

View file

@ -33,7 +33,12 @@
description = "Rust development environment";
};
zip = {
scala = {
path = ./scala;
description = "Scala development environment";
};
zig = {
path = ./zig;
description = "Zig development environment";
};

View file

@ -16,7 +16,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
gleamPkg
];

View file

@ -19,7 +19,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
java
] ++ buildTools;

View file

@ -19,7 +19,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
nodejs
pnpm
(yarn.override { inherit nodejs; })

View file

@ -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;
@ -30,15 +30,10 @@
devShells = {
default = mkShell {
nativeBuildInputs = [
buildInputs = [
rust
] ++ helpers;
buildInputs = with pkgs; [
openssl
pkgconfig
];
shellHook = ''
${rust}/bin/cargo --version
'';

1
scala/.envrc Normal file
View file

@ -0,0 +1 @@
use flake .

42
scala/flake.lock Normal file
View file

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1659041591,
"narHash": "sha256-kKoy3tDZl3w0GuVlvJ6W/ERGRqeXy2+IGXL9g1a3F68=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ab0794b1ae2756411d176dd5b82843a4ae56fe6e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

48
scala/flake.nix Normal file
View file

@ -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
'';
};
};
}
);
}

View file

@ -16,7 +16,7 @@
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = [
buildInputs = [
zigPkg
];