forked from numtide/treefmt-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogle-java-format.nix
More file actions
37 lines (34 loc) · 809 Bytes
/
google-java-format.nix
File metadata and controls
37 lines (34 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
lib,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.google-java-format;
in
{
meta.maintainers = [ "sebaszv" ];
imports = [
(mkFormatterModule {
name = "google-java-format";
args = [ "--replace" ];
includes = [ "*.java" ];
})
];
options.programs.google-java-format = {
aospStyle = lib.mkOption {
description = ''
Whether to use AOSP (Android Open Source Project) indentation.
In a few words, use 4-space indentation rather than the conventional
2-space indentation width that Google uses.
'';
type = lib.types.bool;
example = true;
default = false;
};
};
config = lib.mkIf cfg.enable {
settings.formatter.google-java-format.options = lib.optional cfg.aospStyle "--aosp";
};
}