Skip to content

Commit f49bb3b

Browse files
authored
Merge pull request #1521 from NixOS/add-git-blame-ignore-revs
Add git blame ignore revs
2 parents c26dd9b + e8bd6a4 commit f49bb3b

File tree

8 files changed

+94
-92
lines changed

8 files changed

+94
-92
lines changed

.git-blame-ignore-revs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file contains commits that should be ignored by git blame
2+
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-file
3+
# and https://github.com/NixOS/nixpkgs/blob/master/.git-blame-ignore-revs for more info
4+
5+
# To enable this in your local repository, run:
6+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
7+
8+
# For rebasing PRs, commits marked with !autorebase will be automatically
9+
# reapplied by the auto-rebase script
10+
11+
# nixfmt-rfc-style formatting
12+
51e51e601448705c0d2f92ef90ec7b680123077c #!autorebase cd tests && nix fmt ..

.github/workflows/test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ on:
44
push:
55
branches:
66
- master
7+
merge_group:
78
jobs:
9+
nixfmt:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: cachix/install-nix-action@v31
14+
- run: cd tests && nix fmt .. -- --fail-on-change
815
tests:
16+
needs: nixfmt
917
runs-on: ubuntu-latest
1018
steps:
1119
- uses: actions/checkout@v4
1220
- uses: cachix/install-nix-action@v31
13-
- run: nix run ./tests#run .
21+
- run: nix run ./tests#run .

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

scripts/update-tests-hash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# Helper script to update the tests flake hash
3+
set -euo pipefail
4+
5+
# Go to the root of the repository
6+
cd "$(dirname "$0")/.."
7+
8+
echo "Updating tests.narHash..." >&2
9+
10+
# Update the flake lock file
11+
nix --extra-experimental-features 'flakes nix-command' flake lock ./tests
12+
13+
# Generate the hash
14+
nix --extra-experimental-features 'flakes nix-command' hash path ./tests > ./tests.narHash
15+
16+
echo "Hash updated successfully: $(cat tests.narHash)"

tests/flake.lock

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

tests/flake.nix

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33

44
inputs = {
55
nixos-unstable-small.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-unstable-small";
6-
nixos-stable.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-24.11";
6+
nixos-stable.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-25.05";
77
# override in the test
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,25 @@
8590
in
8691
{
8792
_module.args.pkgs = nixpkgsUnstable;
93+
94+
treefmt = {
95+
flakeCheck = pkgs.hostPlatform.system != "riscv64-linux";
96+
projectRootFile = "COPYING";
97+
programs = {
98+
deadnix = {
99+
enable = true;
100+
no-lambda-pattern-names = true;
101+
};
102+
nixfmt = {
103+
enable = true;
104+
package = pkgs.nixfmt-rfc-style;
105+
};
106+
};
107+
settings = {
108+
on-unmatched = "info";
109+
};
110+
};
111+
88112
checks =
89113
checksForNixpkgs "nixos-unstable" nixpkgsUnstable
90114
// checksForNixpkgs "nixos-stable" nixpkgsStable;

treefmt.nix

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

0 commit comments

Comments
 (0)