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