-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
109 lines (99 loc) · 2.91 KB
/
flake.nix
File metadata and controls
109 lines (99 loc) · 2.91 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
description = "VSCode extension for treefmt";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devenv.flakeModule
inputs.treefmt-nix.flakeModule
];
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, lib, ... }: {
treefmt = {
# Used to find the project root
projectRootFile = "flake.nix";
programs = {
nixpkgs-fmt.enable = true;
biome = {
enable = true;
excludes = [ "dist/*" "node_modules/*" ];
};
mdformat.enable = true;
taplo.enable = true;
yamlfmt.enable = true;
};
settings.formatter = {
taplo = {
options = [
"fmt"
"-oalign_entries=true"
"-oalign_comments=true"
"-oarray_trailing_comma=true"
"-oarray_auto_expand=true"
"-oarray_auto_collapse=true"
"-oindent_tables=false"
"-oindent_entries=false"
];
};
yamlfmt = {
options = [
"-formatter"
"indent=2"
"-formatter"
"retain_line_breaks=true"
"-formatter"
"indentless_arrays=true"
"-formatter"
"eof_newline=true"
"-formatter"
"scan_folded_as_literal=true"
];
};
};
};
devenv.shells.default = {
name = "treefmt-vscode";
dotenv = {
enable = true;
filename = ".env.local";
};
languages = {
typescript = {
enable = true;
};
javascript = {
enable = true;
npm.enable = true;
};
};
git-hooks.hooks = {
treefmt = {
package = config.treefmt.build.wrapper;
enable = true;
};
};
packages = with pkgs; [
act
];
};
devenv.shells.ci = {
git-hooks.hooks = {
treefmt = {
package = config.treefmt.build.wrapper;
enable = true;
};
};
};
};
};
}