@cryptotaxi247 / infra / commits / c30232e1

add treefmt-nix

Jörg Thalheim committed Aug 17, 2024 at 09:55 UTC c30232e1953d057207c10b3671e0452bdf1087d1
3 files changed +134
flake.lock new
+93
@@ -0,0 +1,93 @@
1 +{
2 + "nodes": {
3 + "flake-parts": {
4 + "inputs": {
5 + "nixpkgs-lib": "nixpkgs-lib"
6 + },
7 + "locked": {
8 + "lastModified": 1722555600,
9 + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
10 + "owner": "hercules-ci",
11 + "repo": "flake-parts",
12 + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
13 + "type": "github"
14 + },
15 + "original": {
16 + "owner": "hercules-ci",
17 + "repo": "flake-parts",
18 + "type": "github"
19 + }
20 + },
21 + "nixpkgs": {
22 + "locked": {
23 + "lastModified": 1723688146,
24 + "narHash": "sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz+NG82pbdg=",
25 + "owner": "NixOS",
26 + "repo": "nixpkgs",
27 + "rev": "c3d4ac725177c030b1e289015989da2ad9d56af0",
28 + "type": "github"
29 + },
30 + "original": {
31 + "owner": "NixOS",
32 + "ref": "nixos-24.05",
33 + "repo": "nixpkgs",
34 + "type": "github"
35 + }
36 + },
37 + "nixpkgs-lib": {
38 + "locked": {
39 + "lastModified": 1722555339,
40 + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
41 + "type": "tarball",
42 + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
43 + },
44 + "original": {
45 + "type": "tarball",
46 + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
47 + }
48 + },
49 + "nixpkgs_2": {
50 + "locked": {
51 + "lastModified": 1723637854,
52 + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=",
53 + "owner": "nixos",
54 + "repo": "nixpkgs",
55 + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9",
56 + "type": "github"
57 + },
58 + "original": {
59 + "owner": "nixos",
60 + "ref": "nixos-unstable",
61 + "repo": "nixpkgs",
62 + "type": "github"
63 + }
64 + },
65 + "root": {
66 + "inputs": {
67 + "flake-parts": "flake-parts",
68 + "nixpkgs": "nixpkgs",
69 + "treefmt-nix": "treefmt-nix"
70 + }
71 + },
72 + "treefmt-nix": {
73 + "inputs": {
74 + "nixpkgs": "nixpkgs_2"
75 + },
76 + "locked": {
77 + "lastModified": 1723808491,
78 + "narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=",
79 + "owner": "numtide",
80 + "repo": "treefmt-nix",
81 + "rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a",
82 + "type": "github"
83 + },
84 + "original": {
85 + "owner": "numtide",
86 + "repo": "treefmt-nix",
87 + "type": "github"
88 + }
89 + }
90 + },
91 + "root": "root",
92 + "version": 7
93 +}
flake.nix new
+20
@@ -0,0 +1,20 @@
1 +{
2 + description = "Nixos org infra";
3 +
4 + inputs = {
5 + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
6 + flake-parts.url = "github:hercules-ci/flake-parts";
7 + treefmt-nix.url = "github:numtide/treefmt-nix";
8 + };
9 + outputs = inputs@{ flake-parts, ... }:
10 + flake-parts.lib.mkFlake { inherit inputs; } {
11 + systems = [
12 + "x86_64-linux"
13 + "aarch64-linux"
14 + "x86_64-darwin"
15 + "aarch64-darwin"
16 + ];
17 + imports = [ ./formatter/default.nix ];
18 + };
19 +
20 +}
formatter/default.nix new
+21
@@ -0,0 +1,21 @@
1 +{ inputs, ... }: {
2 + imports = [ inputs.treefmt-nix.flakeModule ];
3 +
4 + perSystem =
5 + { pkgs, ... }:
6 + {
7 + treefmt = {
8 + # Used to find the project root
9 + projectRootFile = ".git/config";
10 +
11 + programs.terraform.enable = true;
12 + programs.deadnix.enable = true;
13 + programs.nixfmt.enable = true;
14 + programs.nixfmt.package = pkgs.nixfmt-rfc-style;
15 + programs.shellcheck.enable = true;
16 +
17 + programs.shfmt.enable = true;
18 + programs.rustfmt.enable = true;
19 + };
20 + };
21 +}