about summary refs log tree commit diff
path: root/pkgs/applications/editors/vscode/extensions/kamadorueda.alejandra/default.nix
blob: a9c07334c7b0b8695d9aa4ad6a48c9e40bf8288a (plain) (blame)
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
{
  alejandra,
  jq,
  lib,
  moreutils,
  vscode-utils,
}:

vscode-utils.buildVscodeMarketplaceExtension {
  mktplcRef = {
    name = "alejandra";
    publisher = "kamadorueda";
    version = "1.0.0";
    hash = "sha256-COlEjKhm8tK5XfOjrpVUDQ7x3JaOLiYoZ4MdwTL8ktk=";
  };
  nativeBuildInputs = [
    jq
    moreutils
  ];
  postInstall = ''
    cd "$out/$installPrefix"

    jq -e '
      .contributes.configuration.properties."alejandra.program".default =
        "${alejandra}/bin/alejandra" |
      .contributes.configurationDefaults."alejandra.program" =
        "${alejandra}/bin/alejandra"
    ' \
    < package.json \
    | sponge package.json
  '';
  meta = {
    description = "Uncompromising Nix Code Formatter";
    homepage = "https://github.com/kamadorueda/alejandra";
    license = lib.licenses.unlicense;
    maintainers = [ lib.maintainers.kamadorueda ];
  };
}