Skip to content

Commit a7600ce

Browse files
committed
move treefmt to tests flake
this way we don't polute our consumers flake.lock with treefmt
1 parent fe49c32 commit a7600ce

File tree

6 files changed

+51
-86
lines changed

6 files changed

+51
-86
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- uses: cachix/install-nix-action@v31
13-
- run: nix fmt .
13+
- run: cd tests && nix fmt .. -- --fail-on-change
1414
tests:
1515
needs: nixfmt
1616
runs-on: ubuntu-latest

flake.lock

Lines changed: 4 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
{
22
description = "nixos-hardware";
33

4-
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
6-
treefmt-nix.url = "github:numtide/treefmt-nix";
7-
};
8-
94
outputs =
5+
{ ... }:
106
{
11-
nixpkgs,
12-
self,
13-
treefmt-nix,
14-
}:
15-
let
16-
systems = [
17-
"aarch64-darwin"
18-
"aarch64-linux"
19-
"x86_64-darwin"
20-
"x86_64-linux"
21-
];
22-
forEachSystem =
23-
function: nixpkgs.lib.genAttrs (systems) (system: function nixpkgs.legacyPackages.${system});
24-
25-
treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
26-
in
27-
{
28-
checks = forEachSystem (pkgs: {
29-
formatting = treefmtEval.${pkgs.system}.config.build.check self;
30-
});
31-
formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
327

338
nixosModules =
349
let

tests/flake.lock

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/flake.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
nixos-hardware.url = "github:NixOS/nixos-hardware";
99
flake-parts.url = "github:hercules-ci/flake-parts";
1010
flake-parts.inputs.nixpkgs-lib.follows = "nixos-unstable-small";
11+
treefmt-nix.url = "github:numtide/treefmt-nix";
12+
treefmt-nix.inputs.nixpkgs.follows = "nixos-unstable-small";
1113
};
1214

1315
outputs =
1416
inputs@{ flake-parts, ... }:
1517
flake-parts.lib.mkFlake { inherit inputs; } {
18+
imports = [
19+
inputs.treefmt-nix.flakeModule
20+
];
1621
systems = [
1722
"aarch64-linux"
1823
"x86_64-linux"
@@ -85,6 +90,24 @@
8590
in
8691
{
8792
_module.args.pkgs = nixpkgsUnstable;
93+
94+
treefmt = {
95+
projectRootFile = "COPYING";
96+
programs = {
97+
deadnix = {
98+
enable = true;
99+
no-lambda-pattern-names = true;
100+
};
101+
nixfmt = {
102+
enable = true;
103+
package = pkgs.nixfmt-rfc-style;
104+
};
105+
};
106+
settings = {
107+
on-unmatched = "info";
108+
};
109+
};
110+
88111
checks =
89112
checksForNixpkgs "nixos-unstable" nixpkgsUnstable
90113
// checksForNixpkgs "nixos-stable" nixpkgsStable;

treefmt.nix

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)