2024-10-01 05:59:38 +02:00
|
|
|
let
|
|
|
|
pinnedNixpkgs = builtins.fromJSON (builtins.readFile ./pinned-nixpkgs.json);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
system ? builtins.currentSystem,
|
|
|
|
|
|
|
|
nixpkgs ? null,
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
nixpkgs' =
|
|
|
|
if nixpkgs == null then
|
|
|
|
fetchTarball {
|
|
|
|
url = "https://github.com/NixOS/nixpkgs/archive/${pinnedNixpkgs.rev}.tar.gz";
|
|
|
|
sha256 = pinnedNixpkgs.sha256;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nixpkgs;
|
|
|
|
|
|
|
|
pkgs = import nixpkgs' {
|
|
|
|
inherit system;
|
|
|
|
config = { };
|
|
|
|
overlays = [ ];
|
|
|
|
};
|
2025-02-12 19:58:29 +01:00
|
|
|
|
|
|
|
fmt =
|
|
|
|
let
|
|
|
|
treefmtNixSrc = fetchTarball {
|
|
|
|
# Master at 2025-02-12
|
|
|
|
url = "https://github.com/numtide/treefmt-nix/archive/4f09b473c936d41582dd744e19f34ec27592c5fd.tar.gz";
|
|
|
|
sha256 = "051vh6raskrxw5k6jncm8zbk9fhbzgm1gxpq9gm5xw1b6wgbgcna";
|
|
|
|
};
|
|
|
|
treefmtEval = (import treefmtNixSrc).evalModule pkgs {
|
|
|
|
# Important: The auto-rebase script uses `git filter-branch --tree-filter`,
|
|
|
|
# which creates trees within the Git repository under `.git-rewrite/t`,
|
|
|
|
# notably without having a `.git` themselves.
|
|
|
|
# So if this projectRootFile were the default `.git/config`,
|
|
|
|
# having the auto-rebase script use treefmt on such a tree would make it
|
|
|
|
# format all files in the _parent_ Git tree as well.
|
|
|
|
projectRootFile = ".git-blame-ignore-revs";
|
|
|
|
|
|
|
|
# Be a bit more verbose by default, so we can see progress happening
|
|
|
|
settings.verbose = 1;
|
|
|
|
|
|
|
|
# By default it's info, which is too noisy since we have many unmatched files
|
|
|
|
settings.on-unmatched = "debug";
|
|
|
|
|
|
|
|
# This uses nixfmt-rfc-style underneath,
|
|
|
|
# the default formatter for Nix code.
|
|
|
|
# See https://github.com/NixOS/nixfmt
|
|
|
|
programs.nixfmt.enable = true;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
shell = treefmtEval.config.build.devShell;
|
|
|
|
};
|
|
|
|
|
2024-10-01 05:59:38 +02:00
|
|
|
in
|
|
|
|
{
|
2025-02-12 19:58:29 +01:00
|
|
|
inherit pkgs fmt;
|
2024-10-04 01:49:44 +02:00
|
|
|
requestReviews = pkgs.callPackage ./request-reviews { };
|
2024-10-04 01:50:36 +02:00
|
|
|
codeownersValidator = pkgs.callPackage ./codeowners-validator { };
|
2024-11-14 23:14:20 +01:00
|
|
|
eval = pkgs.callPackage ./eval { };
|
2024-10-01 05:59:38 +02:00
|
|
|
}
|