Add Java environment
This commit is contained in:
parent
4504c0f122
commit
58ace59505
|
@ -10,6 +10,9 @@ nix flake init --template github:the-nix-way/dev-templates#go_1_17
|
|||
# Go 1.18
|
||||
nix flake init --template github:the-nix-way/dev-templates#go_1_18
|
||||
|
||||
# Java
|
||||
nix flake init --template github:the-nix-way/dev-templates#java
|
||||
|
||||
# Node.js
|
||||
nix flake init --template github:the-nix-way/dev-templates#node
|
||||
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
description = "Go 1.18 development environment";
|
||||
};
|
||||
|
||||
java = {
|
||||
path = ./java;
|
||||
description = "Java development environment";
|
||||
};
|
||||
|
||||
node = {
|
||||
path = ./node;
|
||||
description = "Node.js development environment";
|
||||
|
|
1
java/.envrc
Normal file
1
java/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake .
|
42
java/flake.lock
Normal file
42
java/flake.lock
Normal 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
|
||||
}
|
33
java/flake.nix
Normal file
33
java/flake.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
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
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
inherit (pkgs) mkShell;
|
||||
|
||||
java = pkgs.jdk17;
|
||||
|
||||
buildTools = with pkgs; [ ant gradle maven ];
|
||||
in {
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
java
|
||||
] ++ buildTools;
|
||||
|
||||
shellHook = ''
|
||||
${java}/bin/java -version
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
nodejs = pkgs.nodejs;
|
||||
pnpm = pkgs.nodePackages.pnpm;
|
||||
yarn = pkgs.yarn;
|
||||
|
||||
in {
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
|
||||
helpers = with pkgs; [ pkg-config ];
|
||||
|
||||
inherit (pkgs) mkShell;
|
||||
inherit (pkgs.lib) optionals;
|
||||
inherit (pkgs.stdenv) isDarwin;
|
||||
|
@ -30,8 +32,7 @@
|
|||
default = mkShell {
|
||||
nativeBuildInputs = [
|
||||
rust
|
||||
pkgs.pkg-config
|
||||
];
|
||||
] ++ helpers;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
openssl
|
||||
|
@ -39,8 +40,7 @@
|
|||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Entering Rust env"
|
||||
echo "Running `${rust}/bin/cargo --version`"
|
||||
${rust}/bin/cargo --version
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "`${zigPkg}/bin/zig version`"
|
||||
${zigPkg}/bin/zig version
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue