aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/tests/containers-custom-pkgs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/tests/containers-custom-pkgs.nix')
-rw-r--r--nixpkgs/nixos/tests/containers-custom-pkgs.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/nixos/tests/containers-custom-pkgs.nix b/nixpkgs/nixos/tests/containers-custom-pkgs.nix
new file mode 100644
index 00000000000..397a4a905e6
--- /dev/null
+++ b/nixpkgs/nixos/tests/containers-custom-pkgs.nix
@@ -0,0 +1,42 @@
+# Test for NixOS' container support.
+
+import ./make-test-python.nix ({ pkgs, lib, ...} : let
+
+ customPkgs = pkgs // {
+ hello = pkgs.hello.overrideAttrs(old: {
+ name = "custom-hello";
+ });
+ };
+
+in {
+ name = "containers-hosts";
+ meta = with lib.maintainers; {
+ maintainers = [ adisbladis ];
+ };
+
+ machine =
+ { ... }:
+ {
+ virtualisation.memorySize = 256;
+ virtualisation.vlans = [];
+
+ containers.simple = {
+ autoStart = true;
+ pkgs = customPkgs;
+ config = {pkgs, config, ... }: {
+ environment.systemPackages = [
+ pkgs.hello
+ ];
+ };
+ };
+
+ };
+
+ testScript = ''
+ start_all()
+ machine.wait_for_unit("default.target")
+ machine.succeed(
+ "test $(nixos-container run simple -- readlink -f /run/current-system/sw/bin/hello) = ${customPkgs.hello}/bin/hello"
+ )
+ '';
+})