2024-10-01 05:59:38 +02:00
|
|
|
let
|
2025-05-31 19:09:58 +02:00
|
|
|
pinned = (builtins.fromJSON (builtins.readFile ./pinned.json)).pins;
|
2024-10-01 05:59:38 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
system ? builtins.currentSystem,
|
|
|
|
|
|
|
|
nixpkgs ? null,
|
workflows/eval: test all available versions
With this change, we start running Eval on all available Lix and Nix
versions. Because this requires a lot of resources, this complete test
is only run when `ci/pinned.json` is updated.
The resulting outpaths are checked for consistency with the target
branch. A difference will cause the `report` job to fail, thus blocking
the merge, ensuring Eval consistency for Nixpkgs across different
versions.
This implements a kind of "ratchet style" check: Since we originally
confirmed that the versions currently in Nixpkgs at the time of this
commit match Eval behavior of Nix 2.3, we can ensure consistency with
Nix 2.3 down the road, even without testing for it explicitly.
There had been one regression in Eval consistency for Nix between 2.18
and 2.24 - two tests in `tests.devShellTools` produce different results
between Lix 2.91+ (which was forked from Nix 2.18) and Nix 2.24+. I
assume it's unlikely that such a change would be "fixed" by now, thus I
added an exception for these.
As a bonus, we also present the total time in seconds it takes for Eval
to complete for every tested version in a summary table. This allows us
to easily see performance improvements for Eval due to version updates.
At this stage, this time only includes the "outpaths" step of Eval, but
not the generation of attrpaths beforehand.
2025-07-23 13:28:44 +02:00
|
|
|
nixPath ? "nixVersions.latest",
|
2024-10-01 05:59:38 +02:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
nixpkgs' =
|
|
|
|
if nixpkgs == null then
|
|
|
|
fetchTarball {
|
2025-05-31 19:09:58 +02:00
|
|
|
inherit (pinned.nixpkgs) url;
|
|
|
|
sha256 = pinned.nixpkgs.hash;
|
2024-10-01 05:59:38 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
nixpkgs;
|
|
|
|
|
2025-07-24 16:08:14 +02:00
|
|
|
pkgs = import nixpkgs' { inherit system; };
|
2025-02-12 19:58:29 +01:00
|
|
|
|
|
|
|
fmt =
|
|
|
|
let
|
|
|
|
treefmtNixSrc = fetchTarball {
|
2025-05-31 19:09:58 +02:00
|
|
|
inherit (pinned.treefmt-nix) url;
|
|
|
|
sha256 = pinned.treefmt-nix.hash;
|
2025-02-12 19:58:29 +01:00
|
|
|
};
|
|
|
|
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";
|
|
|
|
|
2025-05-11 11:04:30 +02:00
|
|
|
programs.actionlint.enable = true;
|
|
|
|
|
2025-05-09 21:54:12 +02:00
|
|
|
programs.keep-sorted.enable = true;
|
|
|
|
|
2025-07-14 16:24:06 +02:00
|
|
|
# This uses nixfmt underneath,
|
2025-02-12 19:58:29 +01:00
|
|
|
# the default formatter for Nix code.
|
|
|
|
# See https://github.com/NixOS/nixfmt
|
|
|
|
programs.nixfmt.enable = true;
|
2025-05-09 20:56:58 +02:00
|
|
|
|
2025-06-11 16:36:07 +02:00
|
|
|
programs.yamlfmt = {
|
|
|
|
enable = true;
|
|
|
|
settings.formatter = {
|
|
|
|
retain_line_breaks = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
settings.formatter.yamlfmt.excludes = [
|
|
|
|
# Breaks helm templating
|
|
|
|
"nixos/tests/k3s/k3s-test-chart/templates/*"
|
|
|
|
# Aligns comments with whitespace
|
|
|
|
"pkgs/development/haskell-modules/configuration-hackage2nix/main.yaml"
|
|
|
|
# TODO: Fix formatting for auto-generated file
|
|
|
|
"pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml"
|
|
|
|
];
|
|
|
|
|
2025-05-09 20:56:58 +02:00
|
|
|
settings.formatter.editorconfig-checker = {
|
|
|
|
command = "${pkgs.lib.getExe pkgs.editorconfig-checker}";
|
|
|
|
options = [ "-disable-indent-size" ];
|
|
|
|
includes = [ "*" ];
|
|
|
|
priority = 1;
|
|
|
|
};
|
2025-07-22 16:12:42 +02:00
|
|
|
|
|
|
|
# TODO: Upstream this into treefmt-nix eventually:
|
|
|
|
# https://github.com/numtide/treefmt-nix/issues/387
|
|
|
|
settings.formatter.markdown-code-runner = {
|
|
|
|
command = pkgs.lib.getExe pkgs.markdown-code-runner;
|
|
|
|
options =
|
|
|
|
let
|
|
|
|
config = pkgs.writers.writeTOML "markdown-code-runner-config" {
|
|
|
|
presets.nixfmt = {
|
|
|
|
language = "nix";
|
|
|
|
command = [ (pkgs.lib.getExe pkgs.nixfmt) ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
[ "--config=${config}" ];
|
|
|
|
includes = [ "*.md" ];
|
|
|
|
};
|
2025-02-12 19:58:29 +01:00
|
|
|
};
|
2025-02-12 20:01:58 +01:00
|
|
|
fs = pkgs.lib.fileset;
|
|
|
|
nixFilesSrc = fs.toSource {
|
|
|
|
root = ../.;
|
2025-05-13 08:24:25 +02:00
|
|
|
fileset = fs.difference ../. (fs.maybeMissing ../.git);
|
2025-02-12 20:01:58 +01:00
|
|
|
};
|
2025-02-12 19:58:29 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
shell = treefmtEval.config.build.devShell;
|
2025-02-12 20:00:04 +01:00
|
|
|
pkg = treefmtEval.config.build.wrapper;
|
2025-02-12 20:01:58 +01:00
|
|
|
check = treefmtEval.config.build.check nixFilesSrc;
|
2025-02-12 19:58:29 +01:00
|
|
|
};
|
|
|
|
|
2024-10-01 05:59:38 +02:00
|
|
|
in
|
2025-07-22 14:12:49 +02:00
|
|
|
rec {
|
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 { };
|
2025-06-10 11:46:19 -07:00
|
|
|
|
|
|
|
# FIXME(lf-): it might be useful to test other Nix implementations
|
|
|
|
# (nixVersions.stable and Lix) here somehow at some point to ensure we don't
|
|
|
|
# have eval divergence.
|
|
|
|
eval = pkgs.callPackage ./eval {
|
workflows/eval: test all available versions
With this change, we start running Eval on all available Lix and Nix
versions. Because this requires a lot of resources, this complete test
is only run when `ci/pinned.json` is updated.
The resulting outpaths are checked for consistency with the target
branch. A difference will cause the `report` job to fail, thus blocking
the merge, ensuring Eval consistency for Nixpkgs across different
versions.
This implements a kind of "ratchet style" check: Since we originally
confirmed that the versions currently in Nixpkgs at the time of this
commit match Eval behavior of Nix 2.3, we can ensure consistency with
Nix 2.3 down the road, even without testing for it explicitly.
There had been one regression in Eval consistency for Nix between 2.18
and 2.24 - two tests in `tests.devShellTools` produce different results
between Lix 2.91+ (which was forked from Nix 2.18) and Nix 2.24+. I
assume it's unlikely that such a change would be "fixed" by now, thus I
added an exception for these.
As a bonus, we also present the total time in seconds it takes for Eval
to complete for every tested version in a summary table. This allows us
to easily see performance improvements for Eval due to version updates.
At this stage, this time only includes the "outpaths" step of Eval, but
not the generation of attrpaths beforehand.
2025-07-23 13:28:44 +02:00
|
|
|
nix = pkgs.lib.getAttrFromPath (pkgs.lib.splitString "." nixPath) pkgs;
|
2025-06-10 11:46:19 -07:00
|
|
|
};
|
2025-05-05 19:26:47 +02:00
|
|
|
|
|
|
|
# CI jobs
|
|
|
|
lib-tests = import ../lib/tests/release.nix { inherit pkgs; };
|
2025-05-05 21:28:41 +02:00
|
|
|
manual-nixos = (import ../nixos/release.nix { }).manual.${system} or null;
|
2025-08-10 14:44:39 +02:00
|
|
|
manual-nixpkgs = (import ../doc { inherit pkgs; });
|
|
|
|
manual-nixpkgs-tests = (import ../doc { inherit pkgs; }).tests;
|
2025-05-24 15:01:44 +02:00
|
|
|
nixpkgs-vet = pkgs.callPackage ./nixpkgs-vet.nix { };
|
2025-05-10 21:55:05 +02:00
|
|
|
parse = pkgs.lib.recurseIntoAttrs {
|
|
|
|
latest = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.latest; };
|
2025-05-10 21:56:40 +02:00
|
|
|
lix = pkgs.callPackage ./parse.nix { nix = pkgs.lix; };
|
2025-07-24 19:08:08 +02:00
|
|
|
nix_2_24 = pkgs.callPackage ./parse.nix { nix = pkgs.nixVersions.nix_2_24; };
|
2025-05-10 21:55:05 +02:00
|
|
|
};
|
2025-05-06 21:39:59 +02:00
|
|
|
shell = import ../shell.nix { inherit nixpkgs system; };
|
2025-07-22 14:12:49 +02:00
|
|
|
tarball = import ../pkgs/top-level/make-tarball.nix {
|
|
|
|
# Mirrored from top-level release.nix:
|
|
|
|
nixpkgs = {
|
|
|
|
outPath = pkgs.lib.cleanSource ../.;
|
|
|
|
revCount = 1234;
|
|
|
|
shortRev = "abcdef";
|
|
|
|
revision = "0000000000000000000000000000000000000000";
|
|
|
|
};
|
|
|
|
officialRelease = false;
|
|
|
|
inherit pkgs lib-tests;
|
2025-08-05 11:16:37 +02:00
|
|
|
nix = pkgs.nixVersions.latest;
|
2025-07-22 14:12:49 +02:00
|
|
|
};
|
2024-10-01 05:59:38 +02:00
|
|
|
}
|