-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
42 lines (38 loc) · 1.31 KB
/
flake.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
41
42
{
description = "Flake for valenix: a vale config with all the styles";
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
styles = builtins.attrNames (builtins.readDir ./styles);
all_styles =
"alex, Google, Vale, Microsoft, proselint, Readability, Vocab, write-good";
config = style:
pkgs.writeTextFile {
name = "vale.ini";
text = ''
StylesPath = ${./styles}
MinAlertLevel = suggestion
Vocab = Base
[*]
BasedOnStyles = ${style}
'';
executable = false;
};
valenix_style = style: style_name:
let config_style = config style;
in pkgs.writeScriptBin "valenix_${style_name}" ''
#!${pkgs.stdenv.shell}
${pkgs.vale}/bin/vale --config=${config_style} $@
'';
valenix = valenix_style all_styles "all";
valenix_versions = builtins.listToAttrs (builtins.map (style: {
name = "valenix_${style}";
value = valenix_style style style;
}) styles);
in {
packages.${system} = valenix_versions // { inherit valenix; };
defaultPackage.${system} = valenix;
};
}