From a23e7e078516f59bec1f826e9beaab326808bc9d Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Thu, 26 Nov 2026 01:32:40 +0100 Subject: [PATCH 1/8] =?UTF-8?q?rename=20tests/top-level=20=E2=86=92=20test?= =?UTF-8?q?s/integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/xrefcheck.yaml | 4 ++-- src/main.rs | 8 ++++---- tests/{top-level => integration}/aliases/expected | 0 tests/{top-level => integration}/aliases/main/aliases.nix | 0 tests/{top-level => integration}/aliases/main/default.nix | 0 .../aliases/main/pkgs/by-name/fo/foo/package.nix | 0 .../aliases/main/pkgs/top-level/all-packages.nix | 0 .../base-fixed/base/default.nix | 0 .../base-fixed/base/pkgs/by-name/foo | 0 tests/{top-level => integration}/base-fixed/expected | 0 .../base-fixed/main/default.nix | 0 .../base-fixed/main/pkgs/by-name/README.md | 0 .../base-still-broken/base/default.nix | 0 .../base-still-broken/base/pkgs/by-name/foo | 0 .../{top-level => integration}/base-still-broken/expected | 0 .../base-still-broken/main/default.nix | 0 .../base-still-broken/main/pkgs/by-name/bar | 0 tests/{top-level => integration}/broken-autocall/expected | 0 .../broken-autocall/main/default.nix | 0 .../broken-autocall/main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/by-name-failure/expected | 0 .../by-name-failure/main/default.nix | 0 .../by-name-failure/main/pkgs/by-name/fo/foo/package.nix | 0 .../{top-level => integration}/by-name-numprefix/expected | 0 .../by-name-numprefix/main/default.nix | 0 .../main/pkgs/by-name/10/10foo/package.nix | 0 .../callPackage-syntax/expected | 0 .../callPackage-syntax/main/default.nix | 0 .../callPackage-syntax/main/pkgs/by-name/README.md | 0 .../main/pkgs/top-level/all-packages.nix | 0 .../dont-cargo-system-libs-new-false/expected | 0 .../dont-cargo-system-libs-new-false/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../dont-cargo-system-libs-new-true/expected | 0 .../dont-cargo-system-libs-new-true/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../dont-cargo-system-libs-new-unset/expected | 0 .../dont-cargo-system-libs-new-unset/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/empty-base/expected | 0 .../empty-base/main/default.nix | 0 .../empty-base/main/pkgs/by-name/README.md | 0 tests/{top-level => integration}/incorrect-shard/expected | 0 .../incorrect-shard/main/default.nix | 0 .../incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix | 0 .../invalid-package-name/expected | 0 .../invalid-package-name/main/default.nix | 0 .../main/pkgs/by-name/fo/fo@/package.nix | 0 .../invalid-shard-name/expected | 0 .../invalid-shard-name/main/default.nix | 0 .../invalid-shard-name/main/pkgs/by-name/A/A/.git-keep | 0 .../invalid-shard-name/main/pkgs/by-name/A/A/package.nix | 0 .../license-compound-new/expected | 0 .../license-compound-new/main/default.nix | 0 .../license-compound-new/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-existing/base/default.nix | 0 .../license-list-existing/base/pkgs/by-name/README.md | 0 .../base/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-existing/expected | 0 .../license-list-existing/main/default.nix | 0 .../license-list-existing/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../{top-level => integration}/license-list-new/expected | 0 .../license-list-new/main/default.nix | 0 .../license-list-new/main/pkgs/by-name/README.md | 0 .../license-list-new/main/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-regression/base/default.nix | 0 .../license-list-regression/base/pkgs/by-name/README.md | 0 .../base/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-regression/expected | 0 .../license-list-regression/main/default.nix | 0 .../license-list-regression/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-removed/base/default.nix | 0 .../license-list-removed/base/pkgs/by-name/README.md | 0 .../base/pkgs/by-name/fo/foo/package.nix | 0 .../license-list-removed/expected | 0 .../license-list-removed/main/default.nix | 0 .../license-list-removed/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../license-single-new/expected | 0 .../license-single-new/main/default.nix | 0 .../license-single-new/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../missing-package-nix/expected | 0 .../missing-package-nix/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/.git-keep | 0 .../move-to-non-by-name/base/default.nix | 0 .../base/pkgs/by-name/fo/foo1/package.nix | 0 .../base/pkgs/by-name/fo/foo2/package.nix | 0 .../move-to-non-by-name/expected | 0 .../move-to-non-by-name/main/default.nix | 0 .../move-to-non-by-name/main/pkgs/by-name/README.md | 0 .../main/pkgs/top-level/all-packages.nix | 0 .../move-to-non-by-name/main/with-config.nix | 0 .../move-to-non-by-name/main/without-config.nix | 0 .../{top-level => integration}/multiple-failures/expected | 0 .../multiple-failures/main/default.nix | 0 .../multiple-failures/main/pkgs/by-name/A/fo@/foo | 0 .../multiple-failures/main/pkgs/by-name/A/fo@/package.nix | 0 .../multiple-failures/main/pkgs/by-name/aa | 0 .../multiple-failures/main/pkgs/by-name/ba/bar | 0 .../main/pkgs/by-name/ba/baz/package.nix/default.nix | 0 .../main/pkgs/by-name/ba/foo/package.nix | 0 .../multiple-failures/main/pkgs/by-name/fo/foo/.git-keep | 0 .../multiple-failures/main/someDrv.nix | 0 .../new-package-non-by-name/base/default.nix | 0 .../new-package-non-by-name/base/pkgs/by-name/README.md | 0 .../base/pkgs/top-level/all-packages.nix | 0 .../new-package-non-by-name/expected | 0 .../new-package-non-by-name/main/default.nix | 0 .../new-package-non-by-name/main/pkgs/by-name/README.md | 0 .../main/pkgs/top-level/all-packages.nix | 0 .../new-package-non-by-name/main/with-config.nix | 0 .../new-package-non-by-name/main/without-config.nix | 0 .../new-plain-derivation-strict-deps-unset/expected | 0 .../main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../new-plain-derivation-structured-attrs-unset/expected | 0 .../main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../new-plain-derivation/expected | 0 .../new-plain-derivation/main/default.nix | 0 .../new-plain-derivation/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../nix-file-executable/expected | 0 .../nix-file-executable/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../nix-file-shebang-executable/expected | 0 .../nix-file-shebang-executable/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../nix-file-shebang-not-executable/expected | 0 .../nix-file-shebang-not-executable/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/no-by-name/expected | 0 .../no-by-name/main/default.nix | 0 tests/{top-level => integration}/no-eval/base/default.nix | 0 .../no-eval/base/pkgs/by-name/README.md | 0 .../no-eval/base/pkgs/top-level/all-packages.nix | 0 tests/{top-level => integration}/no-eval/expected | 0 tests/{top-level => integration}/no-eval/main/default.nix | 0 .../no-eval/main/pkgs/by-name/README.md | 0 .../no-eval/main/pkgs/top-level/all-packages.nix | 0 tests/{top-level => integration}/non-attrs/expected | 0 .../{top-level => integration}/non-attrs/main/default.nix | 0 .../main/pkgs/by-name/no/nonDerivation/package.nix | 0 .../{top-level => integration}/non-by-name-trace/expected | 0 .../non-by-name-trace/main/README.md | 0 .../non-by-name-trace/main/default.nix | 0 .../main/pkgs/top-level/all-packages.nix | 0 tests/{top-level => integration}/non-derivation/expected | 0 .../non-derivation/main/default.nix | 0 .../main/pkgs/by-name/no/nonDerivation/package.nix | 0 tests/{top-level => integration}/one-letter/expected | 0 .../one-letter/main/default.nix | 0 .../one-letter/main/pkgs/by-name/a/a/package.nix | 0 .../only-callPackage-derivations/expected | 0 .../only-callPackage-derivations/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/top-level/all-packages.nix | 0 .../optional-list-param/expected | 0 .../optional-list-param/main/default.nix | 0 .../package-dir-is-file/expected | 0 .../package-dir-is-file/main/default.nix | 0 .../package-dir-is-file/main/pkgs/by-name/fo/foo | 0 tests/{top-level => integration}/package-nix-dir/expected | 0 .../package-nix-dir/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix/default.nix | 0 .../package-variants/base/default.nix | 0 .../package-variants/base/pkgs/by-name/fo/foo/package.nix | 0 .../package-variants/base/pkgs/top-level/all-packages.nix | 0 .../{top-level => integration}/package-variants/expected | 0 .../package-variants/main/default.nix | 0 .../package-variants/main/package.nix | 0 .../package-variants/main/pkgs/by-name/fo/foo/package.nix | 0 .../package-variants/main/pkgs/top-level/all-packages.nix | 0 tests/{top-level => integration}/ref-absolute/expected | 0 .../ref-absolute/main/default.nix | 0 .../ref-absolute/main/pkgs/by-name/aa/aa/package.nix | 0 tests/{top-level => integration}/ref-escape/expected | 0 .../ref-escape/main/default.nix | 0 .../ref-escape/main/pkgs/by-name/aa/aa/package.nix | 0 tests/{top-level => integration}/ref-home-path/expected | 0 .../ref-home-path/main/default.nix | 0 .../ref-home-path/main/pkgs/by-name/aa/aa/package.nix | 0 tests/{top-level => integration}/ref-nix-path/expected | 0 .../ref-nix-path/main/default.nix | 0 .../ref-nix-path/main/pkgs/by-name/aa/aa/package.nix | 0 .../{top-level => integration}/ref-path-subexpr/expected | 0 .../ref-path-subexpr/main/default.nix | 0 .../ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix | 0 tests/{top-level => integration}/ref-success/expected | 0 .../ref-success/main/default.nix | 0 .../ref-success/main/pkgs/by-name/aa/aa/dir/default.nix | 0 .../ref-success/main/pkgs/by-name/aa/aa/file | 0 .../ref-success/main/pkgs/by-name/aa/aa/file.nix | 0 .../ref-success/main/pkgs/by-name/aa/aa/package.nix | 0 tests/{top-level => integration}/shard-file/expected | 0 .../shard-file/main/default.nix | 0 .../shard-file/main/pkgs/by-name/fo | 0 .../strict-deps-new-false/expected | 0 .../strict-deps-new-false/main/default.nix | 0 .../strict-deps-new-false/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../strict-deps-new-passthru/expected | 0 .../strict-deps-new-passthru/main/default.nix | 0 .../strict-deps-new-passthru/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../strict-deps-new-true/expected | 0 .../strict-deps-new-true/main/default.nix | 0 .../strict-deps-new-true/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../strict-deps-new-unset/expected | 0 .../strict-deps-new-unset/main/default.nix | 0 .../strict-deps-new-unset/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../strict-deps-regression/base/default.nix | 0 .../strict-deps-regression/base/pkgs/by-name/README.md | 0 .../base/pkgs/by-name/fo/foo/package.nix | 0 .../strict-deps-regression/expected | 0 .../strict-deps-regression/main/default.nix | 0 .../strict-deps-regression/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-new-false/expected | 0 .../structured-attrs-new-false/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-new-passthru/expected | 0 .../structured-attrs-new-passthru/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-new-true/expected | 0 .../structured-attrs-new-true/main/default.nix | 0 .../structured-attrs-new-true/main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-new-unset/expected | 0 .../structured-attrs-new-unset/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-regression/base/default.nix | 0 .../base/pkgs/by-name/README.md | 0 .../base/pkgs/by-name/fo/foo/package.nix | 0 .../structured-attrs-regression/expected | 0 .../structured-attrs-regression/main/default.nix | 0 .../main/pkgs/by-name/README.md | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/success/expected | 0 tests/{top-level => integration}/success/main/default.nix | 0 .../success/main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/symlink-escape/expected | 0 .../symlink-escape/main/default.nix | 0 .../symlink-escape/main/pkgs/by-name/fo/foo/package.nix | 0 .../symlink-escape/main/someDrv.nix | 0 tests/{top-level => integration}/symlink-invalid/expected | 0 .../symlink-invalid/main/default.nix | 0 .../symlink-invalid/main/pkgs/by-name/fo/foo/foo | 0 .../symlink-invalid/main/pkgs/by-name/fo/foo/package.nix | 0 .../symlink-invalid/main/someDrv.nix | 0 tests/{top-level => integration}/uppercase/expected | 0 .../{top-level => integration}/uppercase/main/default.nix | 0 .../uppercase/main/pkgs/by-name/fo/FOO/package.nix | 0 .../useless-multi-line-escapes/expected | 0 .../useless-multi-line-escapes/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 .../useless-single-line-escapes/expected | 0 .../useless-single-line-escapes/main/default.nix | 0 .../main/pkgs/by-name/fo/foo/package.nix | 0 tests/{top-level => integration}/with-readme/expected | 0 .../with-readme/main/default.nix | 0 .../with-readme/main/pkgs/by-name/README.md | 0 276 files changed, 6 insertions(+), 6 deletions(-) rename tests/{top-level => integration}/aliases/expected (100%) rename tests/{top-level => integration}/aliases/main/aliases.nix (100%) rename tests/{top-level => integration}/aliases/main/default.nix (100%) rename tests/{top-level => integration}/aliases/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/aliases/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/base-fixed/base/default.nix (100%) rename tests/{top-level => integration}/base-fixed/base/pkgs/by-name/foo (100%) rename tests/{top-level => integration}/base-fixed/expected (100%) rename tests/{top-level => integration}/base-fixed/main/default.nix (100%) rename tests/{top-level => integration}/base-fixed/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/base-still-broken/base/default.nix (100%) rename tests/{top-level => integration}/base-still-broken/base/pkgs/by-name/foo (100%) rename tests/{top-level => integration}/base-still-broken/expected (100%) rename tests/{top-level => integration}/base-still-broken/main/default.nix (100%) rename tests/{top-level => integration}/base-still-broken/main/pkgs/by-name/bar (100%) rename tests/{top-level => integration}/broken-autocall/expected (100%) rename tests/{top-level => integration}/broken-autocall/main/default.nix (100%) rename tests/{top-level => integration}/broken-autocall/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/by-name-failure/expected (100%) rename tests/{top-level => integration}/by-name-failure/main/default.nix (100%) rename tests/{top-level => integration}/by-name-failure/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/by-name-numprefix/expected (100%) rename tests/{top-level => integration}/by-name-numprefix/main/default.nix (100%) rename tests/{top-level => integration}/by-name-numprefix/main/pkgs/by-name/10/10foo/package.nix (100%) rename tests/{top-level => integration}/callPackage-syntax/expected (100%) rename tests/{top-level => integration}/callPackage-syntax/main/default.nix (100%) rename tests/{top-level => integration}/callPackage-syntax/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/callPackage-syntax/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-false/expected (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-false/main/default.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-false/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-false/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-true/expected (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-true/main/default.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-true/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-true/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-unset/expected (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-unset/main/default.nix (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-unset/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/dont-cargo-system-libs-new-unset/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/empty-base/expected (100%) rename tests/{top-level => integration}/empty-base/main/default.nix (100%) rename tests/{top-level => integration}/empty-base/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/incorrect-shard/expected (100%) rename tests/{top-level => integration}/incorrect-shard/main/default.nix (100%) rename tests/{top-level => integration}/incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix (100%) rename tests/{top-level => integration}/invalid-package-name/expected (100%) rename tests/{top-level => integration}/invalid-package-name/main/default.nix (100%) rename tests/{top-level => integration}/invalid-package-name/main/pkgs/by-name/fo/fo@/package.nix (100%) rename tests/{top-level => integration}/invalid-shard-name/expected (100%) rename tests/{top-level => integration}/invalid-shard-name/main/default.nix (100%) rename tests/{top-level => integration}/invalid-shard-name/main/pkgs/by-name/A/A/.git-keep (100%) rename tests/{top-level => integration}/invalid-shard-name/main/pkgs/by-name/A/A/package.nix (100%) rename tests/{top-level => integration}/license-compound-new/expected (100%) rename tests/{top-level => integration}/license-compound-new/main/default.nix (100%) rename tests/{top-level => integration}/license-compound-new/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-compound-new/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-existing/base/default.nix (100%) rename tests/{top-level => integration}/license-list-existing/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-existing/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-existing/expected (100%) rename tests/{top-level => integration}/license-list-existing/main/default.nix (100%) rename tests/{top-level => integration}/license-list-existing/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-existing/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-new/expected (100%) rename tests/{top-level => integration}/license-list-new/main/default.nix (100%) rename tests/{top-level => integration}/license-list-new/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-new/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-regression/base/default.nix (100%) rename tests/{top-level => integration}/license-list-regression/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-regression/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-regression/expected (100%) rename tests/{top-level => integration}/license-list-regression/main/default.nix (100%) rename tests/{top-level => integration}/license-list-regression/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-regression/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-removed/base/default.nix (100%) rename tests/{top-level => integration}/license-list-removed/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-removed/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-list-removed/expected (100%) rename tests/{top-level => integration}/license-list-removed/main/default.nix (100%) rename tests/{top-level => integration}/license-list-removed/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-list-removed/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/license-single-new/expected (100%) rename tests/{top-level => integration}/license-single-new/main/default.nix (100%) rename tests/{top-level => integration}/license-single-new/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/license-single-new/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/missing-package-nix/expected (100%) rename tests/{top-level => integration}/missing-package-nix/main/default.nix (100%) rename tests/{top-level => integration}/missing-package-nix/main/pkgs/by-name/fo/foo/.git-keep (100%) rename tests/{top-level => integration}/move-to-non-by-name/base/default.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/expected (100%) rename tests/{top-level => integration}/move-to-non-by-name/main/default.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/move-to-non-by-name/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/main/with-config.nix (100%) rename tests/{top-level => integration}/move-to-non-by-name/main/without-config.nix (100%) rename tests/{top-level => integration}/multiple-failures/expected (100%) rename tests/{top-level => integration}/multiple-failures/main/default.nix (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/A/fo@/foo (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/A/fo@/package.nix (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/aa (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/ba/bar (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/ba/baz/package.nix/default.nix (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/ba/foo/package.nix (100%) rename tests/{top-level => integration}/multiple-failures/main/pkgs/by-name/fo/foo/.git-keep (100%) rename tests/{top-level => integration}/multiple-failures/main/someDrv.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/base/default.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/new-package-non-by-name/base/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/expected (100%) rename tests/{top-level => integration}/new-package-non-by-name/main/default.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/new-package-non-by-name/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/main/with-config.nix (100%) rename tests/{top-level => integration}/new-package-non-by-name/main/without-config.nix (100%) rename tests/{top-level => integration}/new-plain-derivation-strict-deps-unset/expected (100%) rename tests/{top-level => integration}/new-plain-derivation-strict-deps-unset/main/default.nix (100%) rename tests/{top-level => integration}/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/new-plain-derivation-structured-attrs-unset/expected (100%) rename tests/{top-level => integration}/new-plain-derivation-structured-attrs-unset/main/default.nix (100%) rename tests/{top-level => integration}/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/new-plain-derivation/expected (100%) rename tests/{top-level => integration}/new-plain-derivation/main/default.nix (100%) rename tests/{top-level => integration}/new-plain-derivation/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/new-plain-derivation/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/nix-file-executable/expected (100%) rename tests/{top-level => integration}/nix-file-executable/main/default.nix (100%) rename tests/{top-level => integration}/nix-file-executable/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/nix-file-shebang-executable/expected (100%) rename tests/{top-level => integration}/nix-file-shebang-executable/main/default.nix (100%) rename tests/{top-level => integration}/nix-file-shebang-executable/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/nix-file-shebang-not-executable/expected (100%) rename tests/{top-level => integration}/nix-file-shebang-not-executable/main/default.nix (100%) rename tests/{top-level => integration}/nix-file-shebang-not-executable/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/no-by-name/expected (100%) rename tests/{top-level => integration}/no-by-name/main/default.nix (100%) rename tests/{top-level => integration}/no-eval/base/default.nix (100%) rename tests/{top-level => integration}/no-eval/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/no-eval/base/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/no-eval/expected (100%) rename tests/{top-level => integration}/no-eval/main/default.nix (100%) rename tests/{top-level => integration}/no-eval/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/no-eval/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/non-attrs/expected (100%) rename tests/{top-level => integration}/non-attrs/main/default.nix (100%) rename tests/{top-level => integration}/non-attrs/main/pkgs/by-name/no/nonDerivation/package.nix (100%) rename tests/{top-level => integration}/non-by-name-trace/expected (100%) rename tests/{top-level => integration}/non-by-name-trace/main/README.md (100%) rename tests/{top-level => integration}/non-by-name-trace/main/default.nix (100%) rename tests/{top-level => integration}/non-by-name-trace/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/non-derivation/expected (100%) rename tests/{top-level => integration}/non-derivation/main/default.nix (100%) rename tests/{top-level => integration}/non-derivation/main/pkgs/by-name/no/nonDerivation/package.nix (100%) rename tests/{top-level => integration}/one-letter/expected (100%) rename tests/{top-level => integration}/one-letter/main/default.nix (100%) rename tests/{top-level => integration}/one-letter/main/pkgs/by-name/a/a/package.nix (100%) rename tests/{top-level => integration}/only-callPackage-derivations/expected (100%) rename tests/{top-level => integration}/only-callPackage-derivations/main/default.nix (100%) rename tests/{top-level => integration}/only-callPackage-derivations/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/only-callPackage-derivations/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/optional-list-param/expected (100%) rename tests/{top-level => integration}/optional-list-param/main/default.nix (100%) rename tests/{top-level => integration}/package-dir-is-file/expected (100%) rename tests/{top-level => integration}/package-dir-is-file/main/default.nix (100%) rename tests/{top-level => integration}/package-dir-is-file/main/pkgs/by-name/fo/foo (100%) rename tests/{top-level => integration}/package-nix-dir/expected (100%) rename tests/{top-level => integration}/package-nix-dir/main/default.nix (100%) rename tests/{top-level => integration}/package-nix-dir/main/pkgs/by-name/fo/foo/package.nix/default.nix (100%) rename tests/{top-level => integration}/package-variants/base/default.nix (100%) rename tests/{top-level => integration}/package-variants/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/package-variants/base/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/package-variants/expected (100%) rename tests/{top-level => integration}/package-variants/main/default.nix (100%) rename tests/{top-level => integration}/package-variants/main/package.nix (100%) rename tests/{top-level => integration}/package-variants/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/package-variants/main/pkgs/top-level/all-packages.nix (100%) rename tests/{top-level => integration}/ref-absolute/expected (100%) rename tests/{top-level => integration}/ref-absolute/main/default.nix (100%) rename tests/{top-level => integration}/ref-absolute/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/ref-escape/expected (100%) rename tests/{top-level => integration}/ref-escape/main/default.nix (100%) rename tests/{top-level => integration}/ref-escape/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/ref-home-path/expected (100%) rename tests/{top-level => integration}/ref-home-path/main/default.nix (100%) rename tests/{top-level => integration}/ref-home-path/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/ref-nix-path/expected (100%) rename tests/{top-level => integration}/ref-nix-path/main/default.nix (100%) rename tests/{top-level => integration}/ref-nix-path/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/ref-path-subexpr/expected (100%) rename tests/{top-level => integration}/ref-path-subexpr/main/default.nix (100%) rename tests/{top-level => integration}/ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/ref-success/expected (100%) rename tests/{top-level => integration}/ref-success/main/default.nix (100%) rename tests/{top-level => integration}/ref-success/main/pkgs/by-name/aa/aa/dir/default.nix (100%) rename tests/{top-level => integration}/ref-success/main/pkgs/by-name/aa/aa/file (100%) rename tests/{top-level => integration}/ref-success/main/pkgs/by-name/aa/aa/file.nix (100%) rename tests/{top-level => integration}/ref-success/main/pkgs/by-name/aa/aa/package.nix (100%) rename tests/{top-level => integration}/shard-file/expected (100%) rename tests/{top-level => integration}/shard-file/main/default.nix (100%) rename tests/{top-level => integration}/shard-file/main/pkgs/by-name/fo (100%) rename tests/{top-level => integration}/strict-deps-new-false/expected (100%) rename tests/{top-level => integration}/strict-deps-new-false/main/default.nix (100%) rename tests/{top-level => integration}/strict-deps-new-false/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-new-false/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/strict-deps-new-passthru/expected (100%) rename tests/{top-level => integration}/strict-deps-new-passthru/main/default.nix (100%) rename tests/{top-level => integration}/strict-deps-new-passthru/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-new-passthru/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/strict-deps-new-true/expected (100%) rename tests/{top-level => integration}/strict-deps-new-true/main/default.nix (100%) rename tests/{top-level => integration}/strict-deps-new-true/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-new-true/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/strict-deps-new-unset/expected (100%) rename tests/{top-level => integration}/strict-deps-new-unset/main/default.nix (100%) rename tests/{top-level => integration}/strict-deps-new-unset/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-new-unset/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/strict-deps-regression/base/default.nix (100%) rename tests/{top-level => integration}/strict-deps-regression/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-regression/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/strict-deps-regression/expected (100%) rename tests/{top-level => integration}/strict-deps-regression/main/default.nix (100%) rename tests/{top-level => integration}/strict-deps-regression/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/strict-deps-regression/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-false/expected (100%) rename tests/{top-level => integration}/structured-attrs-new-false/main/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-false/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-new-false/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-passthru/expected (100%) rename tests/{top-level => integration}/structured-attrs-new-passthru/main/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-passthru/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-new-passthru/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-true/expected (100%) rename tests/{top-level => integration}/structured-attrs-new-true/main/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-true/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-new-true/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-unset/expected (100%) rename tests/{top-level => integration}/structured-attrs-new-unset/main/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-new-unset/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-new-unset/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-regression/base/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-regression/base/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-regression/base/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/structured-attrs-regression/expected (100%) rename tests/{top-level => integration}/structured-attrs-regression/main/default.nix (100%) rename tests/{top-level => integration}/structured-attrs-regression/main/pkgs/by-name/README.md (100%) rename tests/{top-level => integration}/structured-attrs-regression/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/success/expected (100%) rename tests/{top-level => integration}/success/main/default.nix (100%) rename tests/{top-level => integration}/success/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/symlink-escape/expected (100%) rename tests/{top-level => integration}/symlink-escape/main/default.nix (100%) rename tests/{top-level => integration}/symlink-escape/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/symlink-escape/main/someDrv.nix (100%) rename tests/{top-level => integration}/symlink-invalid/expected (100%) rename tests/{top-level => integration}/symlink-invalid/main/default.nix (100%) rename tests/{top-level => integration}/symlink-invalid/main/pkgs/by-name/fo/foo/foo (100%) rename tests/{top-level => integration}/symlink-invalid/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/symlink-invalid/main/someDrv.nix (100%) rename tests/{top-level => integration}/uppercase/expected (100%) rename tests/{top-level => integration}/uppercase/main/default.nix (100%) rename tests/{top-level => integration}/uppercase/main/pkgs/by-name/fo/FOO/package.nix (100%) rename tests/{top-level => integration}/useless-multi-line-escapes/expected (100%) rename tests/{top-level => integration}/useless-multi-line-escapes/main/default.nix (100%) rename tests/{top-level => integration}/useless-multi-line-escapes/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/useless-single-line-escapes/expected (100%) rename tests/{top-level => integration}/useless-single-line-escapes/main/default.nix (100%) rename tests/{top-level => integration}/useless-single-line-escapes/main/pkgs/by-name/fo/foo/package.nix (100%) rename tests/{top-level => integration}/with-readme/expected (100%) rename tests/{top-level => integration}/with-readme/main/default.nix (100%) rename tests/{top-level => integration}/with-readme/main/pkgs/by-name/README.md (100%) diff --git a/.github/xrefcheck.yaml b/.github/xrefcheck.yaml index 2d826107..6bb91b0d 100644 --- a/.github/xrefcheck.yaml +++ b/.github/xrefcheck.yaml @@ -12,8 +12,8 @@ exclusions: - .github/issue_template.md - .github/PULL_REQUEST_TEMPLATE/**/* - .github/ISSUE_TEMPLATE/**/* - - tests/top-level/symlink-invalid/main/pkgs/by-name/fo/foo/foo - - tests/top-level/multiple-failures/main/pkgs/by-name/A/fo@/foo + - tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/foo + - tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/foo # References to these paths will not be verified. # List of glob patterns. diff --git a/src/main.rs b/src/main.rs index fb42430c..37c3987b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,10 +153,10 @@ mod tests { use super::{process, structure::BASE_SUBPATH}; // Manually repeat this for each subdir under tests/ in order to disambiguate - #[fixtures::fixtures(["tests/top-level/*"])] + #[fixtures::fixtures(["tests/integration/*"])] #[allow(non_snake_case)] // the test directories don't use snake case, and the macro expansion causes a warning. #[test] - fn test_top_level_dir(path: &Path) -> anyhow::Result<()> { + fn test_integration(path: &Path) -> anyhow::Result<()> { let name = path.file_name().unwrap().to_string_lossy().into_owned(); if !path.is_dir() { return Ok(()); @@ -228,7 +228,7 @@ mod tests { temp_env::with_var("TMPDIR", Some(&tmpdir), || { test_nixpkgs( "symlinked_tmpdir", - Path::new("tests/top-level/success"), + Path::new("tests/integration/success"), "Validated successfully\n", ); }); @@ -252,7 +252,7 @@ mod tests { let base_nixpkgs = if base_path.exists() { base_path } else { - Path::new("tests/top-level/empty-base").to_owned() + Path::new("tests/integration/empty-base").to_owned() }; // Empty dir, needed so that no warnings are printed when testing older Nix versions diff --git a/tests/top-level/aliases/expected b/tests/integration/aliases/expected similarity index 100% rename from tests/top-level/aliases/expected rename to tests/integration/aliases/expected diff --git a/tests/top-level/aliases/main/aliases.nix b/tests/integration/aliases/main/aliases.nix similarity index 100% rename from tests/top-level/aliases/main/aliases.nix rename to tests/integration/aliases/main/aliases.nix diff --git a/tests/top-level/aliases/main/default.nix b/tests/integration/aliases/main/default.nix similarity index 100% rename from tests/top-level/aliases/main/default.nix rename to tests/integration/aliases/main/default.nix diff --git a/tests/top-level/aliases/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/aliases/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/aliases/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/aliases/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/aliases/main/pkgs/top-level/all-packages.nix b/tests/integration/aliases/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/aliases/main/pkgs/top-level/all-packages.nix rename to tests/integration/aliases/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/base-fixed/base/default.nix b/tests/integration/base-fixed/base/default.nix similarity index 100% rename from tests/top-level/base-fixed/base/default.nix rename to tests/integration/base-fixed/base/default.nix diff --git a/tests/top-level/base-fixed/base/pkgs/by-name/foo b/tests/integration/base-fixed/base/pkgs/by-name/foo similarity index 100% rename from tests/top-level/base-fixed/base/pkgs/by-name/foo rename to tests/integration/base-fixed/base/pkgs/by-name/foo diff --git a/tests/top-level/base-fixed/expected b/tests/integration/base-fixed/expected similarity index 100% rename from tests/top-level/base-fixed/expected rename to tests/integration/base-fixed/expected diff --git a/tests/top-level/base-fixed/main/default.nix b/tests/integration/base-fixed/main/default.nix similarity index 100% rename from tests/top-level/base-fixed/main/default.nix rename to tests/integration/base-fixed/main/default.nix diff --git a/tests/top-level/base-fixed/main/pkgs/by-name/README.md b/tests/integration/base-fixed/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/base-fixed/main/pkgs/by-name/README.md rename to tests/integration/base-fixed/main/pkgs/by-name/README.md diff --git a/tests/top-level/base-still-broken/base/default.nix b/tests/integration/base-still-broken/base/default.nix similarity index 100% rename from tests/top-level/base-still-broken/base/default.nix rename to tests/integration/base-still-broken/base/default.nix diff --git a/tests/top-level/base-still-broken/base/pkgs/by-name/foo b/tests/integration/base-still-broken/base/pkgs/by-name/foo similarity index 100% rename from tests/top-level/base-still-broken/base/pkgs/by-name/foo rename to tests/integration/base-still-broken/base/pkgs/by-name/foo diff --git a/tests/top-level/base-still-broken/expected b/tests/integration/base-still-broken/expected similarity index 100% rename from tests/top-level/base-still-broken/expected rename to tests/integration/base-still-broken/expected diff --git a/tests/top-level/base-still-broken/main/default.nix b/tests/integration/base-still-broken/main/default.nix similarity index 100% rename from tests/top-level/base-still-broken/main/default.nix rename to tests/integration/base-still-broken/main/default.nix diff --git a/tests/top-level/base-still-broken/main/pkgs/by-name/bar b/tests/integration/base-still-broken/main/pkgs/by-name/bar similarity index 100% rename from tests/top-level/base-still-broken/main/pkgs/by-name/bar rename to tests/integration/base-still-broken/main/pkgs/by-name/bar diff --git a/tests/top-level/broken-autocall/expected b/tests/integration/broken-autocall/expected similarity index 100% rename from tests/top-level/broken-autocall/expected rename to tests/integration/broken-autocall/expected diff --git a/tests/top-level/broken-autocall/main/default.nix b/tests/integration/broken-autocall/main/default.nix similarity index 100% rename from tests/top-level/broken-autocall/main/default.nix rename to tests/integration/broken-autocall/main/default.nix diff --git a/tests/top-level/broken-autocall/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/broken-autocall/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/broken-autocall/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/broken-autocall/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/by-name-failure/expected b/tests/integration/by-name-failure/expected similarity index 100% rename from tests/top-level/by-name-failure/expected rename to tests/integration/by-name-failure/expected diff --git a/tests/top-level/by-name-failure/main/default.nix b/tests/integration/by-name-failure/main/default.nix similarity index 100% rename from tests/top-level/by-name-failure/main/default.nix rename to tests/integration/by-name-failure/main/default.nix diff --git a/tests/top-level/by-name-failure/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/by-name-failure/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/by-name-failure/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/by-name-failure/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/by-name-numprefix/expected b/tests/integration/by-name-numprefix/expected similarity index 100% rename from tests/top-level/by-name-numprefix/expected rename to tests/integration/by-name-numprefix/expected diff --git a/tests/top-level/by-name-numprefix/main/default.nix b/tests/integration/by-name-numprefix/main/default.nix similarity index 100% rename from tests/top-level/by-name-numprefix/main/default.nix rename to tests/integration/by-name-numprefix/main/default.nix diff --git a/tests/top-level/by-name-numprefix/main/pkgs/by-name/10/10foo/package.nix b/tests/integration/by-name-numprefix/main/pkgs/by-name/10/10foo/package.nix similarity index 100% rename from tests/top-level/by-name-numprefix/main/pkgs/by-name/10/10foo/package.nix rename to tests/integration/by-name-numprefix/main/pkgs/by-name/10/10foo/package.nix diff --git a/tests/top-level/callPackage-syntax/expected b/tests/integration/callPackage-syntax/expected similarity index 100% rename from tests/top-level/callPackage-syntax/expected rename to tests/integration/callPackage-syntax/expected diff --git a/tests/top-level/callPackage-syntax/main/default.nix b/tests/integration/callPackage-syntax/main/default.nix similarity index 100% rename from tests/top-level/callPackage-syntax/main/default.nix rename to tests/integration/callPackage-syntax/main/default.nix diff --git a/tests/top-level/callPackage-syntax/main/pkgs/by-name/README.md b/tests/integration/callPackage-syntax/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/callPackage-syntax/main/pkgs/by-name/README.md rename to tests/integration/callPackage-syntax/main/pkgs/by-name/README.md diff --git a/tests/top-level/callPackage-syntax/main/pkgs/top-level/all-packages.nix b/tests/integration/callPackage-syntax/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/callPackage-syntax/main/pkgs/top-level/all-packages.nix rename to tests/integration/callPackage-syntax/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-false/expected b/tests/integration/dont-cargo-system-libs-new-false/expected similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-false/expected rename to tests/integration/dont-cargo-system-libs-new-false/expected diff --git a/tests/top-level/dont-cargo-system-libs-new-false/main/default.nix b/tests/integration/dont-cargo-system-libs-new-false/main/default.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-false/main/default.nix rename to tests/integration/dont-cargo-system-libs-new-false/main/default.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-false/main/pkgs/by-name/README.md b/tests/integration/dont-cargo-system-libs-new-false/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-false/main/pkgs/by-name/README.md rename to tests/integration/dont-cargo-system-libs-new-false/main/pkgs/by-name/README.md diff --git a/tests/top-level/dont-cargo-system-libs-new-false/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/dont-cargo-system-libs-new-false/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-false/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/dont-cargo-system-libs-new-false/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-true/expected b/tests/integration/dont-cargo-system-libs-new-true/expected similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-true/expected rename to tests/integration/dont-cargo-system-libs-new-true/expected diff --git a/tests/top-level/dont-cargo-system-libs-new-true/main/default.nix b/tests/integration/dont-cargo-system-libs-new-true/main/default.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-true/main/default.nix rename to tests/integration/dont-cargo-system-libs-new-true/main/default.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-true/main/pkgs/by-name/README.md b/tests/integration/dont-cargo-system-libs-new-true/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-true/main/pkgs/by-name/README.md rename to tests/integration/dont-cargo-system-libs-new-true/main/pkgs/by-name/README.md diff --git a/tests/top-level/dont-cargo-system-libs-new-true/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/dont-cargo-system-libs-new-true/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-true/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/dont-cargo-system-libs-new-true/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-unset/expected b/tests/integration/dont-cargo-system-libs-new-unset/expected similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-unset/expected rename to tests/integration/dont-cargo-system-libs-new-unset/expected diff --git a/tests/top-level/dont-cargo-system-libs-new-unset/main/default.nix b/tests/integration/dont-cargo-system-libs-new-unset/main/default.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-unset/main/default.nix rename to tests/integration/dont-cargo-system-libs-new-unset/main/default.nix diff --git a/tests/top-level/dont-cargo-system-libs-new-unset/main/pkgs/by-name/README.md b/tests/integration/dont-cargo-system-libs-new-unset/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-unset/main/pkgs/by-name/README.md rename to tests/integration/dont-cargo-system-libs-new-unset/main/pkgs/by-name/README.md diff --git a/tests/top-level/dont-cargo-system-libs-new-unset/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/dont-cargo-system-libs-new-unset/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/dont-cargo-system-libs-new-unset/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/dont-cargo-system-libs-new-unset/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/empty-base/expected b/tests/integration/empty-base/expected similarity index 100% rename from tests/top-level/empty-base/expected rename to tests/integration/empty-base/expected diff --git a/tests/top-level/empty-base/main/default.nix b/tests/integration/empty-base/main/default.nix similarity index 100% rename from tests/top-level/empty-base/main/default.nix rename to tests/integration/empty-base/main/default.nix diff --git a/tests/top-level/empty-base/main/pkgs/by-name/README.md b/tests/integration/empty-base/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/empty-base/main/pkgs/by-name/README.md rename to tests/integration/empty-base/main/pkgs/by-name/README.md diff --git a/tests/top-level/incorrect-shard/expected b/tests/integration/incorrect-shard/expected similarity index 100% rename from tests/top-level/incorrect-shard/expected rename to tests/integration/incorrect-shard/expected diff --git a/tests/top-level/incorrect-shard/main/default.nix b/tests/integration/incorrect-shard/main/default.nix similarity index 100% rename from tests/top-level/incorrect-shard/main/default.nix rename to tests/integration/incorrect-shard/main/default.nix diff --git a/tests/top-level/incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix b/tests/integration/incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix similarity index 100% rename from tests/top-level/incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix rename to tests/integration/incorrect-shard/main/pkgs/by-name/aa/FOO/package.nix diff --git a/tests/top-level/invalid-package-name/expected b/tests/integration/invalid-package-name/expected similarity index 100% rename from tests/top-level/invalid-package-name/expected rename to tests/integration/invalid-package-name/expected diff --git a/tests/top-level/invalid-package-name/main/default.nix b/tests/integration/invalid-package-name/main/default.nix similarity index 100% rename from tests/top-level/invalid-package-name/main/default.nix rename to tests/integration/invalid-package-name/main/default.nix diff --git a/tests/top-level/invalid-package-name/main/pkgs/by-name/fo/fo@/package.nix b/tests/integration/invalid-package-name/main/pkgs/by-name/fo/fo@/package.nix similarity index 100% rename from tests/top-level/invalid-package-name/main/pkgs/by-name/fo/fo@/package.nix rename to tests/integration/invalid-package-name/main/pkgs/by-name/fo/fo@/package.nix diff --git a/tests/top-level/invalid-shard-name/expected b/tests/integration/invalid-shard-name/expected similarity index 100% rename from tests/top-level/invalid-shard-name/expected rename to tests/integration/invalid-shard-name/expected diff --git a/tests/top-level/invalid-shard-name/main/default.nix b/tests/integration/invalid-shard-name/main/default.nix similarity index 100% rename from tests/top-level/invalid-shard-name/main/default.nix rename to tests/integration/invalid-shard-name/main/default.nix diff --git a/tests/top-level/invalid-shard-name/main/pkgs/by-name/A/A/.git-keep b/tests/integration/invalid-shard-name/main/pkgs/by-name/A/A/.git-keep similarity index 100% rename from tests/top-level/invalid-shard-name/main/pkgs/by-name/A/A/.git-keep rename to tests/integration/invalid-shard-name/main/pkgs/by-name/A/A/.git-keep diff --git a/tests/top-level/invalid-shard-name/main/pkgs/by-name/A/A/package.nix b/tests/integration/invalid-shard-name/main/pkgs/by-name/A/A/package.nix similarity index 100% rename from tests/top-level/invalid-shard-name/main/pkgs/by-name/A/A/package.nix rename to tests/integration/invalid-shard-name/main/pkgs/by-name/A/A/package.nix diff --git a/tests/top-level/license-compound-new/expected b/tests/integration/license-compound-new/expected similarity index 100% rename from tests/top-level/license-compound-new/expected rename to tests/integration/license-compound-new/expected diff --git a/tests/top-level/license-compound-new/main/default.nix b/tests/integration/license-compound-new/main/default.nix similarity index 100% rename from tests/top-level/license-compound-new/main/default.nix rename to tests/integration/license-compound-new/main/default.nix diff --git a/tests/top-level/license-compound-new/main/pkgs/by-name/README.md b/tests/integration/license-compound-new/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-compound-new/main/pkgs/by-name/README.md rename to tests/integration/license-compound-new/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-compound-new/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-compound-new/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-compound-new/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-compound-new/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-existing/base/default.nix b/tests/integration/license-list-existing/base/default.nix similarity index 100% rename from tests/top-level/license-list-existing/base/default.nix rename to tests/integration/license-list-existing/base/default.nix diff --git a/tests/top-level/license-list-existing/base/pkgs/by-name/README.md b/tests/integration/license-list-existing/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-existing/base/pkgs/by-name/README.md rename to tests/integration/license-list-existing/base/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-existing/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-existing/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-existing/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-existing/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-existing/expected b/tests/integration/license-list-existing/expected similarity index 100% rename from tests/top-level/license-list-existing/expected rename to tests/integration/license-list-existing/expected diff --git a/tests/top-level/license-list-existing/main/default.nix b/tests/integration/license-list-existing/main/default.nix similarity index 100% rename from tests/top-level/license-list-existing/main/default.nix rename to tests/integration/license-list-existing/main/default.nix diff --git a/tests/top-level/license-list-existing/main/pkgs/by-name/README.md b/tests/integration/license-list-existing/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-existing/main/pkgs/by-name/README.md rename to tests/integration/license-list-existing/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-existing/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-existing/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-existing/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-existing/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-new/expected b/tests/integration/license-list-new/expected similarity index 100% rename from tests/top-level/license-list-new/expected rename to tests/integration/license-list-new/expected diff --git a/tests/top-level/license-list-new/main/default.nix b/tests/integration/license-list-new/main/default.nix similarity index 100% rename from tests/top-level/license-list-new/main/default.nix rename to tests/integration/license-list-new/main/default.nix diff --git a/tests/top-level/license-list-new/main/pkgs/by-name/README.md b/tests/integration/license-list-new/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-new/main/pkgs/by-name/README.md rename to tests/integration/license-list-new/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-new/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-new/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-new/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-new/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-regression/base/default.nix b/tests/integration/license-list-regression/base/default.nix similarity index 100% rename from tests/top-level/license-list-regression/base/default.nix rename to tests/integration/license-list-regression/base/default.nix diff --git a/tests/top-level/license-list-regression/base/pkgs/by-name/README.md b/tests/integration/license-list-regression/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-regression/base/pkgs/by-name/README.md rename to tests/integration/license-list-regression/base/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-regression/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-regression/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-regression/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-regression/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-regression/expected b/tests/integration/license-list-regression/expected similarity index 100% rename from tests/top-level/license-list-regression/expected rename to tests/integration/license-list-regression/expected diff --git a/tests/top-level/license-list-regression/main/default.nix b/tests/integration/license-list-regression/main/default.nix similarity index 100% rename from tests/top-level/license-list-regression/main/default.nix rename to tests/integration/license-list-regression/main/default.nix diff --git a/tests/top-level/license-list-regression/main/pkgs/by-name/README.md b/tests/integration/license-list-regression/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-regression/main/pkgs/by-name/README.md rename to tests/integration/license-list-regression/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-regression/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-regression/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-regression/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-regression/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-removed/base/default.nix b/tests/integration/license-list-removed/base/default.nix similarity index 100% rename from tests/top-level/license-list-removed/base/default.nix rename to tests/integration/license-list-removed/base/default.nix diff --git a/tests/top-level/license-list-removed/base/pkgs/by-name/README.md b/tests/integration/license-list-removed/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-removed/base/pkgs/by-name/README.md rename to tests/integration/license-list-removed/base/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-removed/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-removed/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-removed/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-removed/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-list-removed/expected b/tests/integration/license-list-removed/expected similarity index 100% rename from tests/top-level/license-list-removed/expected rename to tests/integration/license-list-removed/expected diff --git a/tests/top-level/license-list-removed/main/default.nix b/tests/integration/license-list-removed/main/default.nix similarity index 100% rename from tests/top-level/license-list-removed/main/default.nix rename to tests/integration/license-list-removed/main/default.nix diff --git a/tests/top-level/license-list-removed/main/pkgs/by-name/README.md b/tests/integration/license-list-removed/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-list-removed/main/pkgs/by-name/README.md rename to tests/integration/license-list-removed/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-list-removed/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-list-removed/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-list-removed/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-list-removed/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/license-single-new/expected b/tests/integration/license-single-new/expected similarity index 100% rename from tests/top-level/license-single-new/expected rename to tests/integration/license-single-new/expected diff --git a/tests/top-level/license-single-new/main/default.nix b/tests/integration/license-single-new/main/default.nix similarity index 100% rename from tests/top-level/license-single-new/main/default.nix rename to tests/integration/license-single-new/main/default.nix diff --git a/tests/top-level/license-single-new/main/pkgs/by-name/README.md b/tests/integration/license-single-new/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/license-single-new/main/pkgs/by-name/README.md rename to tests/integration/license-single-new/main/pkgs/by-name/README.md diff --git a/tests/top-level/license-single-new/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/license-single-new/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/license-single-new/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/license-single-new/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/missing-package-nix/expected b/tests/integration/missing-package-nix/expected similarity index 100% rename from tests/top-level/missing-package-nix/expected rename to tests/integration/missing-package-nix/expected diff --git a/tests/top-level/missing-package-nix/main/default.nix b/tests/integration/missing-package-nix/main/default.nix similarity index 100% rename from tests/top-level/missing-package-nix/main/default.nix rename to tests/integration/missing-package-nix/main/default.nix diff --git a/tests/top-level/missing-package-nix/main/pkgs/by-name/fo/foo/.git-keep b/tests/integration/missing-package-nix/main/pkgs/by-name/fo/foo/.git-keep similarity index 100% rename from tests/top-level/missing-package-nix/main/pkgs/by-name/fo/foo/.git-keep rename to tests/integration/missing-package-nix/main/pkgs/by-name/fo/foo/.git-keep diff --git a/tests/top-level/move-to-non-by-name/base/default.nix b/tests/integration/move-to-non-by-name/base/default.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/base/default.nix rename to tests/integration/move-to-non-by-name/base/default.nix diff --git a/tests/top-level/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix b/tests/integration/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix rename to tests/integration/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix diff --git a/tests/top-level/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix b/tests/integration/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix rename to tests/integration/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix diff --git a/tests/top-level/move-to-non-by-name/expected b/tests/integration/move-to-non-by-name/expected similarity index 100% rename from tests/top-level/move-to-non-by-name/expected rename to tests/integration/move-to-non-by-name/expected diff --git a/tests/top-level/move-to-non-by-name/main/default.nix b/tests/integration/move-to-non-by-name/main/default.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/main/default.nix rename to tests/integration/move-to-non-by-name/main/default.nix diff --git a/tests/top-level/move-to-non-by-name/main/pkgs/by-name/README.md b/tests/integration/move-to-non-by-name/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/move-to-non-by-name/main/pkgs/by-name/README.md rename to tests/integration/move-to-non-by-name/main/pkgs/by-name/README.md diff --git a/tests/top-level/move-to-non-by-name/main/pkgs/top-level/all-packages.nix b/tests/integration/move-to-non-by-name/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/main/pkgs/top-level/all-packages.nix rename to tests/integration/move-to-non-by-name/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/move-to-non-by-name/main/with-config.nix b/tests/integration/move-to-non-by-name/main/with-config.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/main/with-config.nix rename to tests/integration/move-to-non-by-name/main/with-config.nix diff --git a/tests/top-level/move-to-non-by-name/main/without-config.nix b/tests/integration/move-to-non-by-name/main/without-config.nix similarity index 100% rename from tests/top-level/move-to-non-by-name/main/without-config.nix rename to tests/integration/move-to-non-by-name/main/without-config.nix diff --git a/tests/top-level/multiple-failures/expected b/tests/integration/multiple-failures/expected similarity index 100% rename from tests/top-level/multiple-failures/expected rename to tests/integration/multiple-failures/expected diff --git a/tests/top-level/multiple-failures/main/default.nix b/tests/integration/multiple-failures/main/default.nix similarity index 100% rename from tests/top-level/multiple-failures/main/default.nix rename to tests/integration/multiple-failures/main/default.nix diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/A/fo@/foo b/tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/foo similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/A/fo@/foo rename to tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/foo diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/A/fo@/package.nix b/tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/package.nix similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/A/fo@/package.nix rename to tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/package.nix diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/aa b/tests/integration/multiple-failures/main/pkgs/by-name/aa similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/aa rename to tests/integration/multiple-failures/main/pkgs/by-name/aa diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/ba/bar b/tests/integration/multiple-failures/main/pkgs/by-name/ba/bar similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/ba/bar rename to tests/integration/multiple-failures/main/pkgs/by-name/ba/bar diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/ba/baz/package.nix/default.nix b/tests/integration/multiple-failures/main/pkgs/by-name/ba/baz/package.nix/default.nix similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/ba/baz/package.nix/default.nix rename to tests/integration/multiple-failures/main/pkgs/by-name/ba/baz/package.nix/default.nix diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/ba/foo/package.nix b/tests/integration/multiple-failures/main/pkgs/by-name/ba/foo/package.nix similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/ba/foo/package.nix rename to tests/integration/multiple-failures/main/pkgs/by-name/ba/foo/package.nix diff --git a/tests/top-level/multiple-failures/main/pkgs/by-name/fo/foo/.git-keep b/tests/integration/multiple-failures/main/pkgs/by-name/fo/foo/.git-keep similarity index 100% rename from tests/top-level/multiple-failures/main/pkgs/by-name/fo/foo/.git-keep rename to tests/integration/multiple-failures/main/pkgs/by-name/fo/foo/.git-keep diff --git a/tests/top-level/multiple-failures/main/someDrv.nix b/tests/integration/multiple-failures/main/someDrv.nix similarity index 100% rename from tests/top-level/multiple-failures/main/someDrv.nix rename to tests/integration/multiple-failures/main/someDrv.nix diff --git a/tests/top-level/new-package-non-by-name/base/default.nix b/tests/integration/new-package-non-by-name/base/default.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/base/default.nix rename to tests/integration/new-package-non-by-name/base/default.nix diff --git a/tests/top-level/new-package-non-by-name/base/pkgs/by-name/README.md b/tests/integration/new-package-non-by-name/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/new-package-non-by-name/base/pkgs/by-name/README.md rename to tests/integration/new-package-non-by-name/base/pkgs/by-name/README.md diff --git a/tests/top-level/new-package-non-by-name/base/pkgs/top-level/all-packages.nix b/tests/integration/new-package-non-by-name/base/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/base/pkgs/top-level/all-packages.nix rename to tests/integration/new-package-non-by-name/base/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/new-package-non-by-name/expected b/tests/integration/new-package-non-by-name/expected similarity index 100% rename from tests/top-level/new-package-non-by-name/expected rename to tests/integration/new-package-non-by-name/expected diff --git a/tests/top-level/new-package-non-by-name/main/default.nix b/tests/integration/new-package-non-by-name/main/default.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/main/default.nix rename to tests/integration/new-package-non-by-name/main/default.nix diff --git a/tests/top-level/new-package-non-by-name/main/pkgs/by-name/README.md b/tests/integration/new-package-non-by-name/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/new-package-non-by-name/main/pkgs/by-name/README.md rename to tests/integration/new-package-non-by-name/main/pkgs/by-name/README.md diff --git a/tests/top-level/new-package-non-by-name/main/pkgs/top-level/all-packages.nix b/tests/integration/new-package-non-by-name/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/main/pkgs/top-level/all-packages.nix rename to tests/integration/new-package-non-by-name/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/new-package-non-by-name/main/with-config.nix b/tests/integration/new-package-non-by-name/main/with-config.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/main/with-config.nix rename to tests/integration/new-package-non-by-name/main/with-config.nix diff --git a/tests/top-level/new-package-non-by-name/main/without-config.nix b/tests/integration/new-package-non-by-name/main/without-config.nix similarity index 100% rename from tests/top-level/new-package-non-by-name/main/without-config.nix rename to tests/integration/new-package-non-by-name/main/without-config.nix diff --git a/tests/top-level/new-plain-derivation-strict-deps-unset/expected b/tests/integration/new-plain-derivation-strict-deps-unset/expected similarity index 100% rename from tests/top-level/new-plain-derivation-strict-deps-unset/expected rename to tests/integration/new-plain-derivation-strict-deps-unset/expected diff --git a/tests/top-level/new-plain-derivation-strict-deps-unset/main/default.nix b/tests/integration/new-plain-derivation-strict-deps-unset/main/default.nix similarity index 100% rename from tests/top-level/new-plain-derivation-strict-deps-unset/main/default.nix rename to tests/integration/new-plain-derivation-strict-deps-unset/main/default.nix diff --git a/tests/top-level/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/README.md b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/README.md rename to tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/README.md diff --git a/tests/top-level/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/new-plain-derivation-structured-attrs-unset/expected b/tests/integration/new-plain-derivation-structured-attrs-unset/expected similarity index 100% rename from tests/top-level/new-plain-derivation-structured-attrs-unset/expected rename to tests/integration/new-plain-derivation-structured-attrs-unset/expected diff --git a/tests/top-level/new-plain-derivation-structured-attrs-unset/main/default.nix b/tests/integration/new-plain-derivation-structured-attrs-unset/main/default.nix similarity index 100% rename from tests/top-level/new-plain-derivation-structured-attrs-unset/main/default.nix rename to tests/integration/new-plain-derivation-structured-attrs-unset/main/default.nix diff --git a/tests/top-level/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/README.md b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/README.md rename to tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/README.md diff --git a/tests/top-level/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/new-plain-derivation/expected b/tests/integration/new-plain-derivation/expected similarity index 100% rename from tests/top-level/new-plain-derivation/expected rename to tests/integration/new-plain-derivation/expected diff --git a/tests/top-level/new-plain-derivation/main/default.nix b/tests/integration/new-plain-derivation/main/default.nix similarity index 100% rename from tests/top-level/new-plain-derivation/main/default.nix rename to tests/integration/new-plain-derivation/main/default.nix diff --git a/tests/top-level/new-plain-derivation/main/pkgs/by-name/README.md b/tests/integration/new-plain-derivation/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/new-plain-derivation/main/pkgs/by-name/README.md rename to tests/integration/new-plain-derivation/main/pkgs/by-name/README.md diff --git a/tests/top-level/new-plain-derivation/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/new-plain-derivation/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/new-plain-derivation/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/nix-file-executable/expected b/tests/integration/nix-file-executable/expected similarity index 100% rename from tests/top-level/nix-file-executable/expected rename to tests/integration/nix-file-executable/expected diff --git a/tests/top-level/nix-file-executable/main/default.nix b/tests/integration/nix-file-executable/main/default.nix similarity index 100% rename from tests/top-level/nix-file-executable/main/default.nix rename to tests/integration/nix-file-executable/main/default.nix diff --git a/tests/top-level/nix-file-executable/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/nix-file-executable/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/nix-file-executable/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/nix-file-executable/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/nix-file-shebang-executable/expected b/tests/integration/nix-file-shebang-executable/expected similarity index 100% rename from tests/top-level/nix-file-shebang-executable/expected rename to tests/integration/nix-file-shebang-executable/expected diff --git a/tests/top-level/nix-file-shebang-executable/main/default.nix b/tests/integration/nix-file-shebang-executable/main/default.nix similarity index 100% rename from tests/top-level/nix-file-shebang-executable/main/default.nix rename to tests/integration/nix-file-shebang-executable/main/default.nix diff --git a/tests/top-level/nix-file-shebang-executable/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/nix-file-shebang-executable/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/nix-file-shebang-executable/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/nix-file-shebang-executable/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/nix-file-shebang-not-executable/expected b/tests/integration/nix-file-shebang-not-executable/expected similarity index 100% rename from tests/top-level/nix-file-shebang-not-executable/expected rename to tests/integration/nix-file-shebang-not-executable/expected diff --git a/tests/top-level/nix-file-shebang-not-executable/main/default.nix b/tests/integration/nix-file-shebang-not-executable/main/default.nix similarity index 100% rename from tests/top-level/nix-file-shebang-not-executable/main/default.nix rename to tests/integration/nix-file-shebang-not-executable/main/default.nix diff --git a/tests/top-level/nix-file-shebang-not-executable/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/nix-file-shebang-not-executable/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/nix-file-shebang-not-executable/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/nix-file-shebang-not-executable/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/no-by-name/expected b/tests/integration/no-by-name/expected similarity index 100% rename from tests/top-level/no-by-name/expected rename to tests/integration/no-by-name/expected diff --git a/tests/top-level/no-by-name/main/default.nix b/tests/integration/no-by-name/main/default.nix similarity index 100% rename from tests/top-level/no-by-name/main/default.nix rename to tests/integration/no-by-name/main/default.nix diff --git a/tests/top-level/no-eval/base/default.nix b/tests/integration/no-eval/base/default.nix similarity index 100% rename from tests/top-level/no-eval/base/default.nix rename to tests/integration/no-eval/base/default.nix diff --git a/tests/top-level/no-eval/base/pkgs/by-name/README.md b/tests/integration/no-eval/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/no-eval/base/pkgs/by-name/README.md rename to tests/integration/no-eval/base/pkgs/by-name/README.md diff --git a/tests/top-level/no-eval/base/pkgs/top-level/all-packages.nix b/tests/integration/no-eval/base/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/no-eval/base/pkgs/top-level/all-packages.nix rename to tests/integration/no-eval/base/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/no-eval/expected b/tests/integration/no-eval/expected similarity index 100% rename from tests/top-level/no-eval/expected rename to tests/integration/no-eval/expected diff --git a/tests/top-level/no-eval/main/default.nix b/tests/integration/no-eval/main/default.nix similarity index 100% rename from tests/top-level/no-eval/main/default.nix rename to tests/integration/no-eval/main/default.nix diff --git a/tests/top-level/no-eval/main/pkgs/by-name/README.md b/tests/integration/no-eval/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/no-eval/main/pkgs/by-name/README.md rename to tests/integration/no-eval/main/pkgs/by-name/README.md diff --git a/tests/top-level/no-eval/main/pkgs/top-level/all-packages.nix b/tests/integration/no-eval/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/no-eval/main/pkgs/top-level/all-packages.nix rename to tests/integration/no-eval/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/non-attrs/expected b/tests/integration/non-attrs/expected similarity index 100% rename from tests/top-level/non-attrs/expected rename to tests/integration/non-attrs/expected diff --git a/tests/top-level/non-attrs/main/default.nix b/tests/integration/non-attrs/main/default.nix similarity index 100% rename from tests/top-level/non-attrs/main/default.nix rename to tests/integration/non-attrs/main/default.nix diff --git a/tests/top-level/non-attrs/main/pkgs/by-name/no/nonDerivation/package.nix b/tests/integration/non-attrs/main/pkgs/by-name/no/nonDerivation/package.nix similarity index 100% rename from tests/top-level/non-attrs/main/pkgs/by-name/no/nonDerivation/package.nix rename to tests/integration/non-attrs/main/pkgs/by-name/no/nonDerivation/package.nix diff --git a/tests/top-level/non-by-name-trace/expected b/tests/integration/non-by-name-trace/expected similarity index 100% rename from tests/top-level/non-by-name-trace/expected rename to tests/integration/non-by-name-trace/expected diff --git a/tests/top-level/non-by-name-trace/main/README.md b/tests/integration/non-by-name-trace/main/README.md similarity index 100% rename from tests/top-level/non-by-name-trace/main/README.md rename to tests/integration/non-by-name-trace/main/README.md diff --git a/tests/top-level/non-by-name-trace/main/default.nix b/tests/integration/non-by-name-trace/main/default.nix similarity index 100% rename from tests/top-level/non-by-name-trace/main/default.nix rename to tests/integration/non-by-name-trace/main/default.nix diff --git a/tests/top-level/non-by-name-trace/main/pkgs/top-level/all-packages.nix b/tests/integration/non-by-name-trace/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/non-by-name-trace/main/pkgs/top-level/all-packages.nix rename to tests/integration/non-by-name-trace/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/non-derivation/expected b/tests/integration/non-derivation/expected similarity index 100% rename from tests/top-level/non-derivation/expected rename to tests/integration/non-derivation/expected diff --git a/tests/top-level/non-derivation/main/default.nix b/tests/integration/non-derivation/main/default.nix similarity index 100% rename from tests/top-level/non-derivation/main/default.nix rename to tests/integration/non-derivation/main/default.nix diff --git a/tests/top-level/non-derivation/main/pkgs/by-name/no/nonDerivation/package.nix b/tests/integration/non-derivation/main/pkgs/by-name/no/nonDerivation/package.nix similarity index 100% rename from tests/top-level/non-derivation/main/pkgs/by-name/no/nonDerivation/package.nix rename to tests/integration/non-derivation/main/pkgs/by-name/no/nonDerivation/package.nix diff --git a/tests/top-level/one-letter/expected b/tests/integration/one-letter/expected similarity index 100% rename from tests/top-level/one-letter/expected rename to tests/integration/one-letter/expected diff --git a/tests/top-level/one-letter/main/default.nix b/tests/integration/one-letter/main/default.nix similarity index 100% rename from tests/top-level/one-letter/main/default.nix rename to tests/integration/one-letter/main/default.nix diff --git a/tests/top-level/one-letter/main/pkgs/by-name/a/a/package.nix b/tests/integration/one-letter/main/pkgs/by-name/a/a/package.nix similarity index 100% rename from tests/top-level/one-letter/main/pkgs/by-name/a/a/package.nix rename to tests/integration/one-letter/main/pkgs/by-name/a/a/package.nix diff --git a/tests/top-level/only-callPackage-derivations/expected b/tests/integration/only-callPackage-derivations/expected similarity index 100% rename from tests/top-level/only-callPackage-derivations/expected rename to tests/integration/only-callPackage-derivations/expected diff --git a/tests/top-level/only-callPackage-derivations/main/default.nix b/tests/integration/only-callPackage-derivations/main/default.nix similarity index 100% rename from tests/top-level/only-callPackage-derivations/main/default.nix rename to tests/integration/only-callPackage-derivations/main/default.nix diff --git a/tests/top-level/only-callPackage-derivations/main/pkgs/by-name/README.md b/tests/integration/only-callPackage-derivations/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/only-callPackage-derivations/main/pkgs/by-name/README.md rename to tests/integration/only-callPackage-derivations/main/pkgs/by-name/README.md diff --git a/tests/top-level/only-callPackage-derivations/main/pkgs/top-level/all-packages.nix b/tests/integration/only-callPackage-derivations/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/only-callPackage-derivations/main/pkgs/top-level/all-packages.nix rename to tests/integration/only-callPackage-derivations/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/optional-list-param/expected b/tests/integration/optional-list-param/expected similarity index 100% rename from tests/top-level/optional-list-param/expected rename to tests/integration/optional-list-param/expected diff --git a/tests/top-level/optional-list-param/main/default.nix b/tests/integration/optional-list-param/main/default.nix similarity index 100% rename from tests/top-level/optional-list-param/main/default.nix rename to tests/integration/optional-list-param/main/default.nix diff --git a/tests/top-level/package-dir-is-file/expected b/tests/integration/package-dir-is-file/expected similarity index 100% rename from tests/top-level/package-dir-is-file/expected rename to tests/integration/package-dir-is-file/expected diff --git a/tests/top-level/package-dir-is-file/main/default.nix b/tests/integration/package-dir-is-file/main/default.nix similarity index 100% rename from tests/top-level/package-dir-is-file/main/default.nix rename to tests/integration/package-dir-is-file/main/default.nix diff --git a/tests/top-level/package-dir-is-file/main/pkgs/by-name/fo/foo b/tests/integration/package-dir-is-file/main/pkgs/by-name/fo/foo similarity index 100% rename from tests/top-level/package-dir-is-file/main/pkgs/by-name/fo/foo rename to tests/integration/package-dir-is-file/main/pkgs/by-name/fo/foo diff --git a/tests/top-level/package-nix-dir/expected b/tests/integration/package-nix-dir/expected similarity index 100% rename from tests/top-level/package-nix-dir/expected rename to tests/integration/package-nix-dir/expected diff --git a/tests/top-level/package-nix-dir/main/default.nix b/tests/integration/package-nix-dir/main/default.nix similarity index 100% rename from tests/top-level/package-nix-dir/main/default.nix rename to tests/integration/package-nix-dir/main/default.nix diff --git a/tests/top-level/package-nix-dir/main/pkgs/by-name/fo/foo/package.nix/default.nix b/tests/integration/package-nix-dir/main/pkgs/by-name/fo/foo/package.nix/default.nix similarity index 100% rename from tests/top-level/package-nix-dir/main/pkgs/by-name/fo/foo/package.nix/default.nix rename to tests/integration/package-nix-dir/main/pkgs/by-name/fo/foo/package.nix/default.nix diff --git a/tests/top-level/package-variants/base/default.nix b/tests/integration/package-variants/base/default.nix similarity index 100% rename from tests/top-level/package-variants/base/default.nix rename to tests/integration/package-variants/base/default.nix diff --git a/tests/top-level/package-variants/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/package-variants/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/package-variants/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/package-variants/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/package-variants/base/pkgs/top-level/all-packages.nix b/tests/integration/package-variants/base/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/package-variants/base/pkgs/top-level/all-packages.nix rename to tests/integration/package-variants/base/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/package-variants/expected b/tests/integration/package-variants/expected similarity index 100% rename from tests/top-level/package-variants/expected rename to tests/integration/package-variants/expected diff --git a/tests/top-level/package-variants/main/default.nix b/tests/integration/package-variants/main/default.nix similarity index 100% rename from tests/top-level/package-variants/main/default.nix rename to tests/integration/package-variants/main/default.nix diff --git a/tests/top-level/package-variants/main/package.nix b/tests/integration/package-variants/main/package.nix similarity index 100% rename from tests/top-level/package-variants/main/package.nix rename to tests/integration/package-variants/main/package.nix diff --git a/tests/top-level/package-variants/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/package-variants/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/package-variants/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/package-variants/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/package-variants/main/pkgs/top-level/all-packages.nix b/tests/integration/package-variants/main/pkgs/top-level/all-packages.nix similarity index 100% rename from tests/top-level/package-variants/main/pkgs/top-level/all-packages.nix rename to tests/integration/package-variants/main/pkgs/top-level/all-packages.nix diff --git a/tests/top-level/ref-absolute/expected b/tests/integration/ref-absolute/expected similarity index 100% rename from tests/top-level/ref-absolute/expected rename to tests/integration/ref-absolute/expected diff --git a/tests/top-level/ref-absolute/main/default.nix b/tests/integration/ref-absolute/main/default.nix similarity index 100% rename from tests/top-level/ref-absolute/main/default.nix rename to tests/integration/ref-absolute/main/default.nix diff --git a/tests/top-level/ref-absolute/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-absolute/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-absolute/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-absolute/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/ref-escape/expected b/tests/integration/ref-escape/expected similarity index 100% rename from tests/top-level/ref-escape/expected rename to tests/integration/ref-escape/expected diff --git a/tests/top-level/ref-escape/main/default.nix b/tests/integration/ref-escape/main/default.nix similarity index 100% rename from tests/top-level/ref-escape/main/default.nix rename to tests/integration/ref-escape/main/default.nix diff --git a/tests/top-level/ref-escape/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-escape/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-escape/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-escape/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/ref-home-path/expected b/tests/integration/ref-home-path/expected similarity index 100% rename from tests/top-level/ref-home-path/expected rename to tests/integration/ref-home-path/expected diff --git a/tests/top-level/ref-home-path/main/default.nix b/tests/integration/ref-home-path/main/default.nix similarity index 100% rename from tests/top-level/ref-home-path/main/default.nix rename to tests/integration/ref-home-path/main/default.nix diff --git a/tests/top-level/ref-home-path/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-home-path/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-home-path/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-home-path/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/ref-nix-path/expected b/tests/integration/ref-nix-path/expected similarity index 100% rename from tests/top-level/ref-nix-path/expected rename to tests/integration/ref-nix-path/expected diff --git a/tests/top-level/ref-nix-path/main/default.nix b/tests/integration/ref-nix-path/main/default.nix similarity index 100% rename from tests/top-level/ref-nix-path/main/default.nix rename to tests/integration/ref-nix-path/main/default.nix diff --git a/tests/top-level/ref-nix-path/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-nix-path/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-nix-path/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-nix-path/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/ref-path-subexpr/expected b/tests/integration/ref-path-subexpr/expected similarity index 100% rename from tests/top-level/ref-path-subexpr/expected rename to tests/integration/ref-path-subexpr/expected diff --git a/tests/top-level/ref-path-subexpr/main/default.nix b/tests/integration/ref-path-subexpr/main/default.nix similarity index 100% rename from tests/top-level/ref-path-subexpr/main/default.nix rename to tests/integration/ref-path-subexpr/main/default.nix diff --git a/tests/top-level/ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-path-subexpr/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/ref-success/expected b/tests/integration/ref-success/expected similarity index 100% rename from tests/top-level/ref-success/expected rename to tests/integration/ref-success/expected diff --git a/tests/top-level/ref-success/main/default.nix b/tests/integration/ref-success/main/default.nix similarity index 100% rename from tests/top-level/ref-success/main/default.nix rename to tests/integration/ref-success/main/default.nix diff --git a/tests/top-level/ref-success/main/pkgs/by-name/aa/aa/dir/default.nix b/tests/integration/ref-success/main/pkgs/by-name/aa/aa/dir/default.nix similarity index 100% rename from tests/top-level/ref-success/main/pkgs/by-name/aa/aa/dir/default.nix rename to tests/integration/ref-success/main/pkgs/by-name/aa/aa/dir/default.nix diff --git a/tests/top-level/ref-success/main/pkgs/by-name/aa/aa/file b/tests/integration/ref-success/main/pkgs/by-name/aa/aa/file similarity index 100% rename from tests/top-level/ref-success/main/pkgs/by-name/aa/aa/file rename to tests/integration/ref-success/main/pkgs/by-name/aa/aa/file diff --git a/tests/top-level/ref-success/main/pkgs/by-name/aa/aa/file.nix b/tests/integration/ref-success/main/pkgs/by-name/aa/aa/file.nix similarity index 100% rename from tests/top-level/ref-success/main/pkgs/by-name/aa/aa/file.nix rename to tests/integration/ref-success/main/pkgs/by-name/aa/aa/file.nix diff --git a/tests/top-level/ref-success/main/pkgs/by-name/aa/aa/package.nix b/tests/integration/ref-success/main/pkgs/by-name/aa/aa/package.nix similarity index 100% rename from tests/top-level/ref-success/main/pkgs/by-name/aa/aa/package.nix rename to tests/integration/ref-success/main/pkgs/by-name/aa/aa/package.nix diff --git a/tests/top-level/shard-file/expected b/tests/integration/shard-file/expected similarity index 100% rename from tests/top-level/shard-file/expected rename to tests/integration/shard-file/expected diff --git a/tests/top-level/shard-file/main/default.nix b/tests/integration/shard-file/main/default.nix similarity index 100% rename from tests/top-level/shard-file/main/default.nix rename to tests/integration/shard-file/main/default.nix diff --git a/tests/top-level/shard-file/main/pkgs/by-name/fo b/tests/integration/shard-file/main/pkgs/by-name/fo similarity index 100% rename from tests/top-level/shard-file/main/pkgs/by-name/fo rename to tests/integration/shard-file/main/pkgs/by-name/fo diff --git a/tests/top-level/strict-deps-new-false/expected b/tests/integration/strict-deps-new-false/expected similarity index 100% rename from tests/top-level/strict-deps-new-false/expected rename to tests/integration/strict-deps-new-false/expected diff --git a/tests/top-level/strict-deps-new-false/main/default.nix b/tests/integration/strict-deps-new-false/main/default.nix similarity index 100% rename from tests/top-level/strict-deps-new-false/main/default.nix rename to tests/integration/strict-deps-new-false/main/default.nix diff --git a/tests/top-level/strict-deps-new-false/main/pkgs/by-name/README.md b/tests/integration/strict-deps-new-false/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-new-false/main/pkgs/by-name/README.md rename to tests/integration/strict-deps-new-false/main/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-new-false/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-false/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-new-false/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-new-false/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/strict-deps-new-passthru/expected b/tests/integration/strict-deps-new-passthru/expected similarity index 100% rename from tests/top-level/strict-deps-new-passthru/expected rename to tests/integration/strict-deps-new-passthru/expected diff --git a/tests/top-level/strict-deps-new-passthru/main/default.nix b/tests/integration/strict-deps-new-passthru/main/default.nix similarity index 100% rename from tests/top-level/strict-deps-new-passthru/main/default.nix rename to tests/integration/strict-deps-new-passthru/main/default.nix diff --git a/tests/top-level/strict-deps-new-passthru/main/pkgs/by-name/README.md b/tests/integration/strict-deps-new-passthru/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-new-passthru/main/pkgs/by-name/README.md rename to tests/integration/strict-deps-new-passthru/main/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-new-passthru/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-passthru/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-new-passthru/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-new-passthru/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/strict-deps-new-true/expected b/tests/integration/strict-deps-new-true/expected similarity index 100% rename from tests/top-level/strict-deps-new-true/expected rename to tests/integration/strict-deps-new-true/expected diff --git a/tests/top-level/strict-deps-new-true/main/default.nix b/tests/integration/strict-deps-new-true/main/default.nix similarity index 100% rename from tests/top-level/strict-deps-new-true/main/default.nix rename to tests/integration/strict-deps-new-true/main/default.nix diff --git a/tests/top-level/strict-deps-new-true/main/pkgs/by-name/README.md b/tests/integration/strict-deps-new-true/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-new-true/main/pkgs/by-name/README.md rename to tests/integration/strict-deps-new-true/main/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-new-true/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-true/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-new-true/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-new-true/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/strict-deps-new-unset/expected b/tests/integration/strict-deps-new-unset/expected similarity index 100% rename from tests/top-level/strict-deps-new-unset/expected rename to tests/integration/strict-deps-new-unset/expected diff --git a/tests/top-level/strict-deps-new-unset/main/default.nix b/tests/integration/strict-deps-new-unset/main/default.nix similarity index 100% rename from tests/top-level/strict-deps-new-unset/main/default.nix rename to tests/integration/strict-deps-new-unset/main/default.nix diff --git a/tests/top-level/strict-deps-new-unset/main/pkgs/by-name/README.md b/tests/integration/strict-deps-new-unset/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-new-unset/main/pkgs/by-name/README.md rename to tests/integration/strict-deps-new-unset/main/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-new-unset/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-unset/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-new-unset/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-new-unset/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/strict-deps-regression/base/default.nix b/tests/integration/strict-deps-regression/base/default.nix similarity index 100% rename from tests/top-level/strict-deps-regression/base/default.nix rename to tests/integration/strict-deps-regression/base/default.nix diff --git a/tests/top-level/strict-deps-regression/base/pkgs/by-name/README.md b/tests/integration/strict-deps-regression/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-regression/base/pkgs/by-name/README.md rename to tests/integration/strict-deps-regression/base/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-regression/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-regression/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-regression/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-regression/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/strict-deps-regression/expected b/tests/integration/strict-deps-regression/expected similarity index 100% rename from tests/top-level/strict-deps-regression/expected rename to tests/integration/strict-deps-regression/expected diff --git a/tests/top-level/strict-deps-regression/main/default.nix b/tests/integration/strict-deps-regression/main/default.nix similarity index 100% rename from tests/top-level/strict-deps-regression/main/default.nix rename to tests/integration/strict-deps-regression/main/default.nix diff --git a/tests/top-level/strict-deps-regression/main/pkgs/by-name/README.md b/tests/integration/strict-deps-regression/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/strict-deps-regression/main/pkgs/by-name/README.md rename to tests/integration/strict-deps-regression/main/pkgs/by-name/README.md diff --git a/tests/top-level/strict-deps-regression/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/strict-deps-regression/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/strict-deps-regression/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/strict-deps-regression/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-new-false/expected b/tests/integration/structured-attrs-new-false/expected similarity index 100% rename from tests/top-level/structured-attrs-new-false/expected rename to tests/integration/structured-attrs-new-false/expected diff --git a/tests/top-level/structured-attrs-new-false/main/default.nix b/tests/integration/structured-attrs-new-false/main/default.nix similarity index 100% rename from tests/top-level/structured-attrs-new-false/main/default.nix rename to tests/integration/structured-attrs-new-false/main/default.nix diff --git a/tests/top-level/structured-attrs-new-false/main/pkgs/by-name/README.md b/tests/integration/structured-attrs-new-false/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-new-false/main/pkgs/by-name/README.md rename to tests/integration/structured-attrs-new-false/main/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-new-false/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-false/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-new-false/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-new-false/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-new-passthru/expected b/tests/integration/structured-attrs-new-passthru/expected similarity index 100% rename from tests/top-level/structured-attrs-new-passthru/expected rename to tests/integration/structured-attrs-new-passthru/expected diff --git a/tests/top-level/structured-attrs-new-passthru/main/default.nix b/tests/integration/structured-attrs-new-passthru/main/default.nix similarity index 100% rename from tests/top-level/structured-attrs-new-passthru/main/default.nix rename to tests/integration/structured-attrs-new-passthru/main/default.nix diff --git a/tests/top-level/structured-attrs-new-passthru/main/pkgs/by-name/README.md b/tests/integration/structured-attrs-new-passthru/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-new-passthru/main/pkgs/by-name/README.md rename to tests/integration/structured-attrs-new-passthru/main/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-new-passthru/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-passthru/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-new-passthru/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-new-passthru/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-new-true/expected b/tests/integration/structured-attrs-new-true/expected similarity index 100% rename from tests/top-level/structured-attrs-new-true/expected rename to tests/integration/structured-attrs-new-true/expected diff --git a/tests/top-level/structured-attrs-new-true/main/default.nix b/tests/integration/structured-attrs-new-true/main/default.nix similarity index 100% rename from tests/top-level/structured-attrs-new-true/main/default.nix rename to tests/integration/structured-attrs-new-true/main/default.nix diff --git a/tests/top-level/structured-attrs-new-true/main/pkgs/by-name/README.md b/tests/integration/structured-attrs-new-true/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-new-true/main/pkgs/by-name/README.md rename to tests/integration/structured-attrs-new-true/main/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-new-true/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-true/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-new-true/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-new-true/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-new-unset/expected b/tests/integration/structured-attrs-new-unset/expected similarity index 100% rename from tests/top-level/structured-attrs-new-unset/expected rename to tests/integration/structured-attrs-new-unset/expected diff --git a/tests/top-level/structured-attrs-new-unset/main/default.nix b/tests/integration/structured-attrs-new-unset/main/default.nix similarity index 100% rename from tests/top-level/structured-attrs-new-unset/main/default.nix rename to tests/integration/structured-attrs-new-unset/main/default.nix diff --git a/tests/top-level/structured-attrs-new-unset/main/pkgs/by-name/README.md b/tests/integration/structured-attrs-new-unset/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-new-unset/main/pkgs/by-name/README.md rename to tests/integration/structured-attrs-new-unset/main/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-new-unset/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-unset/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-new-unset/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-new-unset/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-regression/base/default.nix b/tests/integration/structured-attrs-regression/base/default.nix similarity index 100% rename from tests/top-level/structured-attrs-regression/base/default.nix rename to tests/integration/structured-attrs-regression/base/default.nix diff --git a/tests/top-level/structured-attrs-regression/base/pkgs/by-name/README.md b/tests/integration/structured-attrs-regression/base/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-regression/base/pkgs/by-name/README.md rename to tests/integration/structured-attrs-regression/base/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-regression/base/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-regression/base/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-regression/base/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-regression/base/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/structured-attrs-regression/expected b/tests/integration/structured-attrs-regression/expected similarity index 100% rename from tests/top-level/structured-attrs-regression/expected rename to tests/integration/structured-attrs-regression/expected diff --git a/tests/top-level/structured-attrs-regression/main/default.nix b/tests/integration/structured-attrs-regression/main/default.nix similarity index 100% rename from tests/top-level/structured-attrs-regression/main/default.nix rename to tests/integration/structured-attrs-regression/main/default.nix diff --git a/tests/top-level/structured-attrs-regression/main/pkgs/by-name/README.md b/tests/integration/structured-attrs-regression/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/structured-attrs-regression/main/pkgs/by-name/README.md rename to tests/integration/structured-attrs-regression/main/pkgs/by-name/README.md diff --git a/tests/top-level/structured-attrs-regression/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-regression/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/structured-attrs-regression/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/structured-attrs-regression/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/success/expected b/tests/integration/success/expected similarity index 100% rename from tests/top-level/success/expected rename to tests/integration/success/expected diff --git a/tests/top-level/success/main/default.nix b/tests/integration/success/main/default.nix similarity index 100% rename from tests/top-level/success/main/default.nix rename to tests/integration/success/main/default.nix diff --git a/tests/top-level/success/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/success/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/success/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/success/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/symlink-escape/expected b/tests/integration/symlink-escape/expected similarity index 100% rename from tests/top-level/symlink-escape/expected rename to tests/integration/symlink-escape/expected diff --git a/tests/top-level/symlink-escape/main/default.nix b/tests/integration/symlink-escape/main/default.nix similarity index 100% rename from tests/top-level/symlink-escape/main/default.nix rename to tests/integration/symlink-escape/main/default.nix diff --git a/tests/top-level/symlink-escape/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/symlink-escape/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/symlink-escape/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/symlink-escape/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/symlink-escape/main/someDrv.nix b/tests/integration/symlink-escape/main/someDrv.nix similarity index 100% rename from tests/top-level/symlink-escape/main/someDrv.nix rename to tests/integration/symlink-escape/main/someDrv.nix diff --git a/tests/top-level/symlink-invalid/expected b/tests/integration/symlink-invalid/expected similarity index 100% rename from tests/top-level/symlink-invalid/expected rename to tests/integration/symlink-invalid/expected diff --git a/tests/top-level/symlink-invalid/main/default.nix b/tests/integration/symlink-invalid/main/default.nix similarity index 100% rename from tests/top-level/symlink-invalid/main/default.nix rename to tests/integration/symlink-invalid/main/default.nix diff --git a/tests/top-level/symlink-invalid/main/pkgs/by-name/fo/foo/foo b/tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/foo similarity index 100% rename from tests/top-level/symlink-invalid/main/pkgs/by-name/fo/foo/foo rename to tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/foo diff --git a/tests/top-level/symlink-invalid/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/symlink-invalid/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/symlink-invalid/main/someDrv.nix b/tests/integration/symlink-invalid/main/someDrv.nix similarity index 100% rename from tests/top-level/symlink-invalid/main/someDrv.nix rename to tests/integration/symlink-invalid/main/someDrv.nix diff --git a/tests/top-level/uppercase/expected b/tests/integration/uppercase/expected similarity index 100% rename from tests/top-level/uppercase/expected rename to tests/integration/uppercase/expected diff --git a/tests/top-level/uppercase/main/default.nix b/tests/integration/uppercase/main/default.nix similarity index 100% rename from tests/top-level/uppercase/main/default.nix rename to tests/integration/uppercase/main/default.nix diff --git a/tests/top-level/uppercase/main/pkgs/by-name/fo/FOO/package.nix b/tests/integration/uppercase/main/pkgs/by-name/fo/FOO/package.nix similarity index 100% rename from tests/top-level/uppercase/main/pkgs/by-name/fo/FOO/package.nix rename to tests/integration/uppercase/main/pkgs/by-name/fo/FOO/package.nix diff --git a/tests/top-level/useless-multi-line-escapes/expected b/tests/integration/useless-multi-line-escapes/expected similarity index 100% rename from tests/top-level/useless-multi-line-escapes/expected rename to tests/integration/useless-multi-line-escapes/expected diff --git a/tests/top-level/useless-multi-line-escapes/main/default.nix b/tests/integration/useless-multi-line-escapes/main/default.nix similarity index 100% rename from tests/top-level/useless-multi-line-escapes/main/default.nix rename to tests/integration/useless-multi-line-escapes/main/default.nix diff --git a/tests/top-level/useless-multi-line-escapes/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/useless-multi-line-escapes/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/useless-multi-line-escapes/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/useless-multi-line-escapes/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/useless-single-line-escapes/expected b/tests/integration/useless-single-line-escapes/expected similarity index 100% rename from tests/top-level/useless-single-line-escapes/expected rename to tests/integration/useless-single-line-escapes/expected diff --git a/tests/top-level/useless-single-line-escapes/main/default.nix b/tests/integration/useless-single-line-escapes/main/default.nix similarity index 100% rename from tests/top-level/useless-single-line-escapes/main/default.nix rename to tests/integration/useless-single-line-escapes/main/default.nix diff --git a/tests/top-level/useless-single-line-escapes/main/pkgs/by-name/fo/foo/package.nix b/tests/integration/useless-single-line-escapes/main/pkgs/by-name/fo/foo/package.nix similarity index 100% rename from tests/top-level/useless-single-line-escapes/main/pkgs/by-name/fo/foo/package.nix rename to tests/integration/useless-single-line-escapes/main/pkgs/by-name/fo/foo/package.nix diff --git a/tests/top-level/with-readme/expected b/tests/integration/with-readme/expected similarity index 100% rename from tests/top-level/with-readme/expected rename to tests/integration/with-readme/expected diff --git a/tests/top-level/with-readme/main/default.nix b/tests/integration/with-readme/main/default.nix similarity index 100% rename from tests/top-level/with-readme/main/default.nix rename to tests/integration/with-readme/main/default.nix diff --git a/tests/top-level/with-readme/main/pkgs/by-name/README.md b/tests/integration/with-readme/main/pkgs/by-name/README.md similarity index 100% rename from tests/top-level/with-readme/main/pkgs/by-name/README.md rename to tests/integration/with-readme/main/pkgs/by-name/README.md From 0d95e121a9a2de1be0c2c965b646b2b79fb9b493 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Mon, 28 Sep 2026 16:00:42 +0200 Subject: [PATCH 2/8] Replace const BASE_SUBPATH with function arguments There is not much more to what the commit message summary says. This commit changes the function signatures and doc comments throughout the codebase (where applicable) to include the subpath in nixpkgs where the by-name directory resides. This is the first step of making it possible to use multiple by-name directories. --- src/eval.nix | 10 +++---- src/eval.rs | 62 ++++++++++++++++++++++++------------------ src/main.rs | 21 +++++++++----- src/problem/npv_100.rs | 11 ++++++-- src/problem/npv_101.rs | 11 ++++++-- src/problem/npv_109.rs | 9 +++++- src/problem/npv_110.rs | 10 +++++-- src/problem/npv_111.rs | 15 ++++++++-- src/problem/npv_120.rs | 6 +++- src/problem/npv_140.rs | 11 ++++++-- src/problem/npv_142.rs | 6 +++- src/problem/npv_143.rs | 11 ++++++-- src/problem/npv_144.rs | 11 ++++++-- src/problem/npv_160.rs | 6 +++- src/problem/npv_162.rs | 6 +++- src/ratchet.rs | 35 +++++++++++++++++------- src/references.rs | 2 +- src/structure.rs | 44 ++++++++++++++++++------------ 18 files changed, 200 insertions(+), 87 deletions(-) diff --git a/src/eval.nix b/src/eval.nix index 3e63bece..e977e237 100644 --- a/src/eval.nix +++ b/src/eval.nix @@ -1,4 +1,4 @@ -# Takes a path to nixpkgs and a path to the json-encoded list of `pkgs/by-name` attributes. +# Takes a path to nixpkgs and a path to the json-encoded list of attributes in the by-name subpath. # # Returns a value containing information on all Nixpkgs attributes which is decoded on the Rust # side. See ./eval.rs for the meaning of the returned values. @@ -75,7 +75,7 @@ let }; }; - # Information on all attributes that are in `pkgs/by-name`. + # Information on all attributes that are in the by-name subpath. byNameAttrs = builtins.listToAttrs ( map (name: { inherit name; @@ -88,12 +88,12 @@ let }) attrs ); - # Information on all attributes that exist but are not in `pkgs/by-name`. - # We need this to enforce `pkgs/by-name` for new packages. + # Information on all attributes that exist but are not in the by-name subpath. + # We need this to enforce the by-name subpath for new packages. nonByNameAttrs = builtins.mapAttrs ( name: value: let - # Packages outside `pkgs/by-name` often fail evaluation, so we need to handle that. + # Packages outside the by-name subpath often fail evaluation, so we need to handle that. output = attrInfo name value; result = builtins.tryEval (builtins.deepSeq output null); in diff --git a/src/eval.rs b/src/eval.rs index 8b948da1..d4c2fd33 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -3,12 +3,11 @@ use std::path::{Path, PathBuf}; use std::{env, fs, process}; use anyhow::Context; -use relative_path::RelativePathBuf; +use relative_path::{RelativePath, RelativePathBuf}; use serde::Deserialize; use crate::problem::{npv_100, npv_101, npv_120}; use crate::ratchet::RatchetState::{Loose, Tight}; -use crate::structure::BASE_SUBPATH; use crate::validation::ResultIteratorExt as _; use crate::validation::{self, Validation::Success}; use crate::{NixFileStore, structure}; @@ -19,9 +18,9 @@ const EVAL_NIX: &[u8] = include_bytes!("eval.nix"); /// Attribute set of this structure is returned by `./eval.nix` #[derive(Deserialize)] enum Attribute { - /// An attribute that should be defined via `pkgs/by-name`. + /// An attribute that should be defined in the by-name subpath. ByName(ByNameAttribute), - /// An attribute not defined via `pkgs/by-name`. + /// An attribute not defined in the by-name subpath. NonByName(NonByNameAttribute), } @@ -144,13 +143,14 @@ fn mutate_nix_instatiate_arguments_based_on_cfg( Ok(()) } -/// Check that the Nixpkgs attribute values corresponding to the packages in `pkgs/by-name` are of +/// Check that the Nixpkgs attribute values corresponding to the packages in the given by-name subpath are of /// the form `callPackage { ... }`. See the `./eval.nix` file for how this is /// achieved on the Nix side. /// /// The validation result is a map from package names to a package ratchet state. pub fn check_values( nixpkgs_path: &Path, + by_name_subpath: &RelativePath, nix_file_store: &mut NixFileStore, package_names: &[String], ) -> validation::Result> { @@ -217,7 +217,11 @@ pub fn check_values( if !result.status.success() { // Early return in case evaluation fails - return Ok(npv_120::NixEvalError::new(String::from_utf8_lossy(&result.stderr)).into()); + return Ok(npv_120::NixEvalError::new( + by_name_subpath, + String::from_utf8_lossy(&result.stderr), + ) + .into()); } // Parse the resulting JSON value @@ -239,9 +243,10 @@ pub fn check_values( nix_file_store, &attribute_name, non_by_name_attribute, + by_name_subpath, )?, Attribute::ByName(by_name_attribute) => { - by_name(&attribute_name, by_name_attribute)? + by_name(&attribute_name, by_name_attribute, by_name_subpath)? } }; Ok::<_, anyhow::Error>(check_result.map(|value| (attribute_name.clone(), value))) @@ -252,19 +257,21 @@ pub fn check_values( Ok(check_result.map(|elems| elems.into_iter().collect())) } -/// Handle the evaluation result for an attribute in `pkgs/by-name`, making it a validation result. +/// Handle the evaluation result for an attribute in the by-name structure at the given by-name +/// subpath, making it a validation result. fn by_name( attribute_name: &str, by_name_attribute: ByNameAttribute, + by_name_subpath: &RelativePath, ) -> validation::Result { - // At this point we know that `pkgs/by-name/fo/foo/package.nix` has to exist. This match + // At this point we know that `{by_name_subpath}/fo/foo/package.nix` has to exist. This match // decides whether the attribute `foo` is defined accordingly. let result = match by_name_attribute { // The attribute is missing. ByNameAttribute::Missing => { - // This indicates a bug in the `pkgs/by-name` overlay, because it's supposed to - // automatically defined attributes in `pkgs/by-name` - npv_100::ByNameUndefinedAttribute::new(attribute_name).into() + // This indicates a bug in the by-name overlay, because it's supposed to + // automatically define all attributes in the by-name subpath + npv_100::ByNameUndefinedAttribute::new(by_name_subpath, attribute_name).into() } // The attribute exists ByNameAttribute::Existing(AttributeInfo { @@ -278,7 +285,7 @@ fn by_name( // // We can't know whether the attribute is automatically or manually defined for sure, // and while we could check the location, the error seems clear enough as is. - npv_101::ByNameNonDerivation::new(attribute_name).into() + npv_101::ByNameNonDerivation::new(by_name_subpath, attribute_name).into() } // The attribute exists ByNameAttribute::Existing(AttributeInfo { @@ -294,29 +301,29 @@ fn by_name( }, location: _, }) => { - // Only derivations are allowed in `pkgs/by-name`. + // Only derivations are allowed in the by-name subpath. if is_derivation { Success(ratchet::Package { uses_by_name: Tight, strict_deps: enabled_attribute_ratchet( strict_deps, - structure::relative_file_for_package(attribute_name), + structure::relative_file_for_package(by_name_subpath, attribute_name), ), structured_attrs: enabled_attribute_ratchet( structured_attrs, - structure::relative_file_for_package(attribute_name), + structure::relative_file_for_package(by_name_subpath, attribute_name), ), license_expression: enabled_attribute_ratchet( !uses_license_list, - structure::relative_file_for_package(attribute_name), + structure::relative_file_for_package(by_name_subpath, attribute_name), ), cargo_system_libs: enabled_attribute_ratchet( !cargo_system_libs_enabled, - structure::relative_file_for_package(attribute_name), + structure::relative_file_for_package(by_name_subpath, attribute_name), ), }) } else { - npv_101::ByNameNonDerivation::new(attribute_name).into() + npv_101::ByNameNonDerivation::new(by_name_subpath, attribute_name).into() } } }; @@ -337,6 +344,7 @@ fn handle_non_by_name_attribute( nix_file_store: &mut NixFileStore, attribute_name: &str, non_by_name_attribute: NonByNameAttribute, + by_name_subpath: &RelativePath, ) -> validation::Result { use NonByNameAttribute::EvalSuccess; use ratchet::RatchetState::{Loose, NonApplicable, Tight}; @@ -346,25 +354,25 @@ fn handle_non_by_name_attribute( // This is a big ol' match on various properties of the attribute // // First, it needs to succeed evaluation. We can't know whether an attribute could be - // migrated to `pkgs/by-name` if it doesn't evaluate, since we need to check that it's a + // migrated to the by-name subpath if it doesn't evaluate, since we need to check that it's a // derivation. // // This only has the minor negative effect that if a PR that breaks evaluation gets merged, - // fixing those failures won't force anything into `pkgs/by-name`. + // fixing those failures won't force anything into the by-name subpath. // // For now this isn't our problem, but in the future we might have another check to enforce // that evaluation must not be broken. // // The alternative of assuming that failing attributes would have been fit for - // `pkgs/by-name` has the problem that if a package evaluation gets broken temporarily, - // fixing it requires a move to pkgs/by-name, which could happen more often and isn't + // the by-name subpath has the problem that if a package evaluation gets broken temporarily, + // fixing it requires a move to the by-name subpath, which could happen more often and isn't // really justified. EvalSuccess(AttributeInfo { // We're only interested in attributes that are attribute sets, which all derivations - // are. Anything else can't be in `pkgs/by-name`. + // are. Anything else can't be in the by-name subpath. attribute_variant: AttributeVariant::AttributeSet { - // As of today, non-derivation attribute sets can't be in `pkgs/by-name`. + // As of today, non-derivation attribute sets can't be in any by-name subpaths. is_derivation: true, strict_deps, structured_attrs, @@ -410,7 +418,7 @@ fn handle_non_by_name_attribute( (true, Some(syntactic_call_package)) => { // It's only possible to migrate such definitions if.. match syntactic_call_package.relative_path { - Some(ref rel_path) if rel_path.starts_with(BASE_SUBPATH) => { + Some(ref rel_path) if rel_path.starts_with(by_name_subpath) => { // ..the path is not already within `pkgs/by-name` like // // foo-variant = callPackage ../by-name/fo/foo/package.nix { @@ -426,7 +434,7 @@ fn handle_non_by_name_attribute( // https://github.com/NixOS/rfcs/blob/master/rfcs/0140-simple-package-paths.md#package-variants NonApplicable } - _ => Loose((syntactic_call_package.clone(), location.file.clone())), + _ => Loose((syntactic_call_package.clone(), location.file.clone(), by_name_subpath.into())), } } }; diff --git a/src/main.rs b/src/main.rs index 37c3987b..85ca0418 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,7 @@ mod validation; use anyhow::Context as _; use clap::Parser; +use relative_path::RelativePathBuf; use std::collections::BTreeMap; use std::path::{Path, PathBuf}; use std::process::ExitCode; @@ -102,12 +103,13 @@ fn process(base_nixpkgs: PathBuf, main_nixpkgs: &Path) -> Status { } } -/// Checks whether the pkgs/by-name structure in Nixpkgs is valid. +/// Checks whether the by-name structure at the given path in Nixpkgs is valid. /// /// This does not include ratchet checks, see ../README.md#ratchet-checks /// Instead a `ratchet::Nixpkgs` value is returned, whose `compare` method allows performing the /// ratchet check against another result. fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { + let by_name_subpath = RelativePathBuf::from("pkgs/by-name"); let nixpkgs_path = nixpkgs_path.canonicalize().with_context(|| { format!( "Nixpkgs path {} could not be resolved", @@ -118,15 +120,20 @@ fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { let mut nix_file_store = NixFileStore::default(); let package_result = { - if !nixpkgs_path.join(structure::BASE_SUBPATH).exists() { - // No pkgs/by-name directory, always valid + if !nixpkgs_path.join(by_name_subpath.as_str()).exists() { + // No directory at the given location (e.g. pkgs/by-name), always valid Success(BTreeMap::new()) } else { - let structure = check_structure(&nixpkgs_path, &mut nix_file_store)?; + let structure = check_structure(&nixpkgs_path, &mut nix_file_store, &by_name_subpath)?; // Only if we could successfully parse the structure, we do the evaluation checks structure.result_map(|package_names| { - eval::check_values(&nixpkgs_path, &mut nix_file_store, package_names.as_slice()) + eval::check_values( + &nixpkgs_path, + &by_name_subpath, + &mut nix_file_store, + package_names.as_slice(), + ) })? } }; @@ -150,7 +157,7 @@ mod tests { use pretty_assertions::StrComparison; use tempfile::{TempDir, tempdir_in}; - use super::{process, structure::BASE_SUBPATH}; + use super::process; // Manually repeat this for each subdir under tests/ in order to disambiguate #[fixtures::fixtures(["tests/integration/*"])] @@ -188,7 +195,7 @@ mod tests { return Ok(()); } - let base = path.join("main").join(BASE_SUBPATH); + let base = path.join("main/pkgs/by-name"); fs::create_dir_all(base.join("fo/foo"))?; fs::write(base.join("fo/foo/package.nix"), "{ someDrv }: someDrv")?; diff --git a/src/problem/npv_100.rs b/src/problem/npv_100.rs index 76dd9591..53ea7226 100644 --- a/src/problem/npv_100.rs +++ b/src/problem/npv_100.rs @@ -1,19 +1,26 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct ByNameUndefinedAttribute { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] attribute_name: String, } impl fmt::Display for ByNameUndefinedAttribute { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { attribute_name } = self; - let relative_package_file = structure::relative_file_for_package(attribute_name); + let Self { + by_name_subpath, + attribute_name, + } = self; + let relative_package_file = + structure::relative_file_for_package(by_name_subpath, attribute_name); write!( f, "- {attribute_name}: This attribute is not defined but it should be defined automatically as {relative_package_file}", diff --git a/src/problem/npv_101.rs b/src/problem/npv_101.rs index 645df171..6b8bd492 100644 --- a/src/problem/npv_101.rs +++ b/src/problem/npv_101.rs @@ -1,19 +1,26 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct ByNameNonDerivation { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] attribute_name: String, } impl fmt::Display for ByNameNonDerivation { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { attribute_name } = self; - let relative_package_file = structure::relative_file_for_package(attribute_name); + let Self { + by_name_subpath, + attribute_name, + } = self; + let relative_package_file = + structure::relative_file_for_package(by_name_subpath, attribute_name); write!( f, "- {attribute_name}: This attribute defined by {relative_package_file} is not a derivation", diff --git a/src/problem/npv_109.rs b/src/problem/npv_109.rs index 294c6c4f..36b05826 100644 --- a/src/problem/npv_109.rs +++ b/src/problem/npv_109.rs @@ -1,18 +1,25 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct ByNameShardIsNotDirectory { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] shard_name: String, } impl fmt::Display for ByNameShardIsNotDirectory { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let relative_shard_path = structure::relative_dir_for_shard(&self.shard_name); + let Self { + by_name_subpath, + shard_name, + } = self; + let relative_shard_path = structure::relative_dir_for_shard(by_name_subpath, shard_name); write!( f, "- {relative_shard_path}: This is a file, but it should be a directory.", diff --git a/src/problem/npv_110.rs b/src/problem/npv_110.rs index 4f3a8e84..d13219cb 100644 --- a/src/problem/npv_110.rs +++ b/src/problem/npv_110.rs @@ -1,19 +1,25 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct ByNameShardIsInvalid { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] shard_name: String, } impl fmt::Display for ByNameShardIsInvalid { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let shard_name = &self.shard_name; - let relative_shard_path = structure::relative_dir_for_shard(shard_name); + let Self { + by_name_subpath, + shard_name, + } = self; + let relative_shard_path = structure::relative_dir_for_shard(by_name_subpath, shard_name); write!( f, "- {relative_shard_path}: Invalid directory name \"{shard_name}\", must be at most 2 ASCII characters, starting with a-z or \"_\", consisting of a-z, 0-9, \"-\" or \"_\".", diff --git a/src/problem/npv_111.rs b/src/problem/npv_111.rs index f9c329f6..f39709c9 100644 --- a/src/problem/npv_111.rs +++ b/src/problem/npv_111.rs @@ -2,11 +2,14 @@ use std::ffi::OsString; use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct ByNameShardIsCaseSensitiveDuplicate { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] shard_name: String, first: OsString, @@ -15,9 +18,15 @@ pub struct ByNameShardIsCaseSensitiveDuplicate { impl fmt::Display for ByNameShardIsCaseSensitiveDuplicate { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let relative_shard_path = structure::relative_dir_for_shard(&self.shard_name); - let first = self.first.to_string_lossy(); - let second = self.second.to_string_lossy(); + let Self { + by_name_subpath, + shard_name, + first, + second, + } = self; + let relative_shard_path = structure::relative_dir_for_shard(by_name_subpath, shard_name); + let first = first.to_string_lossy(); + let second = second.to_string_lossy(); write!( f, "- {relative_shard_path}: Duplicate case-sensitive package directories \"{first}\" and \"{second}\"." diff --git a/src/problem/npv_120.rs b/src/problem/npv_120.rs index 60ff3d65..f56e6916 100644 --- a/src/problem/npv_120.rs +++ b/src/problem/npv_120.rs @@ -1,9 +1,12 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct NixEvalError { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] stderr: String, } @@ -13,7 +16,8 @@ impl fmt::Display for NixEvalError { f.write_str(&self.stderr)?; write!( f, - "- Nix evaluation failed for some package in `pkgs/by-name`, see error above" + "- Nix evaluation failed for some package in `{}`, see error above", + self.by_name_subpath, ) } } diff --git a/src/problem/npv_140.rs b/src/problem/npv_140.rs index 32e91680..ee5b1eb8 100644 --- a/src/problem/npv_140.rs +++ b/src/problem/npv_140.rs @@ -1,19 +1,26 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure; #[derive(Clone, Debug, new)] pub struct PackageDirectoryIsNotDirectory { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, } impl fmt::Display for PackageDirectoryIsNotDirectory { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name } = self; - let relative_package_dir = structure::relative_dir_for_package(package_name); + let Self { + by_name_subpath, + package_name, + } = self; + let relative_package_dir = + structure::relative_dir_for_package(by_name_subpath, package_name); write!( f, "- {relative_package_dir}: This path is a file, but it should be a directory.", diff --git a/src/problem/npv_142.rs b/src/problem/npv_142.rs index c3675716..aaeda87e 100644 --- a/src/problem/npv_142.rs +++ b/src/problem/npv_142.rs @@ -7,6 +7,8 @@ use crate::structure; #[derive(Clone, Debug, new)] pub struct PackageInWrongShard { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, #[new(into)] @@ -16,10 +18,12 @@ pub struct PackageInWrongShard { impl fmt::Display for PackageInWrongShard { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { + by_name_subpath, package_name, relative_package_dir, } = self; - let correct_relative_package_dir = structure::relative_dir_for_package(package_name); + let correct_relative_package_dir = + structure::relative_dir_for_package(by_name_subpath, package_name); write!( f, "- {relative_package_dir}: Incorrect directory location, should be {correct_relative_package_dir} instead.", diff --git a/src/problem/npv_143.rs b/src/problem/npv_143.rs index 20eaeb5f..aef26b38 100644 --- a/src/problem/npv_143.rs +++ b/src/problem/npv_143.rs @@ -1,19 +1,26 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure::{self, PACKAGE_NIX_FILENAME}; #[derive(Clone, Debug, new)] pub struct PackageNixMissing { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, } impl fmt::Display for PackageNixMissing { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name } = self; - let relative_package_dir = structure::relative_dir_for_package(package_name); + let Self { + by_name_subpath, + package_name, + } = self; + let relative_package_dir = + structure::relative_dir_for_package(by_name_subpath, package_name); write!( f, "- {relative_package_dir}: Missing required \"{PACKAGE_NIX_FILENAME}\" file.", diff --git a/src/problem/npv_144.rs b/src/problem/npv_144.rs index 8f5e47e1..ed4df175 100644 --- a/src/problem/npv_144.rs +++ b/src/problem/npv_144.rs @@ -1,19 +1,26 @@ use std::fmt; use derive_new::new; +use relative_path::RelativePathBuf; use crate::structure::{self, PACKAGE_NIX_FILENAME}; #[derive(Clone, Debug, new)] pub struct PackageNixIsNotFile { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, } impl fmt::Display for PackageNixIsNotFile { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name } = self; - let relative_package_dir = structure::relative_dir_for_package(package_name); + let Self { + by_name_subpath, + package_name, + } = self; + let relative_package_dir = + structure::relative_dir_for_package(by_name_subpath, package_name); write!( f, "- {relative_package_dir}: \"{PACKAGE_NIX_FILENAME}\" must be a file.", diff --git a/src/problem/npv_160.rs b/src/problem/npv_160.rs index 1ee15485..246f7686 100644 --- a/src/problem/npv_160.rs +++ b/src/problem/npv_160.rs @@ -8,6 +8,8 @@ use crate::structure; #[derive(Clone, Debug, new)] pub struct TopLevelPackageMovedOutOfByName { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, #[new(into)] @@ -19,11 +21,13 @@ pub struct TopLevelPackageMovedOutOfByName { impl fmt::Display for TopLevelPackageMovedOutOfByName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { + by_name_subpath, package_name, call_package_path, file, } = self; - let relative_package_file = structure::relative_file_for_package(package_name); + let relative_package_file = + structure::relative_file_for_package(by_name_subpath, package_name); let call_package_arg = call_package_path .as_ref() .map_or_else(|| "...".into(), |path| format!("./{}", path)); diff --git a/src/problem/npv_162.rs b/src/problem/npv_162.rs index 25f5d50e..fe864298 100644 --- a/src/problem/npv_162.rs +++ b/src/problem/npv_162.rs @@ -8,6 +8,8 @@ use crate::structure; #[derive(Clone, Debug, new)] pub struct NewTopLevelPackageShouldBeByName { + #[new(into)] + by_name_subpath: RelativePathBuf, #[new(into)] package_name: String, #[new(into)] @@ -17,10 +19,12 @@ pub struct NewTopLevelPackageShouldBeByName { impl fmt::Display for NewTopLevelPackageShouldBeByName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { + by_name_subpath, package_name, call_package_path, } = self; - let relative_package_file = structure::relative_file_for_package(package_name); + let relative_package_file = + structure::relative_file_for_package(by_name_subpath, package_name); let call_package_arg = call_package_path .as_ref() .map_or_else(|| "...".into(), |path| format!("./{}", path)); diff --git a/src/ratchet.rs b/src/ratchet.rs index a0558c94..889d32b3 100644 --- a/src/ratchet.rs +++ b/src/ratchet.rs @@ -42,7 +42,7 @@ impl Nixpkgs { /// The ratchet value for a top-level package pub struct Package { - /// The ratchet value for the check for new packages using pkgs/by-name + /// The ratchet value for the check for new packages using the by-name structure pub uses_by_name: RatchetState, /// The ratchet value for the check for enabling `strictDeps`. @@ -155,23 +155,38 @@ impl RatchetState { } } -/// The ratchet value of an attribute for the check that new packages use `pkgs/by-name`. +/// The ratchet value of an attribute for the check that new packages use the by-name subpath given by ToContext. /// -/// This checks that all new package defined using `callPackage` must be defined via -/// `pkgs/by-name`. It also checks that once a package uses `pkgs/by-name`, it can't switch back +/// This checks that all new package defined using `callPackage` must be defined via the by-name +/// subpath. It also checks that once a package uses by-name subpath, it can't switch back /// to `pkgs/top-level/all-packages.nix`. pub enum UsesByName {} impl ToProblem for UsesByName { - type ToContext = (CallPackageArgumentInfo, RelativePathBuf); - - fn to_problem(name: &str, optional_from: Option<()>, (to, file): &Self::ToContext) -> Problem { + /// callPackage argument info, attribute location relative to the nixpkgs root, by-name subpath + type ToContext = (CallPackageArgumentInfo, RelativePathBuf, RelativePathBuf); + + fn to_problem( + name: &str, + optional_from: Option<()>, + (to, file, by_name_subpath): &Self::ToContext, + ) -> Problem { let is_new = optional_from.is_none(); if is_new { - npv_162::NewTopLevelPackageShouldBeByName::new(name, to.relative_path.clone()).into() + npv_162::NewTopLevelPackageShouldBeByName::new( + by_name_subpath, + name, + to.relative_path.clone(), + ) + .into() } else { - npv_160::TopLevelPackageMovedOutOfByName::new(name, to.relative_path.clone(), file) - .into() + npv_160::TopLevelPackageMovedOutOfByName::new( + by_name_subpath, + name, + to.relative_path.clone(), + file, + ) + .into() } } } diff --git a/src/references.rs b/src/references.rs index bf8bb946..2bdb2e8e 100644 --- a/src/references.rs +++ b/src/references.rs @@ -11,7 +11,7 @@ use crate::problem::{npv_121, npv_122, npv_123, npv_124, npv_125, npv_126, npv_1 use crate::structure::read_dir_sorted; use crate::validation::{self, ResultIteratorExt, Validation::Success}; -/// Check that every package directory in pkgs/by-name doesn't link to outside that directory. +/// Check that every package directory in the by-name structure doesn't link to outside that directory. /// Both symlinks and Nix path expressions are checked. pub fn check_references( nix_file_store: &mut NixFileStore, diff --git a/src/structure.rs b/src/structure.rs index 7a3edcfa..06849da4 100644 --- a/src/structure.rs +++ b/src/structure.rs @@ -5,14 +5,13 @@ use std::sync::LazyLock; use anyhow::Context; use itertools::{concat, process_results}; use regex::Regex; -use relative_path::RelativePathBuf; +use relative_path::{RelativePath, RelativePathBuf}; use crate::NixFileStore; use crate::problem::{npv_109, npv_110, npv_111, npv_140, npv_141, npv_142, npv_143, npv_144}; use crate::references; use crate::validation::{self, ResultIteratorExt, Validation::Success}; -pub const BASE_SUBPATH: &str = "pkgs/by-name"; pub const PACKAGE_NIX_FILENAME: &str = "package.nix"; static SHARD_NAME_REGEX: LazyLock = @@ -38,25 +37,32 @@ pub fn shard_for_package(package_name: &str) -> String { package_name.to_lowercase().chars().take(2).collect() } -pub fn relative_dir_for_shard(shard_name: &str) -> RelativePathBuf { - RelativePathBuf::from(format!("{BASE_SUBPATH}/{shard_name}")) +pub fn relative_dir_for_shard(by_name_subpath: &RelativePath, shard_name: &str) -> RelativePathBuf { + RelativePathBuf::from(format!("{by_name_subpath}/{shard_name}")) } -pub fn relative_dir_for_package(package_name: &str) -> RelativePathBuf { - relative_dir_for_shard(&shard_for_package(package_name)).join(package_name) +pub fn relative_dir_for_package( + by_name_subpath: &RelativePath, + package_name: &str, +) -> RelativePathBuf { + relative_dir_for_shard(by_name_subpath, &shard_for_package(package_name)).join(package_name) } -pub fn relative_file_for_package(package_name: &str) -> RelativePathBuf { - relative_dir_for_package(package_name).join(PACKAGE_NIX_FILENAME) +pub fn relative_file_for_package( + by_name_subpath: &RelativePath, + package_name: &str, +) -> RelativePathBuf { + relative_dir_for_package(by_name_subpath, package_name).join(PACKAGE_NIX_FILENAME) } /// Check the structure of Nixpkgs, returning the attribute names that are defined in -/// `pkgs/by-name` +/// the given by-name subpath pub fn check_structure( path: &Path, nix_file_store: &mut NixFileStore, + by_name_subpath: &RelativePath, ) -> validation::Result> { - let base_dir = path.join(BASE_SUBPATH); + let base_dir = path.join(by_name_subpath.as_str()); let shard_results = read_dir_sorted(&base_dir)? .into_iter() @@ -70,11 +76,11 @@ pub fn check_structure( } else if !shard_path.is_dir() { // We can't check for any other errors if it's not a directory, since there are no // subdirectories to check. - npv_109::ByNameShardIsNotDirectory::new(shard_name).into() + npv_109::ByNameShardIsNotDirectory::new(by_name_subpath, shard_name).into() } else { let shard_name_valid = SHARD_NAME_REGEX.is_match(&shard_name); let result = if !shard_name_valid { - npv_110::ByNameShardIsInvalid::new(shard_name.clone()).into() + npv_110::ByNameShardIsInvalid::new(by_name_subpath, shard_name.clone()).into() } else { Success(()) }; @@ -87,6 +93,7 @@ pub fn check_structure( .filter(|(l, r)| l.file_name().eq_ignore_ascii_case(r.file_name())) .map(|(l, r)| { npv_111::ByNameShardIsCaseSensitiveDuplicate::new( + by_name_subpath, shard_name.clone(), l.file_name(), r.file_name(), @@ -105,6 +112,7 @@ pub fn check_structure( &shard_name, shard_name_valid, &package_entry, + by_name_subpath, ) }) .collect_vec()?; @@ -124,14 +132,15 @@ fn check_package( shard_name: &str, shard_name_valid: bool, package_entry: &DirEntry, + by_name_subpath: &RelativePath, ) -> validation::Result { let package_path = package_entry.path(); let package_name = package_entry.file_name().to_string_lossy().into_owned(); let relative_package_dir = - RelativePathBuf::from(format!("{BASE_SUBPATH}/{shard_name}/{package_name}")); + RelativePathBuf::from(format!("{by_name_subpath}/{shard_name}/{package_name}")); Ok(if !package_path.is_dir() { - npv_140::PackageDirectoryIsNotDirectory::new(package_name).into() + npv_140::PackageDirectoryIsNotDirectory::new(by_name_subpath, package_name).into() } else { let package_name_valid = PACKAGE_NAME_REGEX.is_match(&package_name); let result = if !package_name_valid { @@ -144,12 +153,13 @@ fn check_package( Success(()) }; - let correct_relative_package_dir = relative_dir_for_package(&package_name); + let correct_relative_package_dir = relative_dir_for_package(by_name_subpath, &package_name); let result = result.and_(if relative_package_dir != correct_relative_package_dir { // Only show this error if we have a valid shard and package name. // If one of those is wrong, you should fix that first. if shard_name_valid && package_name_valid { npv_142::PackageInWrongShard::new( + by_name_subpath, package_name.clone(), relative_package_dir.clone(), ) @@ -163,9 +173,9 @@ fn check_package( let package_nix_path = package_path.join(PACKAGE_NIX_FILENAME); let result = result.and_(if !package_nix_path.exists() { - npv_143::PackageNixMissing::new(package_name.clone()).into() + npv_143::PackageNixMissing::new(by_name_subpath, package_name.clone()).into() } else if !package_nix_path.is_file() { - npv_144::PackageNixIsNotFile::new(package_name.clone()).into() + npv_144::PackageNixIsNotFile::new(by_name_subpath, package_name.clone()).into() } else { Success(()) }); From 55e22d67b0885bbcebf809b0fc137885f5bb4346 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Mon, 28 Sep 2026 16:33:05 +0200 Subject: [PATCH 3/8] =?UTF-8?q?attrsPath=20=E2=86=92=20packageNamesFilePat?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simple rename of a function argument to avoid confusion with the argument introduced in the next commit. --- src/eval.nix | 4 ++-- src/eval.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eval.nix b/src/eval.nix index e977e237..d56bec2e 100644 --- a/src/eval.nix +++ b/src/eval.nix @@ -2,9 +2,9 @@ # # Returns a value containing information on all Nixpkgs attributes which is decoded on the Rust # side. See ./eval.rs for the meaning of the returned values. -{ attrsPath, nixpkgsPath }: +{ packageNamesFilePath, nixpkgsPath }: let - attrs = builtins.fromJSON (builtins.readFile attrsPath); + attrs = builtins.fromJSON (builtins.readFile packageNamesFilePath); # We need to check whether attributes are defined via callPackage of the same scope or not. overlay = final: prev: { diff --git a/src/eval.rs b/src/eval.rs index d4c2fd33..6d6ca396 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -197,7 +197,7 @@ pub fn check_values( // Add the work directory to the NIX_PATH so that it can be accessed in restrict-eval mode. .arg("-I") .arg(&work_dir_path) - .args(["--arg", "attrsPath"]) + .args(["--arg", "packageNamesFilePath"]) .arg(&package_names_path) // Same for the nixpkgs to test, adding it to the NIX_PATH so it can be accessed in // restrict-eval mode. From e1e2c3b55e64e24337a5b0b41de4cd960ac077ce Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Mon, 23 Nov 2026 17:53:58 +0100 Subject: [PATCH 4/8] make attribute path a function argument This replaces a lot of `attribute_name` or `package_name` function arguments with `full_attr_path` and it adds `attr_path` to some functions throughout the codebase. - `attr_path` is the attribute path to the package set, so excluding the package name. - `full_attr_path` is the attribute path to the package, so including the package name. Thus `full_attr_path` should never be empty. This is the second step of making it possible to use multiple by-name directories. TODO: remove some commented out debugging code once the pr is ready for merge --- src/eval.nix | 46 ++++++++++++++------- src/eval.rs | 73 +++++++++++++++++++++++++++------ src/main.rs | 2 + src/problem/npv_100.rs | 10 +++-- src/problem/npv_101.rs | 10 +++-- src/problem/npv_160.rs | 11 ++--- src/problem/npv_162.rs | 11 ++--- src/problem/npv_164.rs | 10 +++-- src/problem/npv_165.rs | 10 +++-- src/problem/npv_166.rs | 10 +++-- src/problem/npv_167.rs | 10 +++-- src/problem/npv_168.rs | 10 +++-- src/problem/npv_169.rs | 10 +++-- src/problem/npv_176.rs | 10 +++-- src/problem/npv_177.rs | 10 +++-- src/ratchet.rs | 92 +++++++++++++++++++++++++----------------- 16 files changed, 229 insertions(+), 106 deletions(-) diff --git a/src/eval.nix b/src/eval.nix index d56bec2e..a33c80f4 100644 --- a/src/eval.nix +++ b/src/eval.nix @@ -2,16 +2,32 @@ # # Returns a value containing information on all Nixpkgs attributes which is decoded on the Rust # side. See ./eval.rs for the meaning of the returned values. -{ packageNamesFilePath, nixpkgsPath }: +{ + packageNamesFilePath, + nixpkgsPath, + attrPath, +}: let attrs = builtins.fromJSON (builtins.readFile packageNamesFilePath); - # We need to check whether attributes are defined via callPackage of the same scope or not. - overlay = final: prev: { + inherit (import nixpkgsPath { }) lib; - # Adds information to each attribute about whether it's defined using this scope's `callPackage` - callPackage = fn: args: addCallPackageReference (prev.callPackage fn args); - }; + # We need to check whether attributes are defined via callPackage of the same scope or not. + overlay = + final: prev: + if attrPath == [ ] then + { + # Adds information to each attribute about whether it's defined using this scope's `callPackage` + callPackage = fn: args: addCallPackageReference (prev.callPackage fn args); + } + else + lib.setAttrByPath attrPath ( + (lib.getAttrFromPath attrPath prev).overrideScope ( + final: prev: { + callPackage = fn: args: addCallPackageReference (final.newScope { } fn args); + } + ) + ); # We can't just replace attribute values with their info in the overlay, because attributes can # depend on other attributes, so this would break evaluation. @@ -25,13 +41,15 @@ let # don't return the value directly and treat it as if it wasn't a `callPackage`. value; - pkgs = import nixpkgsPath { - # Don't let the user's home directory influence this result. - config = { }; - overlays = [ overlay ]; - # We check evaluation and `callPackage` only for x86_64-linux. Not ideal, but hard to fix. - system = "x86_64-linux"; - }; + pkgs = lib.attrByPath attrPath { } ( + import nixpkgsPath { + # Don't let the user's home directory influence this result. + config = { }; + overlays = [ overlay ]; + # We check evaluation and `callPackage` only for x86_64-linux. Not ideal, but hard to fix. + system = "x86_64-linux"; + } + ); # See AttributeInfo in ./eval.rs for the meaning of this. attrInfo = name: value: { @@ -65,7 +83,7 @@ let in { AttributeSet = { - is_derivation = pkgs.lib.isDerivation value; + is_derivation = lib.isDerivation value; strict_deps = cleanPackage.strictDeps or false; structured_attrs = cleanPackage.__structuredAttrs or false; uses_license_list = builtins.isList (value.meta.license or null); diff --git a/src/eval.rs b/src/eval.rs index 6d6ca396..7eca27ee 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -151,11 +151,13 @@ fn mutate_nix_instatiate_arguments_based_on_cfg( pub fn check_values( nixpkgs_path: &Path, by_name_subpath: &RelativePath, + attr_path: &[String], nix_file_store: &mut NixFileStore, package_names: &[String], -) -> validation::Result> { +) -> validation::Result, ratchet::Package>> { let work_dir = tempfile::Builder::new() .prefix("nixpkgs-vet") + // .disable_cleanup(true) .tempdir() .with_context(|| "Failed to create a working directory")?; @@ -199,6 +201,15 @@ pub fn check_values( .arg(&work_dir_path) .args(["--arg", "packageNamesFilePath"]) .arg(&package_names_path) + .args(["--arg", "attrPath"]) + .arg({ + let mut a = String::from("["); + for name in attr_path { + a = a + "\"" + name + "\""; + } + a += "]"; + a + }) // Same for the nixpkgs to test, adding it to the NIX_PATH so it can be accessed in // restrict-eval mode. .args(["--arg", "nixpkgsPath"]) @@ -211,6 +222,16 @@ pub fn check_values( command.arg(eval_nix_path); + // for debugging the command + // println!( + // "{} {}", + // command.get_program().to_string_lossy(), + // command.get_args().fold("".to_string(), |x, y| format!( + // "{x} '{}'", + // y.to_string_lossy() + // )) + // ); + let result = command .output() .with_context(|| format!("Failed to run command {command:?}"))?; @@ -237,24 +258,45 @@ pub fn check_values( attributes .into_iter() .map(|(attribute_name, attribute_value)| { + let mut full_attr_path: Vec = attr_path.into(); + full_attr_path.push(attribute_name.clone()); + let check_result = match attribute_value { Attribute::NonByName(non_by_name_attribute) => handle_non_by_name_attribute( nixpkgs_path, nix_file_store, - &attribute_name, + &full_attr_path, non_by_name_attribute, by_name_subpath, )?, - Attribute::ByName(by_name_attribute) => { - by_name(&attribute_name, by_name_attribute, by_name_subpath)? - } + Attribute::ByName(by_name_attribute) => by_name( + &attribute_name, + by_name_attribute, + by_name_subpath, + attr_path, + )?, }; Ok::<_, anyhow::Error>(check_result.map(|value| (attribute_name.clone(), value))) }) .collect_vec()?, ); - Ok(check_result.map(|elems| elems.into_iter().collect())) + Ok(check_result.map(|elems| { + elems + .into_iter() + // prepend the attribute path to the package name + .map(|(name, package)| { + ( + { + let mut full_attr_path: Vec = attr_path.into(); + full_attr_path.push(name); + full_attr_path + }, + package, + ) + }) + .collect() + })) } /// Handle the evaluation result for an attribute in the by-name structure at the given by-name @@ -263,7 +305,11 @@ fn by_name( attribute_name: &str, by_name_attribute: ByNameAttribute, by_name_subpath: &RelativePath, + attr_path: &[String], ) -> validation::Result { + let mut full_attr_path: Vec = attr_path.into(); + full_attr_path.push(attribute_name.to_string()); + // At this point we know that `{by_name_subpath}/fo/foo/package.nix` has to exist. This match // decides whether the attribute `foo` is defined accordingly. let result = match by_name_attribute { @@ -271,7 +317,7 @@ fn by_name( ByNameAttribute::Missing => { // This indicates a bug in the by-name overlay, because it's supposed to // automatically define all attributes in the by-name subpath - npv_100::ByNameUndefinedAttribute::new(by_name_subpath, attribute_name).into() + npv_100::ByNameUndefinedAttribute::new(by_name_subpath, full_attr_path).into() } // The attribute exists ByNameAttribute::Existing(AttributeInfo { @@ -285,7 +331,7 @@ fn by_name( // // We can't know whether the attribute is automatically or manually defined for sure, // and while we could check the location, the error seems clear enough as is. - npv_101::ByNameNonDerivation::new(by_name_subpath, attribute_name).into() + npv_101::ByNameNonDerivation::new(by_name_subpath, full_attr_path).into() } // The attribute exists ByNameAttribute::Existing(AttributeInfo { @@ -323,7 +369,7 @@ fn by_name( ), }) } else { - npv_101::ByNameNonDerivation::new(by_name_subpath, attribute_name).into() + npv_101::ByNameNonDerivation::new(by_name_subpath, full_attr_path).into() } } }; @@ -342,7 +388,7 @@ where fn handle_non_by_name_attribute( nixpkgs_path: &Path, nix_file_store: &mut NixFileStore, - attribute_name: &str, + full_attr_path: &[String], non_by_name_attribute: NonByNameAttribute, by_name_subpath: &RelativePath, ) -> validation::Result { @@ -387,7 +433,10 @@ fn handle_non_by_name_attribute( // The relative location of the Nix file, for error messages let location = location.relative(nixpkgs_path).with_context(|| { - format!("Failed to resolve the file where attribute {attribute_name} is defined") + format!( + "Failed to resolve the file where attribute {} is defined", + full_attr_path.join(".") + ) })?; // Figure out whether it's an attribute definition of the form @@ -397,7 +446,7 @@ fn handle_non_by_name_attribute( .with_context(|| { format!( "Failed to get the definition info for attribute {}", - attribute_name + full_attr_path.join(".") ) })?; diff --git a/src/main.rs b/src/main.rs index 85ca0418..27a9878f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -110,6 +110,7 @@ fn process(base_nixpkgs: PathBuf, main_nixpkgs: &Path) -> Status { /// ratchet check against another result. fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { let by_name_subpath = RelativePathBuf::from("pkgs/by-name"); + let attr_path = vec![]; let nixpkgs_path = nixpkgs_path.canonicalize().with_context(|| { format!( "Nixpkgs path {} could not be resolved", @@ -131,6 +132,7 @@ fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { eval::check_values( &nixpkgs_path, &by_name_subpath, + &attr_path, &mut nix_file_store, package_names.as_slice(), ) diff --git a/src/problem/npv_100.rs b/src/problem/npv_100.rs index 53ea7226..f1e846e0 100644 --- a/src/problem/npv_100.rs +++ b/src/problem/npv_100.rs @@ -10,20 +10,22 @@ pub struct ByNameUndefinedAttribute { #[new(into)] by_name_subpath: RelativePathBuf, #[new(into)] - attribute_name: String, + full_attr_path: Vec, } impl fmt::Display for ByNameUndefinedAttribute { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { by_name_subpath, - attribute_name, + full_attr_path, } = self; let relative_package_file = - structure::relative_file_for_package(by_name_subpath, attribute_name); + // we should be able to safely unwrap here because the full_attr_path should always contain at least the attribute name + structure::relative_file_for_package(by_name_subpath, full_attr_path.last().unwrap()); write!( f, - "- {attribute_name}: This attribute is not defined but it should be defined automatically as {relative_package_file}", + "- {}: This attribute is not defined but it should be defined automatically as {relative_package_file}", + full_attr_path.join("."), ) } } diff --git a/src/problem/npv_101.rs b/src/problem/npv_101.rs index 6b8bd492..403b9528 100644 --- a/src/problem/npv_101.rs +++ b/src/problem/npv_101.rs @@ -10,20 +10,22 @@ pub struct ByNameNonDerivation { #[new(into)] by_name_subpath: RelativePathBuf, #[new(into)] - attribute_name: String, + full_attr_path: Vec, } impl fmt::Display for ByNameNonDerivation { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { by_name_subpath, - attribute_name, + full_attr_path, } = self; let relative_package_file = - structure::relative_file_for_package(by_name_subpath, attribute_name); + // we should be able to safely unwrap here because the full_attr_path should always contain at least the attribute name + structure::relative_file_for_package(by_name_subpath, full_attr_path.last().unwrap()); write!( f, - "- {attribute_name}: This attribute defined by {relative_package_file} is not a derivation", + "- {}: This attribute defined by {relative_package_file} is not a derivation", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_160.rs b/src/problem/npv_160.rs index 246f7686..3baadf33 100644 --- a/src/problem/npv_160.rs +++ b/src/problem/npv_160.rs @@ -11,7 +11,7 @@ pub struct TopLevelPackageMovedOutOfByName { #[new(into)] by_name_subpath: RelativePathBuf, #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] call_package_path: Option, #[new(into)] @@ -22,21 +22,22 @@ impl fmt::Display for TopLevelPackageMovedOutOfByName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { by_name_subpath, - package_name, + full_attr_path, call_package_path, file, } = self; let relative_package_file = - structure::relative_file_for_package(by_name_subpath, package_name); + // we should be able to safely unwrap here because the full_attr_path should always contain at least the attribute name + structure::relative_file_for_package(by_name_subpath, full_attr_path.last().unwrap()); let call_package_arg = call_package_path .as_ref() .map_or_else(|| "...".into(), |path| format!("./{}", path)); writedoc!( f, " - - Attribute `{package_name}` was previously defined in {relative_package_file}, but is now manually defined as `callPackage {call_package_arg} {{ /* ... */ }}` in {file}. + - Attribute `{}` was previously defined in {relative_package_file}, but is now manually defined as `callPackage {call_package_arg} {{ /* ... */ }}` in {file}. Please move the package back and remove the manual `callPackage`. - ", + ", full_attr_path.join("."), ) } } diff --git a/src/problem/npv_162.rs b/src/problem/npv_162.rs index fe864298..447e43a3 100644 --- a/src/problem/npv_162.rs +++ b/src/problem/npv_162.rs @@ -11,7 +11,7 @@ pub struct NewTopLevelPackageShouldBeByName { #[new(into)] by_name_subpath: RelativePathBuf, #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] call_package_path: Option, } @@ -20,21 +20,22 @@ impl fmt::Display for NewTopLevelPackageShouldBeByName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Self { by_name_subpath, - package_name, + full_attr_path, call_package_path, } = self; let relative_package_file = - structure::relative_file_for_package(by_name_subpath, package_name); + // we should be able to safely unwrap here because the full_attr_path should always contain at least the attribute name + structure::relative_file_for_package(by_name_subpath, full_attr_path.last().unwrap()); let call_package_arg = call_package_path .as_ref() .map_or_else(|| "...".into(), |path| format!("./{}", path)); writedoc!( f, " - - Attribute `{package_name}` is a new top-level package using `callPackage {call_package_arg} {{ /* ... */ }}`. + - Attribute `{}` is a new top-level package using `callPackage {call_package_arg} {{ /* ... */ }}`. Please define it in {relative_package_file} instead. See `pkgs/by-name/README.md` for more details. - ", + ", full_attr_path.join("."), ) } } diff --git a/src/problem/npv_164.rs b/src/problem/npv_164.rs index 06eea450..66fa8422 100644 --- a/src/problem/npv_164.rs +++ b/src/problem/npv_164.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct NewTopLevelPackageMustEnableStrictDeps { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for NewTopLevelPackageMustEnableStrictDeps { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` is a new package with `strictDeps` unset or set to `false`. + - Attribute `{}` is a new package with `strictDeps` unset or set to `false`. Please enable `strictDeps = true;` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_165.rs b/src/problem/npv_165.rs index 977e554d..ef8127c7 100644 --- a/src/problem/npv_165.rs +++ b/src/problem/npv_165.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct TopLevelPackageDisabledStrictDeps { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for TopLevelPackageDisabledStrictDeps { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` previously evaluated with `strictDeps = true`, but now evaluates with `strictDeps = false`. + - Attribute `{}` previously evaluated with `strictDeps = true`, but now evaluates with `strictDeps = false`. Please re-enable `strictDeps = true;` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_166.rs b/src/problem/npv_166.rs index 51801d6e..039d0227 100644 --- a/src/problem/npv_166.rs +++ b/src/problem/npv_166.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct NewTopLevelPackageMustEnableStructuredAttrs { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for NewTopLevelPackageMustEnableStructuredAttrs { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` is a new package with `__structuredAttrs` unset or set to `false`. + - Attribute `{}` is a new package with `__structuredAttrs` unset or set to `false`. Please enable `__structuredAttrs = true;` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_167.rs b/src/problem/npv_167.rs index ca7b9d9a..63a30299 100644 --- a/src/problem/npv_167.rs +++ b/src/problem/npv_167.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct TopLevelPackageDisabledStructuredAttrs { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for TopLevelPackageDisabledStructuredAttrs { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` previously evaluated with `__structuredAttrs = true`, but now evaluates with `__structuredAttrs = false`. + - Attribute `{}` previously evaluated with `__structuredAttrs = true`, but now evaluates with `__structuredAttrs = false`. Please re-enable `__structuredAttrs = true;` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_168.rs b/src/problem/npv_168.rs index 5ad197e9..c1e819dc 100644 --- a/src/problem/npv_168.rs +++ b/src/problem/npv_168.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct NewTopLevelPackageUsesLicenseList { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for NewTopLevelPackageUsesLicenseList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` is a new package with a list for `meta.license`. + - Attribute `{}` is a new package with a list for `meta.license`. Please use a single license, or combine licenses with `lib.licenses.OR` or `lib.licenses.AND` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_169.rs b/src/problem/npv_169.rs index 6ae20642..0af2eb89 100644 --- a/src/problem/npv_169.rs +++ b/src/problem/npv_169.rs @@ -7,20 +7,24 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct TopLevelPackageSwitchedToLicenseList { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for TopLevelPackageSwitchedToLicenseList { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` previously did not use a list for `meta.license`, but now does. + - Attribute `{}` previously did not use a list for `meta.license`, but now does. Please use a single license, or combine licenses with `lib.licenses.OR` or `lib.licenses.AND` in {file}. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_176.rs b/src/problem/npv_176.rs index 531e9af3..d2aa95f2 100644 --- a/src/problem/npv_176.rs +++ b/src/problem/npv_176.rs @@ -7,23 +7,27 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct TopLevelPackageEnabledCargoSystemLibs { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for TopLevelPackageEnabledCargoSystemLibs { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` sets `dontCargoUseSystemLibs` to `true`. + - Attribute `{}` sets `dontCargoUseSystemLibs` to `true`. Please remove this and link to the nixpkgs-provided library, or if this is truly not possible, please add a target fix for the specific library that needs to be allowed in {file}. `dontCargoUseSystemLibs` is for out-of-tree usage, and is not allowed within Nixpkgs. ", + full_attr_path.join(".") ) } } diff --git a/src/problem/npv_177.rs b/src/problem/npv_177.rs index 73934cba..df5de2b9 100644 --- a/src/problem/npv_177.rs +++ b/src/problem/npv_177.rs @@ -7,23 +7,27 @@ use relative_path::RelativePathBuf; #[derive(Clone, Debug, new)] pub struct NewTopLevelPackageMustDisableCargoSystemLibs { #[new(into)] - package_name: String, + full_attr_path: Vec, #[new(into)] file: RelativePathBuf, } impl fmt::Display for NewTopLevelPackageMustDisableCargoSystemLibs { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Self { package_name, file } = self; + let Self { + full_attr_path, + file, + } = self; writedoc!( f, " - - Attribute `{package_name}` sets `dontCargoUseSystemLibs` to `true`. + - Attribute `{}` sets `dontCargoUseSystemLibs` to `true`. Please remove this and link to the nixpkgs-provided library, or if this is truly not possible, please add a target fix for the specific library that needs to be allowed in {file}. `dontCargoUseSystemLibs` is for out-of-tree usage, and is not allowed within Nixpkgs. ", + full_attr_path.join(".") ) } } diff --git a/src/ratchet.rs b/src/ratchet.rs index 889d32b3..3cd86b0d 100644 --- a/src/ratchet.rs +++ b/src/ratchet.rs @@ -20,7 +20,7 @@ use crate::validation::{self, Validation, Validation::Success}; #[derive(Default)] pub struct Nixpkgs { /// The ratchet values for all packages - pub packages: BTreeMap, + pub packages: BTreeMap, Package>, pub files: BTreeMap, } @@ -30,9 +30,9 @@ impl Nixpkgs { validation::sequence_( // We only loop over the current attributes, // we don't need to check ones that were removed - to.packages - .into_iter() - .map(|(name, pkg)| Package::compare(&name, from.packages.get(&name), &pkg)), + to.packages.into_iter().map(|(full_attr_path, pkg)| { + Package::compare(&full_attr_path, from.packages.get(&full_attr_path), &pkg) + }), ) .and_(validation::sequence_(to.files.into_iter().map( |(name, file)| File::compare(&name, from.files.get(&name), &file), @@ -60,30 +60,34 @@ pub struct Package { impl Package { /// Validates the ratchet checks for a top-level package - pub fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { + pub fn compare( + full_attr_path: &[String], + optional_from: Option<&Self>, + to: &Self, + ) -> Validation<()> { validation::sequence_([ RatchetState::::compare( - name, + full_attr_path, optional_from.map(|x| &x.uses_by_name), &to.uses_by_name, ), RatchetState::::compare( - name, + full_attr_path, optional_from.map(|x| &x.strict_deps), &to.strict_deps, ), RatchetState::::compare( - name, + full_attr_path, optional_from.map(|x| &x.structured_attrs), &to.structured_attrs, ), RatchetState::::compare( - name, + full_attr_path, optional_from.map(|x| &x.license_expression), &to.license_expression, ), RatchetState::::compare( - name, + full_attr_path, optional_from.map(|x| &x.cargo_system_libs), &to.cargo_system_libs, ), @@ -128,22 +132,30 @@ pub trait ToProblem { type ToContext; /// How to convert an attribute-specific error context into a Problem. - fn to_problem(name: &str, optional_from: Option<()>, to: &Self::ToContext) -> Problem; + fn to_problem( + full_attr_path: &[String], + optional_from: Option<()>, + to: &Self::ToContext, + ) -> Problem; } impl RatchetState { /// Compare the previous ratchet state of an attribute to the new state. /// The previous state may be `None` in case the attribute is new. - fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { + fn compare( + full_attr_path: &[String], + optional_from: Option<&Self>, + to: &Self, + ) -> Validation<()> { match (optional_from, to) { // Loosening a ratchet is not allowed. (Some(RatchetState::Tight), RatchetState::Loose(loose_context)) => { - Context::to_problem(name, Some(()), loose_context).into() + Context::to_problem(full_attr_path, Some(()), loose_context).into() } // Introducing a loose ratchet is also not allowed. (None, RatchetState::Loose(loose_context)) => { - Context::to_problem(name, None, loose_context).into() + Context::to_problem(full_attr_path, None, loose_context).into() } // Everything else is allowed, including: @@ -167,7 +179,7 @@ impl ToProblem for UsesByName { type ToContext = (CallPackageArgumentInfo, RelativePathBuf, RelativePathBuf); fn to_problem( - name: &str, + full_attr_path: &[String], optional_from: Option<()>, (to, file, by_name_subpath): &Self::ToContext, ) -> Problem { @@ -175,14 +187,14 @@ impl ToProblem for UsesByName { if is_new { npv_162::NewTopLevelPackageShouldBeByName::new( by_name_subpath, - name, + full_attr_path, to.relative_path.clone(), ) .into() } else { npv_160::TopLevelPackageMovedOutOfByName::new( by_name_subpath, - name, + full_attr_path, to.relative_path.clone(), file, ) @@ -192,8 +204,8 @@ impl ToProblem for UsesByName { } pub trait EnabledAttributeProblem { - fn introduced_problem(name: &str, file: RelativePathBuf) -> Problem; - fn regressed_problem(name: &str, file: RelativePathBuf) -> Problem; + fn introduced_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem; + fn regressed_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem; } /// The ratchet value of an evaluated boolean attribute that must be enabled for new packages and @@ -203,11 +215,15 @@ pub struct EnabledAttribute(PhantomData); impl ToProblem for EnabledAttribute { type ToContext = RelativePathBuf; - fn to_problem(name: &str, optional_from: Option<()>, file: &Self::ToContext) -> Problem { + fn to_problem( + full_attr_path: &[String], + optional_from: Option<()>, + file: &Self::ToContext, + ) -> Problem { if optional_from.is_some() { - ProblemKind::regressed_problem(name, file.clone()) + ProblemKind::regressed_problem(full_attr_path, file.clone()) } else { - ProblemKind::introduced_problem(name, file.clone()) + ProblemKind::introduced_problem(full_attr_path, file.clone()) } } } @@ -221,12 +237,12 @@ pub type StrictDeps = EnabledAttribute; pub enum StrictDepsProblem {} impl EnabledAttributeProblem for StrictDepsProblem { - fn introduced_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_164::NewTopLevelPackageMustEnableStrictDeps::new(name, file).into() + fn introduced_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_164::NewTopLevelPackageMustEnableStrictDeps::new(full_attr_path, file).into() } - fn regressed_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_165::TopLevelPackageDisabledStrictDeps::new(name, file).into() + fn regressed_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_165::TopLevelPackageDisabledStrictDeps::new(full_attr_path, file).into() } } @@ -240,12 +256,12 @@ pub type StructuredAttrs = EnabledAttribute; pub enum StructuredAttrsProblem {} impl EnabledAttributeProblem for StructuredAttrsProblem { - fn introduced_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_166::NewTopLevelPackageMustEnableStructuredAttrs::new(name, file).into() + fn introduced_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_166::NewTopLevelPackageMustEnableStructuredAttrs::new(full_attr_path, file).into() } - fn regressed_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_167::TopLevelPackageDisabledStructuredAttrs::new(name, file).into() + fn regressed_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_167::TopLevelPackageDisabledStructuredAttrs::new(full_attr_path, file).into() } } @@ -259,12 +275,12 @@ pub type LicenseExpression = EnabledAttribute; pub enum LicenseExpressionProblem {} impl EnabledAttributeProblem for LicenseExpressionProblem { - fn introduced_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_168::NewTopLevelPackageUsesLicenseList::new(name, file).into() + fn introduced_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_168::NewTopLevelPackageUsesLicenseList::new(full_attr_path, file).into() } - fn regressed_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_169::TopLevelPackageSwitchedToLicenseList::new(name, file).into() + fn regressed_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_169::TopLevelPackageSwitchedToLicenseList::new(full_attr_path, file).into() } } @@ -276,11 +292,11 @@ pub type CargoSystemLib = EnabledAttribute; pub enum CargoSystemLibsProblem {} impl EnabledAttributeProblem for CargoSystemLibsProblem { - fn introduced_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_177::NewTopLevelPackageMustDisableCargoSystemLibs::new(name, file).into() + fn introduced_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_177::NewTopLevelPackageMustDisableCargoSystemLibs::new(full_attr_path, file).into() } - fn regressed_problem(name: &str, file: RelativePathBuf) -> Problem { - npv_176::TopLevelPackageEnabledCargoSystemLibs::new(name, file).into() + fn regressed_problem(full_attr_path: &[String], file: RelativePathBuf) -> Problem { + npv_176::TopLevelPackageEnabledCargoSystemLibs::new(full_attr_path, file).into() } } From ac9962f3b1df8b38bece4c617813d5a2aab7bd61 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Wed, 25 Nov 2026 20:55:44 +0100 Subject: [PATCH 5/8] use a simple config file The config file format is very simple for now: An attribute set with `package_sets` as its only key, which is just a list of configs for a by-name dir with its file path and attr path. If there is no config file, a basic config with `pkgs/by-name` as a top level package set is used to have the same behaviour as before this PR. When a new package set is added to the config file, all checks on packages that don't use the by-name structure are ignored. Because otherwise it would be really hard to migrate a package set. Checks on packages in the by-name directory and basic checks e.g. that the sharding structure is correct are still done. This also adds NPV-180 which checks the parsability of the config file, aswell as several tests for that NPV. This also adds several tests that change which package sets are tracked and validate the behaviour when adding or removing a package set. Changes to consider: - Make the config file a nix file and eval it to json before parsing it with serde. This would make it possble to dynamically configure directories based on patterns. e.g. all pkgs/sets/*/by-name are checked under the respective directory name attr path - Different default config path (maybe with a . in front). - A way to configure the config file path via command line options. This is the third step of making it possible to use multiple by-name directories. --- Cargo.toml | 2 +- default-nixpkgs-vet.json | 8 + package.nix | 1 + src/main.rs | 145 +++++++++++++++--- src/problem/mod.rs | 7 + src/problem/npv_180.rs | 17 ++ .../base/default.nix | 1 + .../base/nixpkgs-vet.json | 10 ++ .../sets/barPackages/by-name/bar/package.nix | 2 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../expected | 3 + .../main/default.nix | 1 + .../main/nixpkgs-vet.json | 16 ++ .../sets/barPackages/by-name/bar/package.nix | 2 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../base/default.nix | 1 + .../base/nixpkgs-vet.json | 10 ++ .../base/pkgs/sets/barPackages/aliases.nix | 3 + .../pkgs/sets/barPackages/by-name/README.md | 0 .../pkgs/sets/barPackages/manual-packages.nix | 3 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../expected | 1 + .../main/default.nix | 1 + .../main/nixpkgs-vet.json | 16 ++ .../main/pkgs/sets/barPackages/aliases.nix | 3 + .../pkgs/sets/barPackages/by-name/README.md | 0 .../pkgs/sets/barPackages/manual-packages.nix | 3 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../base/nixpkgs-vet.json | 1 + .../fixed-broken-config-file/expected | 1 + .../newly-broken-config-file/expected | 3 + .../main/nixpkgs-vet.json | 1 + .../base/default.nix | 1 + .../base/nixpkgs-vet.json | 16 ++ .../sets/barPackages/by-name/bar/package.nix | 2 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../removed-package-set-unbreaks/expected | 1 + .../main/default.nix | 1 + .../main/nixpkgs-vet.json | 10 ++ .../sets/barPackages/by-name/bar/package.nix | 2 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../base/nixpkgs-vet.json | 1 + .../still-broken-config-file/expected | 4 + .../main/nixpkgs-vet.json | 1 + tests/mock-nixpkgs.nix | 70 +++++++-- tests/tests-nixpkgs-vet.json | 8 + 46 files changed, 346 insertions(+), 39 deletions(-) create mode 100644 default-nixpkgs-vet.json create mode 100644 src/problem/npv_180.rs create mode 100644 tests/integration/added-package-set-fails-structure/base/default.nix create mode 100644 tests/integration/added-package-set-fails-structure/base/nixpkgs-vet.json create mode 100644 tests/integration/added-package-set-fails-structure/base/pkgs/sets/barPackages/by-name/bar/package.nix create mode 100644 tests/integration/added-package-set-fails-structure/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/added-package-set-fails-structure/expected create mode 100644 tests/integration/added-package-set-fails-structure/main/default.nix create mode 100644 tests/integration/added-package-set-fails-structure/main/nixpkgs-vet.json create mode 100644 tests/integration/added-package-set-fails-structure/main/pkgs/sets/barPackages/by-name/bar/package.nix create mode 100644 tests/integration/added-package-set-fails-structure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/default.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/nixpkgs-vet.json create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/aliases.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/by-name/README.md create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/manual-packages.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/expected create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/default.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/nixpkgs-vet.json create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/aliases.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/by-name/README.md create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/manual-packages.nix create mode 100644 tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/fixed-broken-config-file/base/nixpkgs-vet.json create mode 100644 tests/integration/fixed-broken-config-file/expected create mode 100644 tests/integration/newly-broken-config-file/expected create mode 100644 tests/integration/newly-broken-config-file/main/nixpkgs-vet.json create mode 100644 tests/integration/removed-package-set-unbreaks/base/default.nix create mode 100644 tests/integration/removed-package-set-unbreaks/base/nixpkgs-vet.json create mode 100644 tests/integration/removed-package-set-unbreaks/base/pkgs/sets/barPackages/by-name/bar/package.nix create mode 100644 tests/integration/removed-package-set-unbreaks/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/removed-package-set-unbreaks/expected create mode 100644 tests/integration/removed-package-set-unbreaks/main/default.nix create mode 100644 tests/integration/removed-package-set-unbreaks/main/nixpkgs-vet.json create mode 100644 tests/integration/removed-package-set-unbreaks/main/pkgs/sets/barPackages/by-name/bar/package.nix create mode 100644 tests/integration/removed-package-set-unbreaks/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/still-broken-config-file/base/nixpkgs-vet.json create mode 100644 tests/integration/still-broken-config-file/expected create mode 100644 tests/integration/still-broken-config-file/main/nixpkgs-vet.json create mode 100644 tests/tests-nixpkgs-vet.json diff --git a/Cargo.toml b/Cargo.toml index 9c8f1fd2..e476c386 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ colored = "3.1.1" itertools = "0.15.0" rowan = "0.17.0" indoc = "2.0.7" -relative-path = "2.0.1" +relative-path = { version = "2.0.1", features = ["serde"] } derive-enum-from-into = "0.2.1" derive-new = "0.7.0" derive_more = { version = "2.1.1", features = ["display"] } diff --git a/default-nixpkgs-vet.json b/default-nixpkgs-vet.json new file mode 100644 index 00000000..b97bd0ca --- /dev/null +++ b/default-nixpkgs-vet.json @@ -0,0 +1,8 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/by-name", + "attr_path": [] + } + ] +} \ No newline at end of file diff --git a/package.nix b/package.nix index cb3f683a..07b87d66 100644 --- a/package.nix +++ b/package.nix @@ -32,6 +32,7 @@ rustPlatform.buildRustPackage { fileset = fs.unions [ ./Cargo.lock ./Cargo.toml + ./default-nixpkgs-vet.json ./src ./tests ]; diff --git a/src/main.rs b/src/main.rs index 27a9878f..ff161e56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,12 +23,15 @@ mod validation; use anyhow::Context as _; use clap::Parser; use relative_path::RelativePathBuf; +use serde::Deserialize; use std::collections::BTreeMap; +use std::fs::read_to_string; use std::path::{Path, PathBuf}; use std::process::ExitCode; use std::{panic, thread}; use crate::nix_file::NixFileStore; +use crate::problem::npv_180; use crate::status::{ColoredStatus, Status}; use crate::structure::check_structure; use crate::validation::Validation::Failure; @@ -59,6 +62,37 @@ pub struct Args { base: PathBuf, } +// default config is no by-name directories +#[cfg(not(test))] +const DEFAULT_NIXPKGS_VET_JSON: &str = include_str!("../default-nixpkgs-vet.json"); +// default config for tests +#[cfg(test)] +const DEFAULT_NIXPKGS_VET_JSON: &str = include_str!("../tests/tests-nixpkgs-vet.json"); + +// config file format +#[derive(Clone, Deserialize)] +pub struct Config { + package_sets: Vec, +} + +// one checked package set, characterized the file- and attribute path +#[derive(Clone, Deserialize)] +pub struct PkgSet { + by_name_subpath: RelativePathBuf, + attr_path: Vec, +} + +impl Config { + fn read(path: &Path) -> Result { + let mut config_path: PathBuf = path.into(); + config_path.push("nixpkgs-vet.json"); + let config_content = + read_to_string(config_path).unwrap_or_else(|_| String::from(DEFAULT_NIXPKGS_VET_JSON)); + + serde_json::from_str(&config_content) + } +} + fn main() -> ExitCode { let args = Args::parse(); let status: ColoredStatus = process(args.base, &args.nixpkgs).into(); @@ -72,9 +106,42 @@ fn main() -> ExitCode { /// - `base_nixpkgs`: Path to the base Nixpkgs to run ratchet checks against. /// - `main_nixpkgs`: Path to the main Nixpkgs to check. fn process(base_nixpkgs: PathBuf, main_nixpkgs: &Path) -> Status { + // Parse the config files, return the respective Status when parsing fails. + let (base_config, main_config) = match (Config::read(&base_nixpkgs), Config::read(main_nixpkgs)) + { + (Err(_), Err(e)) => { + return Status::BranchStillBroken(vec![ + npv_180::ConfigFileIsBroken::new(format!("{e}")).into(), + ]); + } + (Err(_), Ok(_)) => return Status::BranchHealed, + (Ok(_), Err(e)) => { + return Status::ProblemsIntroduced(vec![ + npv_180::ConfigFileIsBroken::new(format!("{e}")).into(), + ]); + } + (Ok(c1), Ok(c2)) => (c1, c2), + }; + + // Remove newly introduced package sets from the main config. + // Newly added package sets will not get eval checked. + // Otherwise migrating a large package set would be near impossible. + // (The ratchet would need to be tight before adding it to nixpkgs-vet). + let new_package_sets: Vec = main_config + .package_sets + .clone() + .into_iter() + .filter(|x1| { + base_config + .package_sets + .iter() + .all(|x2| x2.attr_path != x1.attr_path) + }) + .collect(); + // Very easy to parallelise this, since both operations are totally independent of each other. - let base_thread = thread::spawn(move || check_nixpkgs(&base_nixpkgs)); - let main_result = match check_nixpkgs(main_nixpkgs) { + let base_thread = thread::spawn(move || check_nixpkgs(&base_nixpkgs, base_config, &[])); + let main_result = match check_nixpkgs(main_nixpkgs, main_config, &new_package_sets) { Ok(result) => result, Err(error) => { return error.into(); @@ -108,9 +175,11 @@ fn process(base_nixpkgs: PathBuf, main_nixpkgs: &Path) -> Status { /// This does not include ratchet checks, see ../README.md#ratchet-checks /// Instead a `ratchet::Nixpkgs` value is returned, whose `compare` method allows performing the /// ratchet check against another result. -fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { - let by_name_subpath = RelativePathBuf::from("pkgs/by-name"); - let attr_path = vec![]; +fn check_nixpkgs( + nixpkgs_path: &Path, + config: Config, + new_package_sets: &[PkgSet], +) -> validation::Result { let nixpkgs_path = nixpkgs_path.canonicalize().with_context(|| { format!( "Nixpkgs path {} could not be resolved", @@ -120,25 +189,50 @@ fn check_nixpkgs(nixpkgs_path: &Path) -> validation::Result { let mut nix_file_store = NixFileStore::default(); - let package_result = { - if !nixpkgs_path.join(by_name_subpath.as_str()).exists() { - // No directory at the given location (e.g. pkgs/by-name), always valid - Success(BTreeMap::new()) - } else { - let structure = check_structure(&nixpkgs_path, &mut nix_file_store, &by_name_subpath)?; - - // Only if we could successfully parse the structure, we do the evaluation checks - structure.result_map(|package_names| { - eval::check_values( - &nixpkgs_path, - &by_name_subpath, - &attr_path, - &mut nix_file_store, - package_names.as_slice(), - ) - })? + let mut package_result = Success(BTreeMap::new()); + + for pkgset in config.package_sets { + let mut other_package_result = + if !nixpkgs_path.join(pkgset.by_name_subpath.as_str()).exists() { + // No directory at the given location (e.g. pkgs/by-name), always valid + Success(BTreeMap::new()) + } else { + let structure = + check_structure(&nixpkgs_path, &mut nix_file_store, &pkgset.by_name_subpath)?; + + // Only if we could successfully parse the structure, we do the evaluation checks + structure.result_map(|package_names| { + eval::check_values( + &nixpkgs_path, + &pkgset.by_name_subpath, + &pkgset.attr_path, + &mut nix_file_store, + package_names.as_slice(), + ) + })? + }; + + // ignore certain problems for new package sets + if new_package_sets + .iter() + .any(|x| x.attr_path == pkgset.attr_path) + { + other_package_result = other_package_result.map(|package_result_inner| { + package_result_inner + .into_iter() + .filter(|(_full_attr_path, package)| { + // skip checks for packages that don't use by-name + matches!(package.uses_by_name, ratchet::RatchetState::Tight) + }) + .collect() + }); } - }; + + package_result = package_result.and(other_package_result, |mut self_, mut other| { + self_.append(&mut other); + self_ + }); + } let file_result = files::check_files(&nixpkgs_path, &mut nix_file_store)?; @@ -198,6 +292,11 @@ mod tests { } let base = path.join("main/pkgs/by-name"); + fs::create_dir_all(path.join("main"))?; + fs::write( + path.join("main/nixpkgs-vet.json"), + include_str!("../tests/tests-nixpkgs-vet.json"), + )?; fs::create_dir_all(base.join("fo/foo"))?; fs::write(base.join("fo/foo/package.nix"), "{ someDrv }: someDrv")?; diff --git a/src/problem/mod.rs b/src/problem/mod.rs index 78fe174f..14cb0693 100644 --- a/src/problem/mod.rs +++ b/src/problem/mod.rs @@ -45,6 +45,8 @@ pub mod npv_171; pub mod npv_176; pub mod npv_177; +pub mod npv_180; + const WIKI_BASE_URL: &str = "https://github.com/NixOS/nixpkgs-vet/wiki"; #[derive(Clone, Debug, EnumFrom)] @@ -149,6 +151,9 @@ pub enum Problem { /// NPV-177: Ban new packages from `dontCargoUseSystemLibs = true` NewTopLevelPackageEnabledCargoSystemLibs(npv_177::NewTopLevelPackageMustDisableCargoSystemLibs), + + /// NPV-180: config file is broken + ConfigFileIsBroken(npv_180::ConfigFileIsBroken), } impl Problem { @@ -188,6 +193,7 @@ impl Problem { Self::NixFileContainsOptionalList(..) => "NPV-171", Self::TopLevelPackageEnabledCargoSystemLibs(..) => "NPV-176", Self::NewTopLevelPackageEnabledCargoSystemLibs(..) => "NPV-177", + Self::ConfigFileIsBroken(..) => "NPV-180", } } @@ -233,6 +239,7 @@ impl fmt::Display for Problem { Self::NixFileContainsOptionalList(inner) => inner.fmt(f), Self::TopLevelPackageEnabledCargoSystemLibs(inner) => inner.fmt(f), Self::NewTopLevelPackageEnabledCargoSystemLibs(inner) => inner.fmt(f), + Self::ConfigFileIsBroken(inner) => inner.fmt(f), } } } diff --git a/src/problem/npv_180.rs b/src/problem/npv_180.rs new file mode 100644 index 00000000..d740fecb --- /dev/null +++ b/src/problem/npv_180.rs @@ -0,0 +1,17 @@ +use derive_new::new; +use std::fmt; + +#[derive(Clone, Debug, new)] +pub struct ConfigFileIsBroken { + pub error: String, +} + +impl fmt::Display for ConfigFileIsBroken { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!( + f, + "{}\n- Config file couldn't be read properly, see error above.", + self.error + ) + } +} diff --git a/tests/integration/added-package-set-fails-structure/base/default.nix b/tests/integration/added-package-set-fails-structure/base/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/base/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/added-package-set-fails-structure/base/nixpkgs-vet.json b/tests/integration/added-package-set-fails-structure/base/nixpkgs-vet.json new file mode 100644 index 00000000..ff24dab8 --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/base/nixpkgs-vet.json @@ -0,0 +1,10 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/added-package-set-fails-structure/base/pkgs/sets/barPackages/by-name/bar/package.nix b/tests/integration/added-package-set-fails-structure/base/pkgs/sets/barPackages/by-name/bar/package.nix new file mode 100644 index 00000000..a395813d --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/base/pkgs/sets/barPackages/by-name/bar/package.nix @@ -0,0 +1,2 @@ +# non package, but not checked by nixpkgs-ver +{ }: null diff --git a/tests/integration/added-package-set-fails-structure/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/added-package-set-fails-structure/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/added-package-set-fails-structure/expected b/tests/integration/added-package-set-fails-structure/expected new file mode 100644 index 00000000..28905b62 --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/expected @@ -0,0 +1,3 @@ +- pkgs/sets/barPackages/by-name/bar: Invalid directory name "bar", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) +- pkgs/sets/barPackages/by-name/pa/package.nix: This path is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-140) +This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/added-package-set-fails-structure/main/default.nix b/tests/integration/added-package-set-fails-structure/main/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/main/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/added-package-set-fails-structure/main/nixpkgs-vet.json b/tests/integration/added-package-set-fails-structure/main/nixpkgs-vet.json new file mode 100644 index 00000000..d09a6f0c --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/main/nixpkgs-vet.json @@ -0,0 +1,16 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + }, + { + "by_name_subpath": "pkgs/sets/barPackages/by-name", + "attr_path": [ + "barPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/added-package-set-fails-structure/main/pkgs/sets/barPackages/by-name/bar/package.nix b/tests/integration/added-package-set-fails-structure/main/pkgs/sets/barPackages/by-name/bar/package.nix new file mode 100644 index 00000000..7f381219 --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/main/pkgs/sets/barPackages/by-name/bar/package.nix @@ -0,0 +1,2 @@ +# non-package, but ignored in new package set +{ }: null diff --git a/tests/integration/added-package-set-fails-structure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/added-package-set-fails-structure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/added-package-set-fails-structure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/added-package-set-with-empty-by-name/base/default.nix b/tests/integration/added-package-set-with-empty-by-name/base/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/base/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/added-package-set-with-empty-by-name/base/nixpkgs-vet.json b/tests/integration/added-package-set-with-empty-by-name/base/nixpkgs-vet.json new file mode 100644 index 00000000..ff24dab8 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/base/nixpkgs-vet.json @@ -0,0 +1,10 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/aliases.nix b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/aliases.nix new file mode 100644 index 00000000..168707f4 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/aliases.nix @@ -0,0 +1,3 @@ +final: prev: { + bar-alias = final.bar; +} diff --git a/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/by-name/README.md b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/manual-packages.nix b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/manual-packages.nix new file mode 100644 index 00000000..e165c714 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/barPackages/manual-packages.nix @@ -0,0 +1,3 @@ +final: prev: { + bar = final.callPackage ({ mkFakeDrv }: mkFakeDrv (_: { })) { }; +} diff --git a/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/added-package-set-with-empty-by-name/expected b/tests/integration/added-package-set-with-empty-by-name/expected new file mode 100644 index 00000000..defae263 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/expected @@ -0,0 +1 @@ +Validated successfully diff --git a/tests/integration/added-package-set-with-empty-by-name/main/default.nix b/tests/integration/added-package-set-with-empty-by-name/main/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/main/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/added-package-set-with-empty-by-name/main/nixpkgs-vet.json b/tests/integration/added-package-set-with-empty-by-name/main/nixpkgs-vet.json new file mode 100644 index 00000000..d09a6f0c --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/main/nixpkgs-vet.json @@ -0,0 +1,16 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + }, + { + "by_name_subpath": "pkgs/sets/barPackages/by-name", + "attr_path": [ + "barPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/aliases.nix b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/aliases.nix new file mode 100644 index 00000000..168707f4 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/aliases.nix @@ -0,0 +1,3 @@ +final: prev: { + bar-alias = final.bar; +} diff --git a/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/by-name/README.md b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/manual-packages.nix b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/manual-packages.nix new file mode 100644 index 00000000..e165c714 --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/barPackages/manual-packages.nix @@ -0,0 +1,3 @@ +final: prev: { + bar = final.callPackage ({ mkFakeDrv }: mkFakeDrv (_: { })) { }; +} diff --git a/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/added-package-set-with-empty-by-name/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/fixed-broken-config-file/base/nixpkgs-vet.json b/tests/integration/fixed-broken-config-file/base/nixpkgs-vet.json new file mode 100644 index 00000000..375d5c3c --- /dev/null +++ b/tests/integration/fixed-broken-config-file/base/nixpkgs-vet.json @@ -0,0 +1 @@ +meow diff --git a/tests/integration/fixed-broken-config-file/expected b/tests/integration/fixed-broken-config-file/expected new file mode 100644 index 00000000..e209e185 --- /dev/null +++ b/tests/integration/fixed-broken-config-file/expected @@ -0,0 +1 @@ +The base branch is broken, but this PR fixes it. Nice job! diff --git a/tests/integration/newly-broken-config-file/expected b/tests/integration/newly-broken-config-file/expected new file mode 100644 index 00000000..1b8473fa --- /dev/null +++ b/tests/integration/newly-broken-config-file/expected @@ -0,0 +1,3 @@ +expected value at line 1 column 1 +- Config file couldn't be read properly, see error above. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-180) +This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/newly-broken-config-file/main/nixpkgs-vet.json b/tests/integration/newly-broken-config-file/main/nixpkgs-vet.json new file mode 100644 index 00000000..375d5c3c --- /dev/null +++ b/tests/integration/newly-broken-config-file/main/nixpkgs-vet.json @@ -0,0 +1 @@ +meow diff --git a/tests/integration/removed-package-set-unbreaks/base/default.nix b/tests/integration/removed-package-set-unbreaks/base/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/base/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/removed-package-set-unbreaks/base/nixpkgs-vet.json b/tests/integration/removed-package-set-unbreaks/base/nixpkgs-vet.json new file mode 100644 index 00000000..d09a6f0c --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/base/nixpkgs-vet.json @@ -0,0 +1,16 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + }, + { + "by_name_subpath": "pkgs/sets/barPackages/by-name", + "attr_path": [ + "barPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/barPackages/by-name/bar/package.nix b/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/barPackages/by-name/bar/package.nix new file mode 100644 index 00000000..7f381219 --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/barPackages/by-name/bar/package.nix @@ -0,0 +1,2 @@ +# non-package, but ignored in new package set +{ }: null diff --git a/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/removed-package-set-unbreaks/expected b/tests/integration/removed-package-set-unbreaks/expected new file mode 100644 index 00000000..e209e185 --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/expected @@ -0,0 +1 @@ +The base branch is broken, but this PR fixes it. Nice job! diff --git a/tests/integration/removed-package-set-unbreaks/main/default.nix b/tests/integration/removed-package-set-unbreaks/main/default.nix new file mode 100644 index 00000000..861260cd --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/main/default.nix @@ -0,0 +1 @@ +import { root = ./.; } diff --git a/tests/integration/removed-package-set-unbreaks/main/nixpkgs-vet.json b/tests/integration/removed-package-set-unbreaks/main/nixpkgs-vet.json new file mode 100644 index 00000000..ff24dab8 --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/main/nixpkgs-vet.json @@ -0,0 +1,10 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] + } + ] +} \ No newline at end of file diff --git a/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/barPackages/by-name/bar/package.nix b/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/barPackages/by-name/bar/package.nix new file mode 100644 index 00000000..a395813d --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/barPackages/by-name/bar/package.nix @@ -0,0 +1,2 @@ +# non package, but not checked by nixpkgs-ver +{ }: null diff --git a/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/removed-package-set-unbreaks/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/still-broken-config-file/base/nixpkgs-vet.json b/tests/integration/still-broken-config-file/base/nixpkgs-vet.json new file mode 100644 index 00000000..375d5c3c --- /dev/null +++ b/tests/integration/still-broken-config-file/base/nixpkgs-vet.json @@ -0,0 +1 @@ +meow diff --git a/tests/integration/still-broken-config-file/expected b/tests/integration/still-broken-config-file/expected new file mode 100644 index 00000000..ca8bdb65 --- /dev/null +++ b/tests/integration/still-broken-config-file/expected @@ -0,0 +1,4 @@ +expected value at line 1 column 1 +- Config file couldn't be read properly, see error above. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-180) +The base branch is broken and still has above problems with this PR, which need to be fixed first. +Consider reverting the PR that introduced these problems in order to prevent more failures of unrelated PRs. diff --git a/tests/integration/still-broken-config-file/main/nixpkgs-vet.json b/tests/integration/still-broken-config-file/main/nixpkgs-vet.json new file mode 100644 index 00000000..375d5c3c --- /dev/null +++ b/tests/integration/still-broken-config-file/main/nixpkgs-vet.json @@ -0,0 +1 @@ +meow diff --git a/tests/mock-nixpkgs.nix b/tests/mock-nixpkgs.nix index f6d32c94..c3209f50 100644 --- a/tests/mock-nixpkgs.nix +++ b/tests/mock-nixpkgs.nix @@ -56,13 +56,12 @@ let }); }; - baseDirectory = root + "/pkgs/by-name"; - - # Generates { = ; } entries mapping package names to their `package.nix` files in `pkgs/by-name`. + # Generates { = ; } entries mapping package names to their `package.nix` files in the `baseDirectory` # Could be more efficient, but this is only for testing. - autoCalledPackageFiles = + autoCalledPackageFilesFor = + baseDirectory: let - entries = builtins.readDir baseDirectory; + entries = if builtins.pathExists baseDirectory then builtins.readDir baseDirectory else { }; namesForShard = shard: @@ -76,31 +75,72 @@ let in builtins.foldl' (acc: el: acc // el) { } (map namesForShard (builtins.attrNames entries)); - # Turns autoCalledPackageFiles into an overlay that `callPackage`'s all of them - autoCalledPackages = - self: super: builtins.mapAttrs (name: file: self.callPackage file { }) autoCalledPackageFiles; + # Turns autoCalledPackagesFor into an overlay that `callPackage`'s all of them + autoCalledPackagesFor = + by_name_subpth: final: prev: + builtins.mapAttrs (name: file: final.callPackage file { }) ( + autoCalledPackageFilesFor (root + "/${by_name_subpth}") + ); + + autoCalledPackages = autoCalledPackagesFor "pkgs/by-name"; + + # A list optionally containing an overlay imported from the given path. + importIfExists = + path: if builtins.pathExists (root + "/${path}") then [ (import (root + "/${path}")) ] else [ ]; # A list optionally containing the `all-packages.nix` file from the test case as an overlay - optionalAllPackagesOverlay = - if builtins.pathExists (root + "/pkgs/top-level/all-packages.nix") then - [ (import (root + "/pkgs/top-level/all-packages.nix")) ] - else - [ ]; + optionalAllPackagesOverlay = importIfExists "pkgs/top-level/all-packages.nix"; # A list optionally containing the `aliases.nix` file from the test case as an overlay # But only if config.allowAliases is not false optionalAliasesOverlay = - if (config.allowAliases or true) && builtins.pathExists (root + "/aliases.nix") then - [ (import (root + "/aliases.nix")) ] + if (config.allowAliases or true) then (importIfExists "aliases.nix") else [ ]; + + # A list of top level package sets in pkgs/sets. + # For now the tests only cover top level package sets. + packageSets = + if builtins.pathExists (root + "/pkgs/sets") then + builtins.attrNames (builtins.readDir (root + "/pkgs/sets")) else [ ]; + # A list of overlays, each containing a package set with their autocalled packages, + # manual packages and aliases. + packageSetOverlays = lib.flip map packageSets ( + name: + let + # Like the outer scope autoCalledPackages, but for the package set + autoCalledPackages = autoCalledPackagesFor "pkgs/sets/${name}/by-name"; + + # Like the outer scope optionalAllPackagesOverlay, but for the package set + optionalManualPackagesOverlay = importIfExists "pkgs/sets/${name}/manual-packages.nix"; + + # Like the outer scope optionalAliasesOverlay, but for the package set + optionalAliasesOverlay = + if (config.allowAliases or true) then (importIfExists "pkgs/sets/${name}/aliases.nix") else [ ]; + + # Like the outer scope allOverlays but for the package set + allOverlays = [ + autoCalledPackages + ] + ++ optionalManualPackagesOverlay + ++ optionalAliasesOverlay; + + # Like the outer scope f but for the package set + f = lib.foldl' (lib.flip lib.extends) (self: { }) allOverlays; + in + rootfinal: rootprev: { + ${name} = lib.makeScope rootfinal.newScope f; + } + ); + # All the overlays in the right order, including the user-supplied ones allOverlays = [ autoCalledPackages ] ++ optionalAllPackagesOverlay ++ optionalAliasesOverlay + ++ packageSetOverlays ++ overlays; # Apply all the overlays in order to the base fixed-point function pkgsFun diff --git a/tests/tests-nixpkgs-vet.json b/tests/tests-nixpkgs-vet.json new file mode 100644 index 00000000..b97bd0ca --- /dev/null +++ b/tests/tests-nixpkgs-vet.json @@ -0,0 +1,8 @@ +{ + "package_sets": [ + { + "by_name_subpath": "pkgs/by-name", + "attr_path": [] + } + ] +} \ No newline at end of file From fd6a31aeda96f7b83bcbbfd573641b98d2c46fa7 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Wed, 25 Nov 2026 01:40:29 +0100 Subject: [PATCH 6/8] test alternative by-name directory This adds a non top-level by-name directory to every existing test. --- .../main/pkgs/sets/fooPackages/aliases.nix | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../pkgs/sets/fooPackages/manual-packages.nix | 1 + .../base/pkgs/sets/fooPackages/by-name/foo | 0 .../pkgs/sets/fooPackages/by-name/README.md | 0 .../base/pkgs/sets/fooPackages/by-name/foo | 0 tests/integration/base-still-broken/expected | 1 + .../main/pkgs/sets/fooPackages/by-name/bar | 0 tests/integration/broken-autocall/expected | 1 + .../broken-autocall/main/default.nix | 9 ++++++++- .../fooPackages/by-name/fo/foo/package.nix | 1 + tests/integration/by-name-failure/expected | 3 +++ .../fooPackages/by-name/fo/foo/package.nix | 3 +++ tests/integration/by-name-numprefix/expected | 2 ++ .../fooPackages/by-name/10/10foo/package.nix | 1 + .../pkgs/sets/fooPackages/by-name/README.md | 0 .../pkgs/sets/fooPackages/by-name/README.md | 0 tests/integration/incorrect-shard/expected | 1 + .../fooPackages/by-name/aa/FOO/package.nix | 1 + .../integration/invalid-package-name/expected | 1 + .../fooPackages/by-name/fo/fo@/package.nix | 1 + tests/integration/invalid-shard-name/expected | 1 + .../sets/fooPackages/by-name/A/A/.git-keep | 0 .../sets/fooPackages/by-name/A/A/package.nix | 1 + .../integration/missing-package-nix/expected | 1 + .../sets/fooPackages/by-name/fo/foo/.git-keep | 0 .../fooPackages/by-name/fo/foo1/package.nix | 1 + .../fooPackages/by-name/fo/foo2/package.nix | 1 + .../integration/move-to-non-by-name/expected | 6 ++++++ .../pkgs/sets/fooPackages/by-name/README.md | 0 .../pkgs/sets/fooPackages/manual-packages.nix | 4 ++++ tests/integration/multiple-failures/expected | 20 +++++++++++++++++++ .../pkgs/sets/fooPackages/by-name/A/fo@/foo | 1 + .../fooPackages/by-name/A/fo@/package.nix | 1 + .../main/pkgs/sets/fooPackages/by-name/aa | 0 .../main/pkgs/sets/fooPackages/by-name/ba/bar | 0 .../by-name/ba/baz/package.nix/default.nix | 1 + .../fooPackages/by-name/ba/foo/package.nix | 8 ++++++++ .../sets/fooPackages/by-name/fo/foo/.git-keep | 0 .../pkgs/sets/fooPackages/by-name/README.md | 0 .../pkgs/sets/fooPackages/manual-packages.nix | 3 +++ .../new-package-non-by-name/expected | 16 +++++++++++++++ .../pkgs/sets/fooPackages/by-name/README.md | 0 .../pkgs/sets/fooPackages/manual-packages.nix | 7 +++++++ .../expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 7 +++++++ .../expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 7 +++++++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 7 +++++++ .../integration/nix-file-executable/expected | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../fooPackages/by-name/fo/foo/package.nix | 2 ++ .../nix-file-shebang-not-executable/expected | 1 + .../fooPackages/by-name/fo/foo/package.nix | 2 ++ .../pkgs/sets/fooPackages/by-name/README.md | 0 .../pkgs/sets/fooPackages/by-name/README.md | 0 tests/integration/non-attrs/expected | 1 + .../by-name/no/nonDerivation/package.nix | 1 + tests/integration/non-derivation/expected | 1 + .../by-name/no/nonDerivation/package.nix | 1 + .../sets/fooPackages/by-name/a/a/package.nix | 1 + .../pkgs/sets/fooPackages/by-name/README.md | 0 .../integration/package-dir-is-file/expected | 1 + .../main/pkgs/sets/fooPackages/by-name/fo/foo | 0 tests/integration/package-nix-dir/expected | 1 + .../by-name/fo/foo/package.nix/default.nix | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + tests/integration/ref-absolute/expected | 1 + .../fooPackages/by-name/aa/aa/package.nix | 1 + tests/integration/ref-escape/expected | 8 ++++++++ .../fooPackages/by-name/aa/aa/package.nix | 1 + tests/integration/ref-home-path/expected | 1 + .../fooPackages/by-name/aa/aa/package.nix | 1 + tests/integration/ref-nix-path/expected | 1 + .../fooPackages/by-name/aa/aa/package.nix | 1 + tests/integration/ref-path-subexpr/expected | 1 + .../fooPackages/by-name/aa/aa/package.nix | 1 + .../fooPackages/by-name/aa/aa/dir/default.nix | 2 ++ .../pkgs/sets/fooPackages/by-name/aa/aa/file | 0 .../sets/fooPackages/by-name/aa/aa/file.nix | 2 ++ .../fooPackages/by-name/aa/aa/package.nix | 7 +++++++ tests/integration/shard-file/expected | 1 + .../main/pkgs/sets/fooPackages/by-name/fo | 0 .../strict-deps-new-false/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../strict-deps-new-passthru/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 8 ++++++++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../strict-deps-new-unset/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 5 +++++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../strict-deps-regression/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../structured-attrs-new-false/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../structured-attrs-new-passthru/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 8 ++++++++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../structured-attrs-new-unset/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 5 +++++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../structured-attrs-regression/expected | 3 +++ .../pkgs/sets/fooPackages/by-name/README.md | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + tests/integration/symlink-escape/expected | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + tests/integration/symlink-invalid/expected | 1 + .../pkgs/sets/fooPackages/by-name/fo/foo/foo | 1 + .../fooPackages/by-name/fo/foo/package.nix | 1 + .../fooPackages/by-name/fo/FOO/package.nix | 1 + .../useless-multi-line-escapes/expected | 8 ++++++++ .../fooPackages/by-name/fo/foo/package.nix | 12 +++++++++++ .../useless-single-line-escapes/expected | 8 ++++++++ .../fooPackages/by-name/fo/foo/package.nix | 2 ++ .../pkgs/sets/fooPackages/by-name/README.md | 0 tests/tests-nixpkgs-vet.json | 6 ++++++ 132 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 tests/integration/aliases/main/pkgs/sets/fooPackages/aliases.nix create mode 100644 tests/integration/aliases/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/aliases/main/pkgs/sets/fooPackages/manual-packages.nix create mode 100644 tests/integration/base-fixed/base/pkgs/sets/fooPackages/by-name/foo create mode 100644 tests/integration/base-fixed/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/base-still-broken/base/pkgs/sets/fooPackages/by-name/foo create mode 100644 tests/integration/base-still-broken/main/pkgs/sets/fooPackages/by-name/bar create mode 100644 tests/integration/broken-autocall/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/by-name-failure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/by-name-numprefix/main/pkgs/sets/fooPackages/by-name/10/10foo/package.nix create mode 100644 tests/integration/callPackage-syntax/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/empty-base/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/incorrect-shard/main/pkgs/sets/fooPackages/by-name/aa/FOO/package.nix create mode 100644 tests/integration/invalid-package-name/main/pkgs/sets/fooPackages/by-name/fo/fo@/package.nix create mode 100644 tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/.git-keep create mode 100644 tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/package.nix create mode 100644 tests/integration/missing-package-nix/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep create mode 100644 tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo1/package.nix create mode 100644 tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo2/package.nix create mode 100644 tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix create mode 120000 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/foo create mode 120000 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/package.nix create mode 100644 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/aa create mode 100644 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/bar create mode 100644 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/baz/package.nix/default.nix create mode 100644 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/foo/package.nix create mode 100644 tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep create mode 100644 tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/manual-packages.nix create mode 100644 tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix create mode 100644 tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100755 tests/integration/nix-file-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100755 tests/integration/nix-file-shebang-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/nix-file-shebang-not-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/no-eval/base/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/no-eval/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/non-attrs/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix create mode 100644 tests/integration/non-derivation/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix create mode 100644 tests/integration/one-letter/main/pkgs/sets/fooPackages/by-name/a/a/package.nix create mode 100644 tests/integration/only-callPackage-derivations/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/package-dir-is-file/main/pkgs/sets/fooPackages/by-name/fo/foo create mode 100644 tests/integration/package-nix-dir/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix/default.nix create mode 100644 tests/integration/package-variants/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/package-variants/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/ref-absolute/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/ref-escape/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/ref-home-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/ref-nix-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/ref-path-subexpr/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/dir/default.nix create mode 100644 tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file create mode 100644 tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file.nix create mode 100644 tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix create mode 100644 tests/integration/shard-file/main/pkgs/sets/fooPackages/by-name/fo create mode 100644 tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/README.md create mode 100644 tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/success/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 120000 tests/integration/symlink-escape/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 120000 tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/foo create mode 100644 tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/uppercase/main/pkgs/sets/fooPackages/by-name/fo/FOO/package.nix create mode 100644 tests/integration/useless-multi-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/useless-single-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix create mode 100644 tests/integration/with-readme/main/pkgs/sets/fooPackages/by-name/README.md diff --git a/tests/integration/aliases/main/pkgs/sets/fooPackages/aliases.nix b/tests/integration/aliases/main/pkgs/sets/fooPackages/aliases.nix new file mode 100644 index 00000000..fd9a09cd --- /dev/null +++ b/tests/integration/aliases/main/pkgs/sets/fooPackages/aliases.nix @@ -0,0 +1 @@ +self: super: { baz = self.foo; } diff --git a/tests/integration/aliases/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/aliases/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/aliases/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/aliases/main/pkgs/sets/fooPackages/manual-packages.nix b/tests/integration/aliases/main/pkgs/sets/fooPackages/manual-packages.nix new file mode 100644 index 00000000..c16f435b --- /dev/null +++ b/tests/integration/aliases/main/pkgs/sets/fooPackages/manual-packages.nix @@ -0,0 +1 @@ +self: super: { bar = self.foo; } diff --git a/tests/integration/base-fixed/base/pkgs/sets/fooPackages/by-name/foo b/tests/integration/base-fixed/base/pkgs/sets/fooPackages/by-name/foo new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/base-fixed/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/base-fixed/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/base-still-broken/base/pkgs/sets/fooPackages/by-name/foo b/tests/integration/base-still-broken/base/pkgs/sets/fooPackages/by-name/foo new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/base-still-broken/expected b/tests/integration/base-still-broken/expected index a4fe8219..79bbf06f 100644 --- a/tests/integration/base-still-broken/expected +++ b/tests/integration/base-still-broken/expected @@ -1,3 +1,4 @@ - pkgs/by-name/bar: This is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-109) +- pkgs/sets/fooPackages/by-name/bar: This is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-109) The base branch is broken and still has above problems with this PR, which need to be fixed first. Consider reverting the PR that introduced these problems in order to prevent more failures of unrelated PRs. diff --git a/tests/integration/base-still-broken/main/pkgs/sets/fooPackages/by-name/bar b/tests/integration/base-still-broken/main/pkgs/sets/fooPackages/by-name/bar new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/broken-autocall/expected b/tests/integration/broken-autocall/expected index b0273942..9cb6aec2 100644 --- a/tests/integration/broken-autocall/expected +++ b/tests/integration/broken-autocall/expected @@ -1,2 +1,3 @@ - foo: This attribute is not defined but it should be defined automatically as pkgs/by-name/fo/foo/package.nix (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-100) +- fooPackages.foo: This attribute is not defined but it should be defined automatically as pkgs/sets/fooPackages/by-name/fo/foo/package.nix (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-100) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/broken-autocall/main/default.nix b/tests/integration/broken-autocall/main/default.nix index 840ae1e9..203493bd 100644 --- a/tests/integration/broken-autocall/main/default.nix +++ b/tests/integration/broken-autocall/main/default.nix @@ -1 +1,8 @@ -args: builtins.removeAttrs (import { root = ./.; } args) [ "foo" ] +args: +let + original = import { root = ./.; } args; +in +builtins.removeAttrs original [ "foo" ] +// { + fooPackages = builtins.removeAttrs original.fooPackages [ "foo" ]; +} diff --git a/tests/integration/broken-autocall/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/broken-autocall/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/broken-autocall/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/by-name-failure/expected b/tests/integration/by-name-failure/expected index df2e30b6..3ad7b13a 100644 --- a/tests/integration/by-name-failure/expected +++ b/tests/integration/by-name-failure/expected @@ -1,4 +1,7 @@ trace: This should be on stderr! @REDACTED@error: This is an error!@REDACTED@ - Nix evaluation failed for some package in `pkgs/by-name`, see error above (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-120) +trace: This should be on stderr! +@REDACTED@error: This is an error!@REDACTED@ +- Nix evaluation failed for some package in `pkgs/sets/fooPackages/by-name`, see error above (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-120) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/by-name-failure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/by-name-failure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..51081b04 --- /dev/null +++ b/tests/integration/by-name-failure/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,3 @@ +{ }: +# If we caused an actual Nix failure +builtins.trace "This should be on stderr!" throw "This is an error!" diff --git a/tests/integration/by-name-numprefix/expected b/tests/integration/by-name-numprefix/expected index fb11cd7a..a773c6b3 100644 --- a/tests/integration/by-name-numprefix/expected +++ b/tests/integration/by-name-numprefix/expected @@ -1,3 +1,5 @@ - pkgs/by-name/10: Invalid directory name "10", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) - pkgs/by-name/10/10foo: Invalid package directory name "10foo", must start with a letter (a-z, A-Z) or "_", followed by ASCII characters a-z, A-Z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-141) +- pkgs/sets/fooPackages/by-name/10: Invalid directory name "10", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) +- pkgs/sets/fooPackages/by-name/10/10foo: Invalid package directory name "10foo", must start with a letter (a-z, A-Z) or "_", followed by ASCII characters a-z, A-Z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-141) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/by-name-numprefix/main/pkgs/sets/fooPackages/by-name/10/10foo/package.nix b/tests/integration/by-name-numprefix/main/pkgs/sets/fooPackages/by-name/10/10foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/by-name-numprefix/main/pkgs/sets/fooPackages/by-name/10/10foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/callPackage-syntax/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/callPackage-syntax/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/empty-base/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/empty-base/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/incorrect-shard/expected b/tests/integration/incorrect-shard/expected index 18410532..73034840 100644 --- a/tests/integration/incorrect-shard/expected +++ b/tests/integration/incorrect-shard/expected @@ -1,2 +1,3 @@ - pkgs/by-name/aa/FOO: Incorrect directory location, should be pkgs/by-name/fo/FOO instead. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-142) +- pkgs/sets/fooPackages/by-name/aa/FOO: Incorrect directory location, should be pkgs/sets/fooPackages/by-name/fo/FOO instead. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-142) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/incorrect-shard/main/pkgs/sets/fooPackages/by-name/aa/FOO/package.nix b/tests/integration/incorrect-shard/main/pkgs/sets/fooPackages/by-name/aa/FOO/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/incorrect-shard/main/pkgs/sets/fooPackages/by-name/aa/FOO/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/invalid-package-name/expected b/tests/integration/invalid-package-name/expected index 5df0c5f5..83ec2d5b 100644 --- a/tests/integration/invalid-package-name/expected +++ b/tests/integration/invalid-package-name/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/fo@: Invalid package directory name "fo@", must start with a letter (a-z, A-Z) or "_", followed by ASCII characters a-z, A-Z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-141) +- pkgs/sets/fooPackages/by-name/fo/fo@: Invalid package directory name "fo@", must start with a letter (a-z, A-Z) or "_", followed by ASCII characters a-z, A-Z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-141) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/invalid-package-name/main/pkgs/sets/fooPackages/by-name/fo/fo@/package.nix b/tests/integration/invalid-package-name/main/pkgs/sets/fooPackages/by-name/fo/fo@/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/invalid-package-name/main/pkgs/sets/fooPackages/by-name/fo/fo@/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/invalid-shard-name/expected b/tests/integration/invalid-shard-name/expected index 9557a78c..3fdf961f 100644 --- a/tests/integration/invalid-shard-name/expected +++ b/tests/integration/invalid-shard-name/expected @@ -1,2 +1,3 @@ - pkgs/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) +- pkgs/sets/fooPackages/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/.git-keep b/tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/.git-keep new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/package.nix b/tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/invalid-shard-name/main/pkgs/sets/fooPackages/by-name/A/A/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/missing-package-nix/expected b/tests/integration/missing-package-nix/expected index cba2b339..8514ff46 100644 --- a/tests/integration/missing-package-nix/expected +++ b/tests/integration/missing-package-nix/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo: Missing required "package.nix" file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-143) +- pkgs/sets/fooPackages/by-name/fo/foo: Missing required "package.nix" file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-143) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/missing-package-nix/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep b/tests/integration/missing-package-nix/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo1/package.nix b/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo1/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo1/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo2/package.nix b/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo2/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/move-to-non-by-name/base/pkgs/sets/fooPackages/by-name/fo/foo2/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/move-to-non-by-name/expected b/tests/integration/move-to-non-by-name/expected index 8bf48ad8..650319db 100644 --- a/tests/integration/move-to-non-by-name/expected +++ b/tests/integration/move-to-non-by-name/expected @@ -4,4 +4,10 @@ - Attribute `foo2` was previously defined in pkgs/by-name/fo/foo2/package.nix, but is now manually defined as `callPackage ./without-config.nix { /* ... */ }` in pkgs/top-level/all-packages.nix. Please move the package back and remove the manual `callPackage`. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-160) +- Attribute `fooPackages.foo1` was previously defined in pkgs/sets/fooPackages/by-name/fo/foo1/package.nix, but is now manually defined as `callPackage ... { /* ... */ }` in pkgs/sets/fooPackages/manual-packages.nix. + Please move the package back and remove the manual `callPackage`. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-160) +- Attribute `fooPackages.foo2` was previously defined in pkgs/sets/fooPackages/by-name/fo/foo2/package.nix, but is now manually defined as `callPackage ./without-config.nix { /* ... */ }` in pkgs/sets/fooPackages/manual-packages.nix. + Please move the package back and remove the manual `callPackage`. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-160) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix b/tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix new file mode 100644 index 00000000..ddec1689 --- /dev/null +++ b/tests/integration/move-to-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix @@ -0,0 +1,4 @@ +self: super: { + foo1 = self.callPackage ({ someDrv }: someDrv) { }; + foo2 = self.callPackage ./../../../without-config.nix { }; +} diff --git a/tests/integration/multiple-failures/expected b/tests/integration/multiple-failures/expected index ed91eddb..fd351706 100644 --- a/tests/integration/multiple-failures/expected +++ b/tests/integration/multiple-failures/expected @@ -18,4 +18,24 @@ - pkgs/by-name/ba/foo: File package.nix at line 6 contains the nix search path expression "" which may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-122) - pkgs/by-name/ba/foo: File package.nix at line 7 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-121) - pkgs/by-name/fo/foo: Missing required "package.nix" file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-143) +- pkgs/sets/fooPackages/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters, starting with a-z or "_", consisting of a-z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-110) +- pkgs/sets/fooPackages/by-name/A/fo@: Invalid package directory name "fo@", must start with a letter (a-z, A-Z) or "_", followed by ASCII characters a-z, A-Z, 0-9, "-" or "_". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-141) +- pkgs/sets/fooPackages/by-name/A/fo@: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2). (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-126) +- pkgs/sets/fooPackages/by-name/A/fo@: Path package.nix is a symlink pointing to a path outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-125) +- pkgs/sets/fooPackages/by-name/aa: This is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-109) +- pkgs/sets/fooPackages/by-name/ba/bar: This path is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-140) +- pkgs/sets/fooPackages/by-name/ba/baz: "package.nix" must be a file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-144) +- pkgs/sets/fooPackages/by-name/ba/foo: Incorrect directory location, should be pkgs/sets/fooPackages/by-name/fo/foo instead. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-142) +- pkgs/sets/fooPackages/by-name/ba/foo: File package.nix at line 4 contains the absolute path expression "/bar", which is not allowed in nixpkgs. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-127) +- pkgs/sets/fooPackages/by-name/ba/foo: File package.nix at line 5 contains the path expression "../." which may point outside the directory of that package. + This is undesirable because it creates dependencies between internal paths, making it harder to reorganise Nixpkgs in the future. + Alternatives include: + - If you are creating a new version of a package with a common file between versions, consider following the recommendation in https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name#recommendation-for-new-packages-with-multiple-versions. + - If the path being referenced could be considered a stable interface with multiple uses, consider exposing it via a `pkgs` attribute, then taking it as a attribute argument in package.nix. + - If the path being referenced is internal and has multiple uses, consider passing the file as an explicit `callPackage` argument in `pkgs/top-level/all-packages.nix`. + - If the path being referenced is internal and will need to be modified independently of the original, consider copying it into the pkgs/sets/fooPackages/by-name/ba/foo directory. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-123) +- pkgs/sets/fooPackages/by-name/ba/foo: File package.nix at line 6 contains the nix search path expression "" which may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-122) +- pkgs/sets/fooPackages/by-name/ba/foo: File package.nix at line 7 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-121) +- pkgs/sets/fooPackages/by-name/fo/foo: Missing required "package.nix" file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-143) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/foo b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/foo new file mode 120000 index 00000000..c86c3f35 --- /dev/null +++ b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/foo @@ -0,0 +1 @@ +none \ No newline at end of file diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/package.nix b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/package.nix new file mode 120000 index 00000000..9f671441 --- /dev/null +++ b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/package.nix @@ -0,0 +1 @@ +../../../../../../someDrv.nix \ No newline at end of file diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/aa b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/aa new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/bar b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/bar new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/baz/package.nix/default.nix b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/baz/package.nix/default.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/baz/package.nix/default.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/foo/package.nix b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/foo/package.nix new file mode 100644 index 00000000..90352b2c --- /dev/null +++ b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/ba/foo/package.nix @@ -0,0 +1,8 @@ +{ someDrv }: +someDrv +// { + escapeAbsolute = /bar; + escapeRelative = ../.; + nixPath = ; + pathWithSubexpr = ./${"test"}; +} diff --git a/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep b/tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/fo/foo/.git-keep new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/manual-packages.nix b/tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/manual-packages.nix new file mode 100644 index 00000000..ed02594d --- /dev/null +++ b/tests/integration/new-package-non-by-name/base/pkgs/sets/fooPackages/manual-packages.nix @@ -0,0 +1,3 @@ +self: super: { + before = self.callPackage ({ someDrv }: someDrv) { }; +} diff --git a/tests/integration/new-package-non-by-name/expected b/tests/integration/new-package-non-by-name/expected index 2dd6e387..4f4672e1 100644 --- a/tests/integration/new-package-non-by-name/expected +++ b/tests/integration/new-package-non-by-name/expected @@ -1,3 +1,19 @@ +- Attribute `fooPackages.new1` is a new top-level package using `callPackage ... { /* ... */ }`. + Please define it in pkgs/sets/fooPackages/by-name/ne/new1/package.nix instead. + See `pkgs/by-name/README.md` for more details. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-162) +- Attribute `fooPackages.new2` is a new top-level package using `callPackage ./without-config.nix { /* ... */ }`. + Please define it in pkgs/sets/fooPackages/by-name/ne/new2/package.nix instead. + See `pkgs/by-name/README.md` for more details. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-162) +- Attribute `fooPackages.new3` is a new top-level package using `callPackage ... { /* ... */ }`. + Please define it in pkgs/sets/fooPackages/by-name/ne/new3/package.nix instead. + See `pkgs/by-name/README.md` for more details. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-162) +- Attribute `fooPackages.new4` is a new top-level package using `callPackage ./with-config.nix { /* ... */ }`. + Please define it in pkgs/sets/fooPackages/by-name/ne/new4/package.nix instead. + See `pkgs/by-name/README.md` for more details. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-162) - Attribute `new1` is a new top-level package using `callPackage ... { /* ... */ }`. Please define it in pkgs/by-name/ne/new1/package.nix instead. See `pkgs/by-name/README.md` for more details. diff --git a/tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix b/tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix new file mode 100644 index 00000000..154bc110 --- /dev/null +++ b/tests/integration/new-package-non-by-name/main/pkgs/sets/fooPackages/manual-packages.nix @@ -0,0 +1,7 @@ +self: super: { + before = self.callPackage ({ someDrv }: someDrv) { }; + new1 = self.callPackage ({ someDrv }: someDrv) { }; + new2 = self.callPackage ./../../../without-config.nix { }; + new3 = self.callPackage ({ someDrv, enableNew }: someDrv) { enableNew = null; }; + new4 = self.callPackage ./../../../with-config.nix { enableNew = null; }; +} diff --git a/tests/integration/new-plain-derivation-strict-deps-unset/expected b/tests/integration/new-plain-derivation-strict-deps-unset/expected index e59beab0..f3d8b355 100644 --- a/tests/integration/new-plain-derivation-strict-deps-unset/expected +++ b/tests/integration/new-plain-derivation-strict-deps-unset/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `strictDeps` unset or set to `false`. Please enable `strictDeps = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) +- Attribute `fooPackages.foo` is a new package with `strictDeps` unset or set to `false`. + Please enable `strictDeps = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..06c7fb6b --- /dev/null +++ b/tests/integration/new-plain-derivation-strict-deps-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,7 @@ +{ }: +# A "plain" derivation without `overrideAttrs` +{ + type = "derivation"; + __structuredAttrs = true; + # No strictDeps +} diff --git a/tests/integration/new-plain-derivation-structured-attrs-unset/expected b/tests/integration/new-plain-derivation-structured-attrs-unset/expected index b396ab18..c770416d 100644 --- a/tests/integration/new-plain-derivation-structured-attrs-unset/expected +++ b/tests/integration/new-plain-derivation-structured-attrs-unset/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `__structuredAttrs` unset or set to `false`. Please enable `__structuredAttrs = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) +- Attribute `fooPackages.foo` is a new package with `__structuredAttrs` unset or set to `false`. + Please enable `__structuredAttrs = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..79b3c783 --- /dev/null +++ b/tests/integration/new-plain-derivation-structured-attrs-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,7 @@ +{ }: +# A "plain" derivation without `overrideAttrs` +{ + type = "derivation"; + # No __structuredAttrs + strictDeps = true; +} diff --git a/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..0b23d27c --- /dev/null +++ b/tests/integration/new-plain-derivation/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,7 @@ +{ }: +# A "plain" derivation without `overrideAttrs` +{ + type = "derivation"; + __structuredAttrs = true; + strictDeps = true; +} diff --git a/tests/integration/nix-file-executable/expected b/tests/integration/nix-file-executable/expected index 3569f6c9..978ef83a 100644 --- a/tests/integration/nix-file-executable/expected +++ b/tests/integration/nix-file-executable/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo/package.nix: Nix files must not be executable unless they have a shebang (`#!`) line. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-145) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: Nix files must not be executable unless they have a shebang (`#!`) line. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-145) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/nix-file-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/nix-file-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100755 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/nix-file-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/nix-file-shebang-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/nix-file-shebang-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100755 index 00000000..95939fe1 --- /dev/null +++ b/tests/integration/nix-file-shebang-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,2 @@ +#!/usr/bin/env nix-shell +{ someDrv }: someDrv diff --git a/tests/integration/nix-file-shebang-not-executable/expected b/tests/integration/nix-file-shebang-not-executable/expected index 43523a37..cf7d707c 100644 --- a/tests/integration/nix-file-shebang-not-executable/expected +++ b/tests/integration/nix-file-shebang-not-executable/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo/package.nix: Nix files with a shebang (`#!`) line must be executable. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-146) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: Nix files with a shebang (`#!`) line must be executable. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-146) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/nix-file-shebang-not-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/nix-file-shebang-not-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..95939fe1 --- /dev/null +++ b/tests/integration/nix-file-shebang-not-executable/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,2 @@ +#!/usr/bin/env nix-shell +{ someDrv }: someDrv diff --git a/tests/integration/no-eval/base/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/no-eval/base/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/no-eval/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/no-eval/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/non-attrs/expected b/tests/integration/non-attrs/expected index 0960babb..afc1cc1c 100644 --- a/tests/integration/non-attrs/expected +++ b/tests/integration/non-attrs/expected @@ -1,2 +1,3 @@ - nonDerivation: This attribute defined by pkgs/by-name/no/nonDerivation/package.nix is not a derivation (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-101) +- fooPackages.nonDerivation: This attribute defined by pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix is not a derivation (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-101) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/non-attrs/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix b/tests/integration/non-attrs/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix new file mode 100644 index 00000000..bd68dba1 --- /dev/null +++ b/tests/integration/non-attrs/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix @@ -0,0 +1 @@ +{ }: null diff --git a/tests/integration/non-derivation/expected b/tests/integration/non-derivation/expected index 0960babb..afc1cc1c 100644 --- a/tests/integration/non-derivation/expected +++ b/tests/integration/non-derivation/expected @@ -1,2 +1,3 @@ - nonDerivation: This attribute defined by pkgs/by-name/no/nonDerivation/package.nix is not a derivation (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-101) +- fooPackages.nonDerivation: This attribute defined by pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix is not a derivation (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-101) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/non-derivation/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix b/tests/integration/non-derivation/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix new file mode 100644 index 00000000..b021e28c --- /dev/null +++ b/tests/integration/non-derivation/main/pkgs/sets/fooPackages/by-name/no/nonDerivation/package.nix @@ -0,0 +1 @@ +{ }: { } diff --git a/tests/integration/one-letter/main/pkgs/sets/fooPackages/by-name/a/a/package.nix b/tests/integration/one-letter/main/pkgs/sets/fooPackages/by-name/a/a/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/one-letter/main/pkgs/sets/fooPackages/by-name/a/a/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/only-callPackage-derivations/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/only-callPackage-derivations/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/package-dir-is-file/expected b/tests/integration/package-dir-is-file/expected index 98a44e08..475aa194 100644 --- a/tests/integration/package-dir-is-file/expected +++ b/tests/integration/package-dir-is-file/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo: This path is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-140) +- pkgs/sets/fooPackages/by-name/fo/foo: This path is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-140) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/package-dir-is-file/main/pkgs/sets/fooPackages/by-name/fo/foo b/tests/integration/package-dir-is-file/main/pkgs/sets/fooPackages/by-name/fo/foo new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/package-nix-dir/expected b/tests/integration/package-nix-dir/expected index f6a692af..a7e3b3e8 100644 --- a/tests/integration/package-nix-dir/expected +++ b/tests/integration/package-nix-dir/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo: "package.nix" must be a file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-144) +- pkgs/sets/fooPackages/by-name/fo/foo: "package.nix" must be a file. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-144) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/package-nix-dir/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix/default.nix b/tests/integration/package-nix-dir/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix/default.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/package-nix-dir/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix/default.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/package-variants/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/package-variants/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/package-variants/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/package-variants/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/package-variants/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/package-variants/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/ref-absolute/expected b/tests/integration/ref-absolute/expected index 89574570..c7b5f9d6 100644 --- a/tests/integration/ref-absolute/expected +++ b/tests/integration/ref-absolute/expected @@ -1,2 +1,3 @@ - pkgs/by-name/aa/aa: File package.nix at line 1 contains the absolute path expression "/foo", which is not allowed in nixpkgs. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-127) +- pkgs/sets/fooPackages/by-name/aa/aa: File package.nix at line 1 contains the absolute path expression "/foo", which is not allowed in nixpkgs. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-127) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/ref-absolute/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-absolute/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..ae97501a --- /dev/null +++ b/tests/integration/ref-absolute/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { escape = /foo; } diff --git a/tests/integration/ref-escape/expected b/tests/integration/ref-escape/expected index 809264e9..e810138b 100644 --- a/tests/integration/ref-escape/expected +++ b/tests/integration/ref-escape/expected @@ -6,4 +6,12 @@ - If the path being referenced is internal and has multiple uses, consider passing the file as an explicit `callPackage` argument in `pkgs/top-level/all-packages.nix`. - If the path being referenced is internal and will need to be modified independently of the original, consider copying it into the pkgs/by-name/aa/aa directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-123) +- pkgs/sets/fooPackages/by-name/aa/aa: File package.nix at line 1 contains the path expression "../." which may point outside the directory of that package. + This is undesirable because it creates dependencies between internal paths, making it harder to reorganise Nixpkgs in the future. + Alternatives include: + - If you are creating a new version of a package with a common file between versions, consider following the recommendation in https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name#recommendation-for-new-packages-with-multiple-versions. + - If the path being referenced could be considered a stable interface with multiple uses, consider exposing it via a `pkgs` attribute, then taking it as a attribute argument in package.nix. + - If the path being referenced is internal and has multiple uses, consider passing the file as an explicit `callPackage` argument in `pkgs/top-level/all-packages.nix`. + - If the path being referenced is internal and will need to be modified independently of the original, consider copying it into the pkgs/sets/fooPackages/by-name/aa/aa directory. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-123) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/ref-escape/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-escape/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..7a7927aa --- /dev/null +++ b/tests/integration/ref-escape/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { escape = ../.; } diff --git a/tests/integration/ref-home-path/expected b/tests/integration/ref-home-path/expected index f5ba56ff..87ca39cc 100644 --- a/tests/integration/ref-home-path/expected +++ b/tests/integration/ref-home-path/expected @@ -1,2 +1,3 @@ - pkgs/by-name/aa/aa: File package.nix at line 1 contains the home-relative path expression "~/foo", which is not allowed in nixpkgs. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-128) +- pkgs/sets/fooPackages/by-name/aa/aa: File package.nix at line 1 contains the home-relative path expression "~/foo", which is not allowed in nixpkgs. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-128) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/ref-home-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-home-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..5b5cd2db --- /dev/null +++ b/tests/integration/ref-home-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { home = ~/foo; } diff --git a/tests/integration/ref-nix-path/expected b/tests/integration/ref-nix-path/expected index d3fb7bb3..abf8e6de 100644 --- a/tests/integration/ref-nix-path/expected +++ b/tests/integration/ref-nix-path/expected @@ -1,2 +1,3 @@ - pkgs/by-name/aa/aa: File package.nix at line 1 contains the nix search path expression "" which may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-122) +- pkgs/sets/fooPackages/by-name/aa/aa: File package.nix at line 1 contains the nix search path expression "" which may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-122) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/ref-nix-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-nix-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..1205c5b1 --- /dev/null +++ b/tests/integration/ref-nix-path/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { nixPath = ; } diff --git a/tests/integration/ref-path-subexpr/expected b/tests/integration/ref-path-subexpr/expected index abbee188..d5b2669e 100644 --- a/tests/integration/ref-path-subexpr/expected +++ b/tests/integration/ref-path-subexpr/expected @@ -1,2 +1,3 @@ - pkgs/by-name/aa/aa: File package.nix at line 1 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-121) +- pkgs/sets/fooPackages/by-name/aa/aa: File package.nix at line 1 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-121) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/ref-path-subexpr/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-path-subexpr/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..8af0f3bc --- /dev/null +++ b/tests/integration/ref-path-subexpr/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { pathWithSubexpr = ./${"test"}; } diff --git a/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/dir/default.nix b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/dir/default.nix new file mode 100644 index 00000000..7e4a7548 --- /dev/null +++ b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/dir/default.nix @@ -0,0 +1,2 @@ +# Recursive +../package.nix diff --git a/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file.nix b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file.nix new file mode 100644 index 00000000..bd55e601 --- /dev/null +++ b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/file.nix @@ -0,0 +1,2 @@ +# Recursive test +import ./file.nix diff --git a/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix new file mode 100644 index 00000000..2660f9a0 --- /dev/null +++ b/tests/integration/ref-success/main/pkgs/sets/fooPackages/by-name/aa/aa/package.nix @@ -0,0 +1,7 @@ +{ someDrv }: +someDrv +// { + nixFile = ./file.nix; + nonNixFile = ./file; + directory = ./dir; +} diff --git a/tests/integration/shard-file/expected b/tests/integration/shard-file/expected index d5f9b71a..1330e132 100644 --- a/tests/integration/shard-file/expected +++ b/tests/integration/shard-file/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo: This is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-109) +- pkgs/sets/fooPackages/by-name/fo: This is a file, but it should be a directory. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-109) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/shard-file/main/pkgs/sets/fooPackages/by-name/fo b/tests/integration/shard-file/main/pkgs/sets/fooPackages/by-name/fo new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/strict-deps-new-false/expected b/tests/integration/strict-deps-new-false/expected index e59beab0..f3d8b355 100644 --- a/tests/integration/strict-deps-new-false/expected +++ b/tests/integration/strict-deps-new-false/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `strictDeps` unset or set to `false`. Please enable `strictDeps = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) +- Attribute `fooPackages.foo` is a new package with `strictDeps` unset or set to `false`. + Please enable `strictDeps = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..b7693f77 --- /dev/null +++ b/tests/integration/strict-deps-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv.overrideAttrs (_: _: { strictDeps = false; }) diff --git a/tests/integration/strict-deps-new-passthru/expected b/tests/integration/strict-deps-new-passthru/expected index e59beab0..f3d8b355 100644 --- a/tests/integration/strict-deps-new-passthru/expected +++ b/tests/integration/strict-deps-new-passthru/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `strictDeps` unset or set to `false`. Please enable `strictDeps = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) +- Attribute `fooPackages.foo` is a new package with `strictDeps` unset or set to `false`. + Please enable `strictDeps = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..2b91b4a1 --- /dev/null +++ b/tests/integration/strict-deps-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,8 @@ +{ mkFakeDrv }: +mkFakeDrv (finalAttrs: { + __structuredAttrs = true; + # No strictDeps +}) +// { + strictDeps = true; +} diff --git a/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..62c3689e --- /dev/null +++ b/tests/integration/strict-deps-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { strictDeps = true; } diff --git a/tests/integration/strict-deps-new-unset/expected b/tests/integration/strict-deps-new-unset/expected index e59beab0..f3d8b355 100644 --- a/tests/integration/strict-deps-new-unset/expected +++ b/tests/integration/strict-deps-new-unset/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `strictDeps` unset or set to `false`. Please enable `strictDeps = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) +- Attribute `fooPackages.foo` is a new package with `strictDeps` unset or set to `false`. + Please enable `strictDeps = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-164) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..2f175146 --- /dev/null +++ b/tests/integration/strict-deps-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,5 @@ +{ mkFakeDrv }: +mkFakeDrv (finalAttrs: { + __structuredAttrs = true; + # No strictDeps +}) diff --git a/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/strict-deps-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/strict-deps-regression/expected b/tests/integration/strict-deps-regression/expected index eb2261d0..af16d6e6 100644 --- a/tests/integration/strict-deps-regression/expected +++ b/tests/integration/strict-deps-regression/expected @@ -1,4 +1,7 @@ - Attribute `foo` previously evaluated with `strictDeps = true`, but now evaluates with `strictDeps = false`. Please re-enable `strictDeps = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-165) +- Attribute `fooPackages.foo` previously evaluated with `strictDeps = true`, but now evaluates with `strictDeps = false`. + Please re-enable `strictDeps = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-165) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..b7693f77 --- /dev/null +++ b/tests/integration/strict-deps-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv.overrideAttrs (_: _: { strictDeps = false; }) diff --git a/tests/integration/structured-attrs-new-false/expected b/tests/integration/structured-attrs-new-false/expected index b396ab18..c770416d 100644 --- a/tests/integration/structured-attrs-new-false/expected +++ b/tests/integration/structured-attrs-new-false/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `__structuredAttrs` unset or set to `false`. Please enable `__structuredAttrs = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) +- Attribute `fooPackages.foo` is a new package with `__structuredAttrs` unset or set to `false`. + Please enable `__structuredAttrs = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..ea6ab057 --- /dev/null +++ b/tests/integration/structured-attrs-new-false/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv.overrideAttrs (_: _: { __structuredAttrs = false; }) diff --git a/tests/integration/structured-attrs-new-passthru/expected b/tests/integration/structured-attrs-new-passthru/expected index b396ab18..c770416d 100644 --- a/tests/integration/structured-attrs-new-passthru/expected +++ b/tests/integration/structured-attrs-new-passthru/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `__structuredAttrs` unset or set to `false`. Please enable `__structuredAttrs = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) +- Attribute `fooPackages.foo` is a new package with `__structuredAttrs` unset or set to `false`. + Please enable `__structuredAttrs = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..ecb7a1d6 --- /dev/null +++ b/tests/integration/structured-attrs-new-passthru/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,8 @@ +{ mkFakeDrv }: +mkFakeDrv (finalAttrs: { + strictDeps = true; + # No __structuredAttrs +}) +// { + __structuredAttrs = true; +} diff --git a/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..c0b68f99 --- /dev/null +++ b/tests/integration/structured-attrs-new-true/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv // { __structuredAttrs = true; } diff --git a/tests/integration/structured-attrs-new-unset/expected b/tests/integration/structured-attrs-new-unset/expected index b396ab18..c770416d 100644 --- a/tests/integration/structured-attrs-new-unset/expected +++ b/tests/integration/structured-attrs-new-unset/expected @@ -1,4 +1,7 @@ - Attribute `foo` is a new package with `__structuredAttrs` unset or set to `false`. Please enable `__structuredAttrs = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) +- Attribute `fooPackages.foo` is a new package with `__structuredAttrs` unset or set to `false`. + Please enable `__structuredAttrs = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-166) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..78f48f34 --- /dev/null +++ b/tests/integration/structured-attrs-new-unset/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,5 @@ +{ mkFakeDrv }: +mkFakeDrv (finalAttrs: { + strictDeps = true; + # No __structuredAttrs +}) diff --git a/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/structured-attrs-regression/base/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/structured-attrs-regression/expected b/tests/integration/structured-attrs-regression/expected index 4e37b2d1..c606107a 100644 --- a/tests/integration/structured-attrs-regression/expected +++ b/tests/integration/structured-attrs-regression/expected @@ -1,4 +1,7 @@ - Attribute `foo` previously evaluated with `__structuredAttrs = true`, but now evaluates with `__structuredAttrs = false`. Please re-enable `__structuredAttrs = true;` in pkgs/by-name/fo/foo/package.nix. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-167) +- Attribute `fooPackages.foo` previously evaluated with `__structuredAttrs = true`, but now evaluates with `__structuredAttrs = false`. + Please re-enable `__structuredAttrs = true;` in pkgs/sets/fooPackages/by-name/fo/foo/package.nix. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-167) This PR introduces additional instances of discouraged patterns as listed above. Please fix them before merging. diff --git a/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..232fdecb --- /dev/null +++ b/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/README.md @@ -0,0 +1 @@ +# Test fixture diff --git a/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..ea6ab057 --- /dev/null +++ b/tests/integration/structured-attrs-regression/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv.overrideAttrs (_: _: { __structuredAttrs = false; }) diff --git a/tests/integration/success/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/success/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/success/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/symlink-escape/expected b/tests/integration/symlink-escape/expected index 7e4c1b72..93310b5f 100644 --- a/tests/integration/symlink-escape/expected +++ b/tests/integration/symlink-escape/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo: Path package.nix is a symlink pointing to a path outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-125) +- pkgs/sets/fooPackages/by-name/fo/foo: Path package.nix is a symlink pointing to a path outside the directory of that package. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-125) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/symlink-escape/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/symlink-escape/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 120000 index 00000000..9f671441 --- /dev/null +++ b/tests/integration/symlink-escape/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +../../../../../../someDrv.nix \ No newline at end of file diff --git a/tests/integration/symlink-invalid/expected b/tests/integration/symlink-invalid/expected index 848079ff..c75cd487 100644 --- a/tests/integration/symlink-invalid/expected +++ b/tests/integration/symlink-invalid/expected @@ -1,2 +1,3 @@ - pkgs/by-name/fo/foo: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2). (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-126) +- pkgs/sets/fooPackages/by-name/fo/foo: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2). (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-126) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/foo b/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/foo new file mode 120000 index 00000000..c86c3f35 --- /dev/null +++ b/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/foo @@ -0,0 +1 @@ +none \ No newline at end of file diff --git a/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/uppercase/main/pkgs/sets/fooPackages/by-name/fo/FOO/package.nix b/tests/integration/uppercase/main/pkgs/sets/fooPackages/by-name/fo/FOO/package.nix new file mode 100644 index 00000000..a1b92efb --- /dev/null +++ b/tests/integration/uppercase/main/pkgs/sets/fooPackages/by-name/fo/FOO/package.nix @@ -0,0 +1 @@ +{ someDrv }: someDrv diff --git a/tests/integration/useless-multi-line-escapes/expected b/tests/integration/useless-multi-line-escapes/expected index 11b4bd35..71bb88d6 100644 --- a/tests/integration/useless-multi-line-escapes/expected +++ b/tests/integration/useless-multi-line-escapes/expected @@ -6,4 +6,12 @@ This escape has no effect; it is equivalent to ".". Change it to that. (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: line 10, column 6 contains the escape "''\\". + This escape has no effect; it is equivalent to "\". + Change it to that. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: line 11, column 6 contains the escape "''\.". + This escape has no effect; it is equivalent to ".". + Change it to that. + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/useless-multi-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/useless-multi-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..6ade9829 --- /dev/null +++ b/tests/integration/useless-multi-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,12 @@ +{ someDrv }: +builtins.seq '' + # Valid + \. \/ + ''' + ''$ + ''\n + '\n + # Problems + ''\\ + ''\. +'' someDrv diff --git a/tests/integration/useless-single-line-escapes/expected b/tests/integration/useless-single-line-escapes/expected index ee60f77d..fcbd775a 100644 --- a/tests/integration/useless-single-line-escapes/expected +++ b/tests/integration/useless-single-line-escapes/expected @@ -6,4 +6,12 @@ This escape has no effect; it is equivalent to "/". Depending on your intention, either change it to that, or to the non-equivalent "\\/". (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: line 2, column 30 contains the escape "\.". + This escape has no effect; it is equivalent to ".". + Depending on your intention, either change it to that, or to the non-equivalent "\\.". + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) +- pkgs/sets/fooPackages/by-name/fo/foo/package.nix: line 2, column 33 contains the escape "\/". + This escape has no effect; it is equivalent to "/". + Depending on your intention, either change it to that, or to the non-equivalent "\\/". + (https://github.com/NixOS/nixpkgs-vet/wiki/NPV-170) This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/integration/useless-single-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix b/tests/integration/useless-single-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix new file mode 100644 index 00000000..3d6bdb9f --- /dev/null +++ b/tests/integration/useless-single-line-escapes/main/pkgs/sets/fooPackages/by-name/fo/foo/package.nix @@ -0,0 +1,2 @@ +# First two escapes are bad, the last is good. +{ someDrv }: builtins.seq " \. \/ \\." someDrv diff --git a/tests/integration/with-readme/main/pkgs/sets/fooPackages/by-name/README.md b/tests/integration/with-readme/main/pkgs/sets/fooPackages/by-name/README.md new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-nixpkgs-vet.json b/tests/tests-nixpkgs-vet.json index b97bd0ca..500252ff 100644 --- a/tests/tests-nixpkgs-vet.json +++ b/tests/tests-nixpkgs-vet.json @@ -3,6 +3,12 @@ { "by_name_subpath": "pkgs/by-name", "attr_path": [] + }, + { + "by_name_subpath": "pkgs/sets/fooPackages/by-name", + "attr_path": [ + "fooPackages" + ] } ] } \ No newline at end of file From 5deac12ebbe94046e4a6b599169988604c9a3b2e Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Fri, 13 Nov 2026 22:28:36 +0100 Subject: [PATCH 7/8] fix xrefcheck workflow --- .github/xrefcheck.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/xrefcheck.yaml b/.github/xrefcheck.yaml index 6bb91b0d..88818ca4 100644 --- a/.github/xrefcheck.yaml +++ b/.github/xrefcheck.yaml @@ -13,7 +13,9 @@ exclusions: - .github/PULL_REQUEST_TEMPLATE/**/* - .github/ISSUE_TEMPLATE/**/* - tests/integration/symlink-invalid/main/pkgs/by-name/fo/foo/foo + - tests/integration/symlink-invalid/main/pkgs/sets/fooPackages/by-name/fo/foo/foo - tests/integration/multiple-failures/main/pkgs/by-name/A/fo@/foo + - tests/integration/multiple-failures/main/pkgs/sets/fooPackages/by-name/A/fo@/foo # References to these paths will not be verified. # List of glob patterns. From 432749bdf0359079ceefb55c03de9bb5b9827d71 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Wed, 25 Nov 2026 22:22:48 +0100 Subject: [PATCH 8/8] add changeset --- .../add_support_for_multiple_by_name_directories.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changeset/add_support_for_multiple_by_name_directories.md diff --git a/.changeset/add_support_for_multiple_by_name_directories.md b/.changeset/add_support_for_multiple_by_name_directories.md new file mode 100644 index 00000000..f743bcd8 --- /dev/null +++ b/.changeset/add_support_for_multiple_by_name_directories.md @@ -0,0 +1,9 @@ +--- +default: minor +--- + +# Add support for multiple by-name directories + +The goal is to be able to check package sets with nixpkgs-vet aswell. + +See https://github.com/nixos/rfcs/pull/197