@@ -0,0 +1,42 @@
1+# Test for NixOS' container support.
2+
3+import ./make-test-python.nix ({ pkgs, lib, ...} : let
4+
5+ customPkgs = pkgs // {
6+ hello = pkgs.hello.overrideAttrs(old: {
7+ name = "custom-hello";
8+ });
9+ };
10+
11+in {
12+ name = "containers-hosts";
13+ meta = with lib.maintainers; {
14+ maintainers = [ adisbladis ];
15+ };
16+
17+ machine =
18+ { ... }:
19+ {
20+ virtualisation.memorySize = 256;
21+ virtualisation.vlans = [];
22+
23+ containers.simple = {
24+ autoStart = true;
25+ pkgs = customPkgs;
26+ config = {pkgs, config, ... }: {
27+ environment.systemPackages = [
28+ pkgs.hello
29+ ];
30+ };
31+ };
32+
33+ };
34+
35+ testScript = ''
36+ start_all()
37+ machine.wait_for_unit("default.target")
38+ machine.succeed(
39+ "test $(nixos-container run simple -- readlink -f /run/current-system/sw/bin/hello) = ${customPkgs.hello}/bin/hello"
40+ )
41+ '';
42+})