add test and fix problem
This commit is contained in:
parent
6d209bc769
commit
ba85e37f0e
3 changed files with 49 additions and 3 deletions
|
@ -20,10 +20,10 @@ if [ ! -z "${PACKAGES}" ] && [ "${PACKAGES}" != "none" ]; then
|
||||||
if [ "${USEATTRPATH}" = "true" ]; then
|
if [ "${USEATTRPATH}" = "true" ]; then
|
||||||
PACKAGES=$(add_nixpkgs_prefix "$PACKAGES")
|
PACKAGES=$(add_nixpkgs_prefix "$PACKAGES")
|
||||||
echo "Installing packages \"${PACKAGES}\" in profile..."
|
echo "Installing packages \"${PACKAGES}\" in profile..."
|
||||||
nix-env -iA "${PACKAGES}"
|
nix-env -iA ${PACKAGES}
|
||||||
else
|
else
|
||||||
echo "Installing packages \"${PACKAGES}\" in profile..."
|
echo "Installing packages \"${PACKAGES}\" in profile..."
|
||||||
nix-env --install "${PACKAGES}"
|
nix-env --install ${PACKAGES}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
35
test/nix/packages-use-attr-path.sh
Executable file
35
test/nix/packages-use-attr-path.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Optional: Import test library bundled with the devcontainer CLI
|
||||||
|
source dev-container-features-test-lib
|
||||||
|
|
||||||
|
uid="$(id -u)"
|
||||||
|
echo "Current user UID is ${uid}."
|
||||||
|
if [ "${uid}" != "1000" ]; then
|
||||||
|
echo "Current user UID was adjusted."
|
||||||
|
fi
|
||||||
|
set +e
|
||||||
|
vscode_uid="$(id -u vscode)"
|
||||||
|
set -e
|
||||||
|
if [ "${vscode_uid}" != "" ]; then
|
||||||
|
echo "User vscode UID is ${vscode_uid}."
|
||||||
|
if [ "${vscode_uid}" != "1000" ]; then
|
||||||
|
echo "User vscode UID was adjusted."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
nix_uid="$(stat /nix -c "%u")"
|
||||||
|
echo "/nix UID is ${nix_uid}."
|
||||||
|
|
||||||
|
cat /etc/os-release
|
||||||
|
|
||||||
|
# Feature-specific tests
|
||||||
|
# The 'check' command comes from the dev-container-features-test-lib.
|
||||||
|
check "nix-env" type nix-env
|
||||||
|
check "vim_installed" type vim
|
||||||
|
check "node_installed" type node
|
||||||
|
check "yarn_installed" type yarn
|
||||||
|
|
||||||
|
# Report result
|
||||||
|
# If any of the checks above exited with a non-zero exit code, the test will fail.
|
||||||
|
reportResults &2>1
|
|
@ -81,6 +81,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"packages-use-attr-path": {
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"features": {
|
||||||
|
"nix": {
|
||||||
|
"packages": "nodePackages.nodejs,nixpkgs.vim,nixpkgs.yarn",
|
||||||
|
"useAttrPath": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"flake": {
|
"flake": {
|
||||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||||
"remoteUser": "vscode",
|
"remoteUser": "vscode",
|
||||||
|
|
Loading…
Reference in a new issue