Skip to content

Commit

Permalink
Make wrapper derivation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ericson2314 committed Aug 14, 2024
1 parent 6f3045c commit 9523e26
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 7 deletions.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,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;
}
Expand Down
6 changes: 4 additions & 2 deletions packaging/components.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ 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; };

nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { version = fineVersion; };
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 { };
}
91 changes: 91 additions & 0 deletions packaging/everything.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
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;

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

nix-functional-tests
];
})
3 changes: 2 additions & 1 deletion packaging/hydra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ let
"nix-main"
"nix-main-c"
"nix-cmd"
"nix-ng"
"nix-cli"
"nix-functional-tests"
"nix-ng"
];
in
{
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

, nix-store
, nix-expr
, nix-ng
, nix-cli

, rapidcheck
, gtest
Expand Down Expand Up @@ -67,7 +67,7 @@ mkMesonDerivation (finalAttrs: {
];

nativeBuildInputs = finalAttrs.passthru.baseNativeBuildInputs ++ [
nix-ng
nix-cli
];

buildInputs = [
Expand Down Expand Up @@ -105,7 +105,7 @@ mkMesonDerivation (finalAttrs: {
doCheck = true;

installPhase = ''
touch $out
mkdir $out
'';

meta = {
Expand Down

0 comments on commit 9523e26

Please sign in to comment.