mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 22:32:26 +00:00
Make wrapper derivation
This ensures just `nix build`-ing the flake doesn't forget to run all tests. One can still specifiy specific attributes to just build one thing. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
6f3045c2a2
commit
b41cc1a755
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -195,20 +195,6 @@ jobs:
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- run: nix build -L .#hydraJobs.tests.githubFlakes .#hydraJobs.tests.tarballFlakes .#hydraJobs.tests.functional_user
|
||||
|
||||
meson_build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
# Only meson packages that don't have a tests.run derivation.
|
||||
# Those that have it are already built and tested as part of nix flake check.
|
||||
- run: nix build -L .#hydraJobs.build.{nix-cmd,nix-main}.$(nix-instantiate --eval --expr builtins.currentSystem | sed -e 's/"//g')
|
||||
|
||||
flake_regressions:
|
||||
needs: vm_tests
|
||||
runs-on: ubuntu-22.04
|
||||
|
51
flake.nix
51
flake.nix
@ -139,11 +139,6 @@
|
||||
|
||||
nix = final.nixComponents.nix;
|
||||
|
||||
nix_noTests = final.nix.override {
|
||||
doInstallCheck = false;
|
||||
doCheck = false;
|
||||
};
|
||||
|
||||
# See https://github.com/NixOS/nixpkgs/pull/214409
|
||||
# Remove when fixed in this flake's nixpkgs
|
||||
pre-commit =
|
||||
@ -222,7 +217,7 @@
|
||||
# for which we don't apply the full build matrix such as cross or static.
|
||||
inherit (nixpkgsFor.${system}.native)
|
||||
changelog-d;
|
||||
default = self.packages.${system}.nix;
|
||||
default = self.packages.${system}.nix-ng;
|
||||
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
|
||||
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
|
||||
}
|
||||
@ -230,22 +225,48 @@
|
||||
// flatMapAttrs
|
||||
{ # Components we'll iterate over in the upcoming lambda
|
||||
"nix" = { };
|
||||
# Temporarily disabled because GitHub Actions OOM issues. Once
|
||||
# the old build system is gone and we are back to one build
|
||||
# system, we should reenable these.
|
||||
#"nix-util" = { };
|
||||
#"nix-store" = { };
|
||||
#"nix-fetchers" = { };
|
||||
"nix-util" = { };
|
||||
"nix-util-c" = { };
|
||||
"nix-util-test-support" = { };
|
||||
"nix-util-tests" = { };
|
||||
|
||||
"nix-store" = { };
|
||||
"nix-store-c" = { };
|
||||
"nix-store-test-support" = { };
|
||||
"nix-store-tests" = { };
|
||||
|
||||
"nix-fetchers" = { };
|
||||
"nix-fetchers-tests" = { };
|
||||
|
||||
"nix-expr" = { };
|
||||
"nix-expr-c" = { };
|
||||
"nix-expr-test-support" = { };
|
||||
"nix-expr-tests" = { };
|
||||
|
||||
"nix-flake" = { };
|
||||
"nix-flake-tests" = { };
|
||||
|
||||
"nix-main" = { };
|
||||
"nix-main-c" = { };
|
||||
|
||||
"nix-cmd" = { };
|
||||
|
||||
"nix-cli" = { };
|
||||
|
||||
"nix-functional-tests" = { supportsCross = false; };
|
||||
|
||||
"nix-perl-bindings" = { supportsCross = false; };
|
||||
"nix-ng" = { };
|
||||
}
|
||||
(pkgName: {}: {
|
||||
(pkgName: { supportsCross ? true }: {
|
||||
# These attributes go right into `packages.<system>`.
|
||||
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName};
|
||||
"${pkgName}-static" = nixpkgsFor.${system}.static.nixComponents.${pkgName};
|
||||
}
|
||||
// flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: {
|
||||
// lib.optionalAttrs supportsCross (flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: {
|
||||
# These attributes go right into `packages.<system>`.
|
||||
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName};
|
||||
})
|
||||
}))
|
||||
// flatMapAttrs (lib.genAttrs stdenvs (_: { })) (stdenvName: {}: {
|
||||
# These attributes go right into `packages.<system>`.
|
||||
"${pkgName}-${stdenvName}" = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".nixComponents.${pkgName};
|
||||
|
@ -56,8 +56,7 @@ in
|
||||
|
||||
nix-cmd = callPackage ../src/libcmd/package.nix { };
|
||||
|
||||
# Will replace `nix` once the old build system is gone.
|
||||
nix-ng = callPackage ../src/nix/package.nix { version = fineVersion; };
|
||||
nix-cli = callPackage ../src/nix/package.nix { version = fineVersion; };
|
||||
|
||||
nix-functional-tests = callPackage ../src/nix-functional-tests/package.nix { version = fineVersion; };
|
||||
|
||||
@ -65,4 +64,7 @@ in
|
||||
nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { version = fineVersion; };
|
||||
|
||||
nix-perl-bindings = callPackage ../src/perl/package.nix { };
|
||||
|
||||
# Will replace `nix` once the old build system is gone.
|
||||
nix-ng = callPackage ../packaging/everything.nix { };
|
||||
}
|
||||
|
93
packaging/everything.nix
Normal file
93
packaging/everything.nix
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildEnv,
|
||||
|
||||
nix-util,
|
||||
nix-util-c,
|
||||
nix-util-test-support,
|
||||
nix-util-tests,
|
||||
|
||||
nix-store,
|
||||
nix-store-c,
|
||||
nix-store-test-support,
|
||||
nix-store-tests,
|
||||
|
||||
nix-fetchers,
|
||||
nix-fetchers-tests,
|
||||
|
||||
nix-expr,
|
||||
nix-expr-c,
|
||||
nix-expr-test-support,
|
||||
nix-expr-tests,
|
||||
|
||||
nix-flake,
|
||||
nix-flake-tests,
|
||||
|
||||
nix-main,
|
||||
nix-main-c,
|
||||
|
||||
nix-cmd,
|
||||
|
||||
nix-cli,
|
||||
|
||||
nix-functional-tests,
|
||||
|
||||
nix-internal-api-docs,
|
||||
nix-external-api-docs,
|
||||
|
||||
nix-perl-bindings,
|
||||
}:
|
||||
|
||||
(buildEnv rec {
|
||||
name = "nix-${nix-cli.version}";
|
||||
paths = [
|
||||
nix-util
|
||||
nix-util-c
|
||||
nix-util-test-support
|
||||
nix-util-tests
|
||||
|
||||
nix-store
|
||||
nix-store-c
|
||||
nix-store-test-support
|
||||
nix-store-tests
|
||||
|
||||
nix-fetchers
|
||||
nix-fetchers-tests
|
||||
|
||||
nix-expr
|
||||
nix-expr-c
|
||||
nix-expr-test-support
|
||||
nix-expr-tests
|
||||
|
||||
nix-flake
|
||||
nix-flake-tests
|
||||
|
||||
nix-main
|
||||
nix-main-c
|
||||
|
||||
nix-cmd
|
||||
|
||||
nix-cli
|
||||
|
||||
nix-internal-api-docs
|
||||
nix-external-api-docs
|
||||
|
||||
] ++ lib.optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
||||
nix-perl-bindings
|
||||
];
|
||||
}).overrideAttrs (_: {
|
||||
doCheck = true;
|
||||
doInstallCheck = true;
|
||||
|
||||
checkInputs = [
|
||||
# Actually run the unit tests too
|
||||
nix-util-tests.tests.run
|
||||
nix-store-tests.tests.run
|
||||
nix-expr-tests.tests.run
|
||||
nix-flake-tests.tests.run
|
||||
];
|
||||
installCheckInputs = [
|
||||
nix-functional-tests
|
||||
];
|
||||
})
|
@ -61,8 +61,9 @@ let
|
||||
"nix-main"
|
||||
"nix-main-c"
|
||||
"nix-cmd"
|
||||
"nix-ng"
|
||||
"nix-cli"
|
||||
"nix-functional-tests"
|
||||
"nix-ng"
|
||||
];
|
||||
in
|
||||
{
|
||||
@ -85,7 +86,7 @@ in
|
||||
self.packages.${system}.nix.override { enableGC = false; }
|
||||
);
|
||||
|
||||
buildNoTests = forAllSystems (system: nixpkgsFor.${system}.native.nix_noTests);
|
||||
buildNoTests = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.nix-cli);
|
||||
|
||||
# Toggles some settings for better coverage. Windows needs these
|
||||
# library combinations, and Debian build Nix with GNU readline too.
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
, nix-store
|
||||
, nix-expr
|
||||
, nix-ng
|
||||
, nix-cli
|
||||
|
||||
, rapidcheck
|
||||
, gtest
|
||||
@ -67,7 +67,7 @@ mkMesonDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
nativeBuildInputs = finalAttrs.passthru.baseNativeBuildInputs ++ [
|
||||
nix-ng
|
||||
nix-cli
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
@ -105,7 +105,7 @@ mkMesonDerivation (finalAttrs: {
|
||||
doCheck = true;
|
||||
|
||||
installPhase = ''
|
||||
touch $out
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
@ -27,13 +27,13 @@ in
|
||||
};
|
||||
|
||||
config = {
|
||||
passthru.quickBuild =
|
||||
passthru.quickBuild =
|
||||
let withQuickBuild = extendModules { modules = [{ quickBuild = true; }]; };
|
||||
in withQuickBuild.config.test;
|
||||
|
||||
defaults = { pkgs, ... }: {
|
||||
config = lib.mkIf test.config.quickBuild {
|
||||
nix.package = pkgs.nix_noTests;
|
||||
nix.package = pkgs.nixComponents.nix-cli;
|
||||
|
||||
system.forbiddenDependenciesRegexes = [
|
||||
# This would indicate that the quickBuild feature is broken.
|
||||
@ -44,4 +44,4 @@ in
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user