Using nix flakes for developer shell (#14888)

This commit is contained in:
msosnicki 2023-03-24 15:32:22 +01:00 committed by GitHub
parent f5e427ad52
commit 41d691334a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

1
.gitignore vendored
View File

@ -35,6 +35,7 @@ packages/
nbproject/
nbactions.xml
nb-configuration.xml
.direnv/
.settings

View File

@ -263,6 +263,20 @@ If you don't have maven installed, you may directly use the included [maven wrap
./mvnw clean install
```
#### Nix users
If you're a nix user, you can enter OpenAPI Generator shell, by typing:
```sh
nix develop
```
It will enter a shell with Java 8 and Maven installed.
Direnv supports automatically loading of the nix developer shell, so if you're using direnv too, type:
```sh
direnv allow
```
and have `java` and `mvn` set up with correct versions each time you enter project directory.
The default build contains minimal static analysis (via CheckStyle). To run your build with PMD and Spotbugs, use the `static-analysis` profile:
```sh

42
flake.lock generated Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1678083093,
"narHash": "sha256-eTkS9GcdSAYA3cE9zCAAs9wY3+oM2zT45ydIkAcEFFQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "684306b246d05168e42425a3610df7e2c4d51fcd",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View File

@ -0,0 +1,23 @@
{
description = "OpenAPI generator nix flake";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell
{
buildInputs = with pkgs;[
jdk8
maven
];
};
}
);
}