Add treefmt-nix with nixpkgs-fmt for formatting

cephiroth
Yoann Beaugnon 2024-02-03 19:08:54 +01:00
parent 1c053fcbd3
commit b31197716e
No known key found for this signature in database
GPG Key ID: C193D75AB98ADD23
2 changed files with 33 additions and 2 deletions

View File

@ -55,7 +55,28 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1706462057,
"narHash": "sha256-7dG1D4iqqt0bEbBqUWk6lZiSqqwwAO0Hd1L5opVyhNM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "c6153c2a3ff4c38d231e3ae99af29b87f1df5901",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
} }
} }
}, },

View File

@ -4,16 +4,26 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix"; # Formatter
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs @ { self, nixpkgs, flake-parts, ... }: outputs = inputs @ { self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
];
systems = [ "x86_64-linux" ]; systems = [ "x86_64-linux" ];
flake = { }; flake = { };
perSystem = { config, ... }: { }; perSystem = { config, ... }: {
treefmt = {
projectRootFile = "flake.nix";
programs.nixpkgs-fmt.enable = true;
};
};
}; };
} }