Skip to content

Commit 41d6913

Browse files
authored
Using nix flakes for developer shell (OpenAPITools#14888)
1 parent f5e427a commit 41d6913

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ packages/
3535
nbproject/
3636
nbactions.xml
3737
nb-configuration.xml
38+
.direnv/
3839

3940
.settings
4041

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,20 @@ If you don't have maven installed, you may directly use the included [maven wrap
263263
./mvnw clean install
264264
```
265265

266+
#### Nix users
267+
268+
If you're a nix user, you can enter OpenAPI Generator shell, by typing:
269+
```sh
270+
nix develop
271+
```
272+
It will enter a shell with Java 8 and Maven installed.
273+
274+
Direnv supports automatically loading of the nix developer shell, so if you're using direnv too, type:
275+
```sh
276+
direnv allow
277+
```
278+
and have `java` and `mvn` set up with correct versions each time you enter project directory.
279+
266280
The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the `static-analysis` profile:
267281

268282
```sh

flake.lock

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
description = "OpenAPI generator nix flake";
3+
4+
inputs.nixpkgs.url = "github:nixos/nixpkgs";
5+
inputs.flake-utils.url = "github:numtide/flake-utils";
6+
7+
outputs = { self, nixpkgs, flake-utils, ... }:
8+
flake-utils.lib.eachDefaultSystem (system:
9+
let
10+
pkgs = import nixpkgs { inherit system; };
11+
in
12+
{
13+
devShells.default = pkgs.mkShell
14+
{
15+
buildInputs = with pkgs;[
16+
jdk8
17+
maven
18+
];
19+
};
20+
}
21+
);
22+
}
23+

0 commit comments

Comments
 (0)