23 lines
470 B
Bash
Executable File
23 lines
470 B
Bash
Executable File
#!/bin/bash
|
|
|
|
prepend_host() {
|
|
local path="$1"
|
|
if [[ "${path:0:1}" == "/" ]]; then
|
|
echo "/host$path"
|
|
else
|
|
echo "$path"
|
|
fi
|
|
}
|
|
|
|
# Process each argument and prepend /host to paths starting with /
|
|
for arg in "$@"; do
|
|
if [[ "$arg" =~ ^/ ]]; then
|
|
ARGUMENTS+=" $(prepend_host "$arg")"
|
|
else
|
|
ARGUMENTS+=" $arg"
|
|
fi
|
|
done
|
|
|
|
# Run Docker container with modified arguments
|
|
docker run --rm -it -v /:/host "nixos/nix" $ARGUMENTS
|