-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathjust.nix
40 lines (38 loc) · 882 Bytes
/
just.nix
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
38
39
40
{
lib,
pkgs,
config,
mkFormatterModule,
...
}:
let
cfg = config.programs.just;
in
{
meta.maintainers = [ "katexochen" ];
imports = [
(mkFormatterModule {
name = "just";
includes = [
"[Jj][Uu][Ss][Tt][Ff][Ii][Ll][Ee]" # 'justfile', case insensitive
".[Jj][Uu][Ss][Tt][Ff][Ii][Ll][Ee]" # '.justfile', case insensitive
"*.[Jj][Uu][Ss][Tt]" # '.just' module, case insensitive
"*.[Jj][Uu][Ss][Tt][Ff][Ii][Ll][Ee]" # '.justfile' module, case insensitive
];
})
];
config = lib.mkIf cfg.enable {
settings.formatter.just = {
command = pkgs.bash;
options = [
"-euc"
''
for f in "$@"; do
${lib.getExe cfg.package} --fmt --unstable --justfile "$f"
done
''
"--" # bash swallows the second argument when using -c
];
};
};
}