apply nixfmt to tree of flakes #8

Merged
horscchtey merged 2 commits from nonapode/nixfmt into main 2025-11-26 19:35:43 +01:00
3 changed files with 27 additions and 2 deletions
Showing only changes of commit 1b5b697dfb - Show all commits

nix fmt: automatically expose the default nix formatter

Jonas Rabenstein 2025-09-14 23:25:22 +02:00

22
flake.lock generated
View file

@ -1,6 +1,26 @@
{
"nodes": {
"root": {}
"nixpkgs": {
"locked": {
"lastModified": 1763966396,
"narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5ae3b07d8d6527c42f17c876e404993199144b6a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7

View file

@ -1,3 +1,6 @@
{
# only used for nixfmt-tree
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
}

View file

@ -11,7 +11,9 @@ let
convert = attr: value: value self inputs imports;
result = (builtins.mapAttrs convert schema.exports);
in result // { lib = lib // (result.lib or {}); };
in {
formatter = builtins.mapAttrs (_: pkgs: pkgs.nixfmt-tree) inputs.nixpkgs.legacyPackages;
} // result // { lib = lib // (result.lib or {}); };
flake = { imports?{}, exports?{}, base?[] }@schema'old: { ... }@inputs'old: { ... }@imports'old: { ... }@inputs'new: base: let
schema = {