1 # nix-build -A nixosTests.docker-tools-nix-shell
4 inherit (config.node.pkgs.dockerTools) examples;
7 name = "docker-tools-nix-shell";
8 meta = with lib.maintainers; {
27 docker.wait_for_unit("sockets.target")
29 with subtest("buildImageWithNixDB: Has a nix database"):
31 "docker load --input='${examples.nix}'",
32 "docker run --rm ${examples.nix.imageName} nix-store -q --references /bin/bash"
35 with subtest("buildNixShellImage: Can build a basic derivation"):
37 "${examples.nix-shell-basic} | docker load",
38 "docker run --rm nix-shell-basic bash -c 'buildDerivation && $out/bin/hello' | grep '^Hello, world!$'"
41 with subtest("buildNixShellImage: Runs the shell hook"):
43 "${examples.nix-shell-hook} | docker load",
44 "docker run --rm -it nix-shell-hook | grep 'This is the shell hook!'"
47 with subtest("buildNixShellImage: Sources stdenv, making build inputs available"):
49 "${examples.nix-shell-inputs} | docker load",
50 "docker run --rm -it nix-shell-inputs | grep 'Hello, world!'"
53 with subtest("buildNixShellImage: passAsFile works"):
55 "${examples.nix-shell-pass-as-file} | docker load",
56 "docker run --rm -it nix-shell-pass-as-file | grep 'this is a string'"
59 with subtest("buildNixShellImage: run argument works"):
61 "${examples.nix-shell-run} | docker load",
62 "docker run --rm -it nix-shell-run | grep 'This shell is not interactive'"
65 with subtest("buildNixShellImage: command argument works"):
67 "${examples.nix-shell-command} | docker load",
68 "docker run --rm -it nix-shell-command | grep 'This shell is interactive'"
71 with subtest("buildNixShellImage: home directory is writable by default"):
73 "${examples.nix-shell-writable-home} | docker load",
74 "docker run --rm -it nix-shell-writable-home"
77 with subtest("buildNixShellImage: home directory can be made non-existent"):
79 "${examples.nix-shell-nonexistent-home} | docker load",
80 "docker run --rm -it nix-shell-nonexistent-home"
83 with subtest("buildNixShellImage: can build derivations"):
85 "${examples.nix-shell-build-derivation} | docker load",
86 "docker run --rm -it nix-shell-build-derivation"
89 with subtest("streamLayeredImage: with nix db"):
91 "${examples.nix-layered} | docker load",
92 "docker run --rm ${examples.nix-layered.imageName} nix-store -q --references /bin/bash"