Skip to content

Commit 59765f3

Browse files
committed
fix(nix): isolate testing tools from default shell
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent 040e85b commit 59765f3

1 file changed

Lines changed: 41 additions & 35 deletions

File tree

‎flake.nix‎

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,32 @@
4646
};
4747
testGuestPkgs = import nixpkgs-test-guest { inherit system; };
4848
tmachineRuntimePkgs = if pkgs.stdenv.hostPlatform.isDarwin then testGuestPkgs else pkgs;
49-
commonDevShellPackages =
50-
with pkgs;
51-
[
52-
actionlint
53-
cargo-auditable
54-
cargo-deny
55-
cargo-nextest
56-
# Assemble Debian artifacts on macOS and Linux.
57-
dpkg
58-
# Build and inspect ext4 images in VM driver tests.
59-
e2fsprogs
60-
git
61-
# Required to find packages.
62-
pkg-config
63-
# Coverage.
64-
lcov
65-
kubernetes-helm
66-
syft
67-
trivy
68-
uv
69-
yq-go
70-
zizmor
71-
zstd
72-
]
73-
++ [
74-
pkgs.ansible
75-
pkgs.sshpass
76-
testMachines.package
77-
];
49+
commonDevShellPackages = with pkgs; [
50+
actionlint
51+
cargo-auditable
52+
cargo-deny
53+
cargo-nextest
54+
# Assemble Debian artifacts on macOS and Linux.
55+
dpkg
56+
# Build and inspect ext4 images in VM driver tests.
57+
e2fsprogs
58+
git
59+
# Required to find packages.
60+
pkg-config
61+
# Coverage.
62+
lcov
63+
kubernetes-helm
64+
syft
65+
trivy
66+
uv
67+
yq-go
68+
zizmor
69+
zstd
70+
];
71+
commonDevShell = {
72+
packages = [ rustToolchain ] ++ commonDevShellPackages;
73+
env = pkgs.lib.foldl' (env: toolchain: env // toolchain.env) { } (builtins.attrValues toolchains);
74+
};
7875
treefmtEval = treefmt-nix.lib.evalModule pkgs {
7976
projectRootFile = "flake.nix";
8077
programs.nixfmt.enable = true;
@@ -158,14 +155,23 @@
158155
tmachine-unwrapped = testMachines.unwrapped;
159156
};
160157

161-
devShells.default = pkgs.mkShellNoCC {
162-
packages = [ rustToolchain ] ++ commonDevShellPackages;
158+
devShells = {
159+
default = pkgs.mkShellNoCC commonDevShell;
163160

164-
env = pkgs.lib.foldl' (env: toolchain: env // toolchain.env) { } (builtins.attrValues toolchains);
161+
testing = pkgs.mkShellNoCC (
162+
commonDevShell
163+
// {
164+
packages = commonDevShell.packages ++ [
165+
pkgs.ansible
166+
pkgs.sshpass
167+
testMachines.package
168+
];
165169

166-
shellHook = ''
167-
export ANSIBLE_CONFIG="$(git rev-parse --show-toplevel)/tests/ansible/ansible.cfg"
168-
'';
170+
shellHook = ''
171+
export ANSIBLE_CONFIG="$(git rev-parse --show-toplevel)/tests/ansible/ansible.cfg"
172+
'';
173+
}
174+
);
169175
};
170176

171177
formatter = treefmtEval.config.build.wrapper;

0 commit comments

Comments
 (0)