mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2025-11-05 09:38:07 +08:00
move treefmt to tests flake
this way we don't polute our consumers flake.lock with treefmt
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v31
|
||||
- run: nix fmt .
|
||||
- run: cd tests && nix fmt .. -- --fail-on-change
|
||||
tests:
|
||||
needs: nixfmt
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
43
flake.lock
generated
43
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1748995760,
|
||||
"narHash": "sha256-f6UIyqm6JZs45pG667YdHOFYgDt+gvxQvt32ZLBp1h4=",
|
||||
"lastModified": 1751290770,
|
||||
"narHash": "sha256-u4s8yKAqTzPGY3vTcDyAIet11uXaNCM//93/0O0NlbA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "26a54a5886c238b5df6f1e9ba0aa713434d73f06",
|
||||
"rev": "0620a50e9a847851bf802c59a4202552ed79b821",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -16,44 +16,9 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1747958103,
|
||||
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1748243702,
|
||||
"narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
27
flake.nix
27
flake.nix
@@ -1,34 +1,9 @@
|
||||
{
|
||||
description = "nixos-hardware";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ ... }:
|
||||
{
|
||||
nixpkgs,
|
||||
self,
|
||||
treefmt-nix,
|
||||
}:
|
||||
let
|
||||
systems = [
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"x86_64-linux"
|
||||
];
|
||||
forEachSystem =
|
||||
function: nixpkgs.lib.genAttrs (systems) (system: function nixpkgs.legacyPackages.${system});
|
||||
|
||||
treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
|
||||
in
|
||||
{
|
||||
checks = forEachSystem (pkgs: {
|
||||
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
||||
});
|
||||
formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
|
||||
23
tests/flake.lock
generated
23
tests/flake.lock
generated
@@ -74,7 +74,28 @@
|
||||
"flake-parts": "flake-parts",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixos-stable": "nixos-stable",
|
||||
"nixos-unstable-small": "nixos-unstable-small"
|
||||
"nixos-unstable-small": "nixos-unstable-small",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixos-unstable-small"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750931469,
|
||||
"narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,11 +8,16 @@
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-parts.inputs.nixpkgs-lib.follows = "nixos-unstable-small";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixos-unstable-small";
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
systems = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
@@ -85,6 +90,24 @@
|
||||
in
|
||||
{
|
||||
_module.args.pkgs = nixpkgsUnstable;
|
||||
|
||||
treefmt = {
|
||||
projectRootFile = "COPYING";
|
||||
programs = {
|
||||
deadnix = {
|
||||
enable = true;
|
||||
no-lambda-pattern-names = true;
|
||||
};
|
||||
nixfmt = {
|
||||
enable = true;
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
on-unmatched = "info";
|
||||
};
|
||||
};
|
||||
|
||||
checks =
|
||||
checksForNixpkgs "nixos-unstable" nixpkgsUnstable
|
||||
// checksForNixpkgs "nixos-stable" nixpkgsStable;
|
||||
|
||||
19
treefmt.nix
19
treefmt.nix
@@ -1,19 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
programs = {
|
||||
deadnix = {
|
||||
enable = true;
|
||||
no-lambda-pattern-names = true;
|
||||
};
|
||||
nixfmt = {
|
||||
enable = true;
|
||||
package = pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
};
|
||||
|
||||
settings = {
|
||||
on-unmatched = "info";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user