2022-05-18 14:49:53 +00:00
|
|
|
{ lib, testers, pkgs, writeText, hello, figlet, stdenvNoCC }:
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
# -------------------------------------------------------------------------- #
|
|
|
|
#
|
|
|
|
# trivial-builders test
|
|
|
|
#
|
|
|
|
# -------------------------------------------------------------------------- #
|
|
|
|
#
|
|
|
|
# This file can be run independently (quick):
|
|
|
|
#
|
2021-12-06 16:07:01 +00:00
|
|
|
# $ pkgs/build-support/trivial-builders/references-test.sh
|
2021-05-20 23:08:51 +00:00
|
|
|
#
|
|
|
|
# or in the build sandbox with a ~20s VM overhead
|
|
|
|
#
|
2021-12-06 16:07:01 +00:00
|
|
|
# $ nix-build -A tests.trivial-builders.references
|
2021-05-20 23:08:51 +00:00
|
|
|
#
|
|
|
|
# -------------------------------------------------------------------------- #
|
|
|
|
|
|
|
|
let
|
|
|
|
invokeSamples = file:
|
|
|
|
lib.concatStringsSep " " (
|
|
|
|
lib.attrValues (import file { inherit pkgs; })
|
|
|
|
);
|
|
|
|
in
|
2022-05-18 14:49:53 +00:00
|
|
|
testers.nixosTest {
|
2021-05-20 23:08:51 +00:00
|
|
|
name = "nixpkgs-trivial-builders";
|
|
|
|
nodes.machine = { ... }: {
|
|
|
|
virtualisation.writableStore = true;
|
|
|
|
|
|
|
|
# Test runs without network, so we don't substitute and prepare our deps
|
2022-01-27 00:19:43 +00:00
|
|
|
nix.settings.substituters = lib.mkForce [];
|
2021-05-20 23:08:51 +00:00
|
|
|
environment.etc."pre-built-paths".source = writeText "pre-built-paths" (
|
|
|
|
builtins.toJSON [hello figlet stdenvNoCC]
|
|
|
|
);
|
|
|
|
environment.variables = {
|
2021-12-06 16:07:01 +00:00
|
|
|
SAMPLE = invokeSamples ./sample.nix;
|
|
|
|
REFERENCES = invokeSamples ./invoke-writeReferencesToFile.nix;
|
|
|
|
DIRECT_REFS = invokeSamples ./invoke-writeDirectReferencesToFile.nix;
|
2021-05-20 23:08:51 +00:00
|
|
|
};
|
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
testScript =
|
|
|
|
''
|
|
|
|
machine.succeed("""
|
|
|
|
${./references-test.sh} 2>/dev/console
|
|
|
|
""")
|
|
|
|
'';
|
2021-05-20 23:08:51 +00:00
|
|
|
meta = {
|
|
|
|
license = lib.licenses.mit; # nixpkgs license
|
|
|
|
maintainers = with lib.maintainers; [
|
|
|
|
roberth
|
|
|
|
];
|
|
|
|
description = "Run the Nixpkgs trivial builders tests";
|
|
|
|
};
|
|
|
|
}
|