Skip to content

Commit 704ea06

Browse files
template: add java project
1 parent 639088a commit 704ea06

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed

flake.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
'';
2222
buildInputs = with pkgs; [
2323
editorconfig-checker
24+
25+
# go
2426
go
27+
28+
# java
29+
jdk
30+
maven
2531
];
2632
};
2733
}
@@ -32,6 +38,10 @@
3238
path = ./template/go;
3339
description = "Setup Go Project";
3440
};
41+
java = {
42+
path = ./template/java;
43+
description = "Setup Java Project";
44+
};
3545
};
3646
};
3747
}

template/java/.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; https://editorconfig.org
2+
root = true
3+
4+
; default configuration
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
indent_style = unset
11+
12+
[{*.nix,flake.lock}]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.{yml,yaml,xml}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.md]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[*.java]
25+
indent_style = space
26+
indent_size = 4

template/java/.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: main
2+
on:
3+
pull_request:
4+
branches: [main]
5+
push:
6+
branches: [main]
7+
env:
8+
CI_NIX_STORE: ~/nix
9+
CI_NIX_FLAKE: .#default
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Setup Nix
15+
uses: cachix/install-nix-action@v26
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Cache Nix
19+
uses: actions/cache@v4
20+
with:
21+
path: ${{ env.CI_NIX_STORE }}
22+
key: ${{ runner.os }}-nix-${{ hashFiles('flake.nix', 'flake.lock') }}
23+
- name: Lint
24+
run: |
25+
nix --store ${{ env.CI_NIX_STORE }} \
26+
develop ${{ env.CI_NIX_FLAKE }} --command \
27+
editorconfig-checker && echo "ok"

template/java/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Java Project

template/java/flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/java/flake.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
description = "Java Project";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
9+
in
10+
{
11+
devShells = forAllSystems (system:
12+
let
13+
pkgs = nixpkgs.legacyPackages.${system};
14+
in
15+
{
16+
default = pkgs.mkShell {
17+
name = "java-project";
18+
shellHook = ''
19+
git config pull.rebase true
20+
${pkgs.neo-cowsay}/bin/cowsay -f sage "Java Project"
21+
'';
22+
buildInputs = with pkgs; [
23+
editorconfig-checker
24+
jdk
25+
maven
26+
];
27+
};
28+
}
29+
);
30+
};
31+
}

0 commit comments

Comments
 (0)