my over complex system configurations
dotfiles.isabelroses.com/
nixos
nix
flake
dotfiles
linux
1{ lib, ... }:
2{
3 perSystem =
4 { pkgs, ... }:
5 {
6 formatter = pkgs.treefmt.withConfig {
7 runtimeInputs = with pkgs; [
8 # keep-sorted start
9 actionlint
10 deadnix
11 keep-sorted
12 nixfmt
13 shellcheck
14 shfmt
15 statix
16 stylua
17 taplo
18 # keep-sorted end
19
20 (writeShellScriptBin "statix-fix" ''
21 for file in "$@"; do
22 ${lib.getExe statix} fix "$file"
23 done
24 '')
25 ];
26
27 settings = {
28 on-unmatched = "info";
29 tree-root-file = "flake.nix";
30
31 excludes = [ "secrets/*" ];
32
33 formatter = {
34 # keep-sorted start block=yes newline_separated=yes
35 actionlint = {
36 command = "actionlint";
37 includes = [
38 ".github/workflows/*.yml"
39 ".github/workflows/*.yaml"
40 ];
41 };
42
43 deadnix = {
44 command = "deadnix";
45 options = [ "--edit" ];
46 includes = [ "*.nix" ];
47 };
48
49 keep-sorted = {
50 command = "keep-sorted";
51 includes = [ "*" ];
52 };
53
54 nixfmt = {
55 command = "nixfmt";
56 includes = [ "*.nix" ];
57 };
58
59 shellcheck = {
60 command = "shellcheck";
61 includes = [
62 "*.sh"
63 "*.bash"
64 # direnv
65 "*.envrc"
66 "*.envrc.*"
67 ];
68 };
69
70 shfmt = {
71 command = "shfmt";
72 options = [
73 "-s"
74 "-w"
75 "-i"
76 "2"
77 ];
78 includes = [
79 "*.sh"
80 "*.bash"
81 # direnv
82 "*.envrc"
83 "*.envrc.*"
84 ];
85 };
86
87 statix = {
88 command = "statix-fix";
89 includes = [ "*.nix" ];
90 };
91
92 stylua = {
93 command = "stylua";
94 includes = [ "*.lua" ];
95 };
96
97 taplo = {
98 command = "taplo";
99 options = "format";
100 includes = [ "*.toml" ];
101 };
102 # keep-sorted end
103 };
104 };
105 };
106 };
107}