23 lines
763 B
Bash
Executable file
23 lines
763 B
Bash
Executable file
set -o errexit
|
|
|
|
export NIXPKGS_ALLOW_UNFREE=1
|
|
|
|
# get script dir
|
|
#
|
|
SOURCE=${BASH_SOURCE[0]}
|
|
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
|
SOURCE=$(readlink "$SOURCE")
|
|
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
done
|
|
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
|
|
|
|
pushd "$DIR" || exit 1
|
|
|
|
RESULT=$(nix-build -E 'import ((import ./npins).nixpkgs + "/nixos")' -A config.system.build.vm -I nixos-config=configuration.nix --no-out-link $@) || popd || exit 1
|
|
|
|
popd || exit 1
|
|
|
|
echo -e "Running: $RESULT\n"
|
|
|
|
"$RESULT/bin/run-nixos-vm"
|