diff --git a/launch_es.sh b/launch_es.sh index 32a9ef0..98ab82b 100755 --- a/launch_es.sh +++ b/launch_es.sh @@ -1,5 +1,21 @@ export NIXPKGS_ALLOW_UNFREE=1 -RESULT=$(nix-build -E 'import ((import ./npins).nixpkgs + "/nixos")' -A config.retronix.emulationstation.cli -I nixos-config=configuration.nix --no-out-link $@) +# 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.retronix.emulationstation.cli -I nixos-config=configuration.nix --no-out-link $@) || popd || exit 1 + +popd || exit 1 + +echo -e "Running: $RESULT\n" $RESULT