mirror of
https://github.com/mjallen18/snowfall-lib.git
synced 2026-04-18 09:05:58 -05:00
chore(fmt): wire nix fmt to treefmt
Use treefmt-nix with nixfmt, statix, and deadnix so nix fmt applies formatting and auto-fixes in one pass.
This commit is contained in:
24
flake.lock
generated
24
flake.lock
generated
@@ -56,7 +56,8 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils-plus": "flake-utils-plus",
|
"flake-utils-plus": "flake-utils-plus",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
@@ -73,6 +74,27 @@
|
|||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1770228511,
|
||||||
|
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|||||||
33
flake.nix
33
flake.nix
@@ -4,6 +4,10 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/master";
|
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/master";
|
||||||
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix/main";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
@@ -15,6 +19,28 @@
|
|||||||
core-inputs = inputs // {
|
core-inputs = inputs // {
|
||||||
src = self;
|
src = self;
|
||||||
};
|
};
|
||||||
|
systems = inputs.nixpkgs.lib.systems.flakeExposed;
|
||||||
|
inherit (inputs.flake-utils-plus.lib) eachSystemMap;
|
||||||
|
treefmtEval = eachSystemMap systems (
|
||||||
|
system:
|
||||||
|
inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} {
|
||||||
|
projectRootFile = "flake.nix";
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
deadnix = {
|
||||||
|
enable = true;
|
||||||
|
no-lambda-arg = false;
|
||||||
|
no-lambda-pattern-names = false;
|
||||||
|
no-underscore = false;
|
||||||
|
};
|
||||||
|
nixfmt.enable = true;
|
||||||
|
statix = {
|
||||||
|
enable = true;
|
||||||
|
disabled-lints = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
# Create the library, extending the nixpkgs library and merging
|
# Create the library, extending the nixpkgs library and merging
|
||||||
# libraries from other inputs to make them available like
|
# libraries from other inputs to make them available like
|
||||||
@@ -59,12 +85,7 @@
|
|||||||
user = ./modules/home/user/default.nix;
|
user = ./modules/home/user/default.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = {
|
formatter = eachSystemMap systems (system: treefmtEval.${system}.config.build.wrapper);
|
||||||
x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
|
|
||||||
aarch64-linux = inputs.nixpkgs.legacyPackages.aarch64-linux.nixfmt-tree;
|
|
||||||
x86_64-darwin = inputs.nixpkgs.legacyPackages.x86_64-darwin.nixfmt-tree;
|
|
||||||
aarch64-darwin = inputs.nixpkgs.legacyPackages.aarch64-darwin.nixfmt-tree;
|
|
||||||
};
|
|
||||||
|
|
||||||
snowfall = rec {
|
snowfall = rec {
|
||||||
raw-config = config;
|
raw-config = config;
|
||||||
|
|||||||
Reference in New Issue
Block a user