Merge pull request #1521 from NixOS/add-git-blame-ignore-revs

Add git blame ignore revs
This commit is contained in:
Jörg Thalheim
2025-07-01 18:18:26 +00:00
committed by GitHub
8 changed files with 95 additions and 93 deletions

12
.git-blame-ignore-revs Normal file
View File

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

View File

@@ -4,10 +4,18 @@ on:
push: push:
branches: branches:
- master - master
merge_group:
jobs: jobs:
tests: nixfmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31 - uses: cachix/install-nix-action@v31
- run: nix run ./tests#run . - run: cd tests && nix fmt .. -- --fail-on-change
tests:
needs: nixfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- run: nix run ./tests#run .

43
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1748995760, "lastModified": 1751290770,
"narHash": "sha256-f6UIyqm6JZs45pG667YdHOFYgDt+gvxQvt32ZLBp1h4=", "narHash": "sha256-u4s8yKAqTzPGY3vTcDyAIet11uXaNCM//93/0O0NlbA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "26a54a5886c238b5df6f1e9ba0aa713434d73f06", "rev": "0620a50e9a847851bf802c59a4202552ed79b821",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -16,44 +16,9 @@
"type": "github" "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": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "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"
} }
} }
}, },

View File

@@ -1,34 +1,9 @@
{ {
description = "nixos-hardware"; description = "nixos-hardware";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = 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 = nixosModules =
let let

16
scripts/update-tests-hash Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Helper script to update the tests flake hash
set -euo pipefail
# Go to the root of the repository
cd "$(dirname "$0")/.."
echo "Updating tests.narHash..." >&2
# Update the flake lock file
nix --extra-experimental-features 'flakes nix-command' flake lock ./tests
# Generate the hash
nix --extra-experimental-features 'flakes nix-command' hash path ./tests > ./tests.narHash
echo "Hash updated successfully: $(cat tests.narHash)"

33
tests/flake.lock generated
View File

@@ -37,16 +37,16 @@
}, },
"nixos-stable": { "nixos-stable": {
"locked": { "locked": {
"lastModified": 1746957726, "lastModified": 1751211869,
"narHash": "sha256-k9ut1LSfHCr0AW82ttEQzXVCqmyWVA5+SHJkS5ID/Jo=", "narHash": "sha256-1Cu92i1KSPbhPCKxoiVG5qnoRiKTgR5CcGSRyLpOd7Y=",
"ref": "nixos-24.11", "ref": "nixos-25.05",
"rev": "a39ed32a651fdee6842ec930761e31d1f242cb94", "rev": "b43c397f6c213918d6cfe6e3550abfe79b5d1c51",
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "https://github.com/NixOS/nixpkgs" "url": "https://github.com/NixOS/nixpkgs"
}, },
"original": { "original": {
"ref": "nixos-24.11", "ref": "nixos-25.05",
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "https://github.com/NixOS/nixpkgs" "url": "https://github.com/NixOS/nixpkgs"
@@ -74,7 +74,28 @@
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-stable": "nixos-stable", "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"
} }
} }
}, },

View File

@@ -3,16 +3,21 @@
inputs = { inputs = {
nixos-unstable-small.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-unstable-small"; nixos-unstable-small.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-unstable-small";
nixos-stable.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-24.11"; nixos-stable.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-25.05";
# override in the test # override in the test
nixos-hardware.url = "github:NixOS/nixos-hardware"; nixos-hardware.url = "github:NixOS/nixos-hardware";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixos-unstable-small"; 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 = outputs =
inputs@{ flake-parts, ... }: inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
];
systems = [ systems = [
"aarch64-linux" "aarch64-linux"
"x86_64-linux" "x86_64-linux"
@@ -85,6 +90,25 @@
in in
{ {
_module.args.pkgs = nixpkgsUnstable; _module.args.pkgs = nixpkgsUnstable;
treefmt = {
flakeCheck = pkgs.hostPlatform.system != "riscv64-linux";
projectRootFile = "COPYING";
programs = {
deadnix = {
enable = true;
no-lambda-pattern-names = true;
};
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
};
settings = {
on-unmatched = "info";
};
};
checks = checks =
checksForNixpkgs "nixos-unstable" nixpkgsUnstable checksForNixpkgs "nixos-unstable" nixpkgsUnstable
// checksForNixpkgs "nixos-stable" nixpkgsStable; // checksForNixpkgs "nixos-stable" nixpkgsStable;

View File

@@ -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";
};
}