jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.75k stars 203 forks source link

devbox shell --pure fails with bin/bash when running as non-root with nix-portable #2222

Open Cauch-BS opened 3 months ago

Cauch-BS commented 3 months ago

What happened?

devbox shell executed without any issues. However, when running devbox shell --pure I got the following error message: Error: fork/exec /nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash: no such file or directory

I added the bash@latest flag to packages to see if it would resolve the issue. However, it did not work.

Searching for a similar issue I found this but this was not very helpful.

Additional Context My Shell: bash 5.1.16(1)-release My Operating System: Ubuntu 22.04 LTS

Steps to reproduce

I followed the following steps:

  1. Changed the install script to support non-root install: See this issue , and my script below
  2. Downloaded nix-portable and bound the nix-binary via symbolic link, as discussed in nix-portable and this issue

As this issue was closed and resolved as of the release v0.10.0, I assumed that I could continue with non-root install.

  1. Next, I executed devbox init and devbox shell to check if devbox was working. These executed without issue.
  2. Next, I executed devbox shell --pure which is when I got the error.

Installation Script

#!/bin/bash

# ====================
# format.sh
# ====================

readonly BOLD="$(tput bold 2>/dev/null || echo '')"
readonly GREY="$(tput setaf 8 2>/dev/null || echo '')"
readonly UNDERLINE="$(tput smul 2>/dev/null || echo '')"
readonly RED="$(tput setaf 1 2>/dev/null || echo '')"
readonly GREEN="$(tput setaf 2 2>/dev/null || echo '')"
readonly YELLOW="$(tput setaf 3 2>/dev/null || echo '')"
readonly BLUE="$(tput setaf 4 2>/dev/null || echo '')"
readonly MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
readonly CYAN="$(tput setaf 6 2>/dev/null || echo '')"
readonly NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
readonly CLEAR_LAST_MSG="\033[1F\033[0K"

title() {
        local -r text="$*"
        printf "%s\n" "${BOLD}${MAGENTA}${text}${NO_COLOR}"
}

header() {
        local -r text="$*"
        printf "%s\n" "${BOLD}${text}${NO_COLOR}"
}

plain() {
        local -r text="$*"
        printf "%s\n" "${text}"
}

info() {
        local -r text="$*"
        printf "%s\n" "${BOLD}${GREY}→${NO_COLOR} ${text}"
}

warn() {
        local -r text="$*"
        printf "%s\n" "${YELLOW}! $*${NO_COLOR}"
}

error() {
        local -r text="$*"
        printf "%s\n" "${RED}✘ ${text}${NO_COLOR}" >&2
}

success() {
        local -r text="$*"
        printf "%s\n" "${GREEN}✓${NO_COLOR} ${text}"
}

start_task() {
        local -r text="$*"
        printf "%s\n" "${BOLD}${GREY}→${NO_COLOR} ${text}..."
}

end_task() {
        local -r text="$*"
        printf "${CLEAR_LAST_MSG}%s\n" "${GREEN}✓${NO_COLOR} ${text}... [DONE]"
}

fail_task() {
        local -r text="$*"
        printf "${CLEAR_LAST_MSG}%s\n" "${RED}✘ ${text}... [FAILED]${NO_COLOR}" >&2
}

confirm() {
        if [ ${FORCE-} -ne 1 ]; then
                printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[Y/n]${NO_COLOR}"
                set +e
                read -r yn </dev/tty
                rc=$?
                set -e
                if [ $rc -ne 0 ]; then
                        error "Error reading from prompt (re-run with '-f' flag to auto select Yes if running in a script)"
                        exit 1
                fi
                if [ "$yn" != "y" ] && [ "$yn" != "Y" ] && [ "$yn" != "yes" ] && [ "$yn" != "" ]; then
                        error 'Aborting (please answer "yes" to continue)'
                        exit 1
                fi
        fi
}

delay() {
        sleep 0.3
}

# Install script
# Downloads and installs a binary from the given url.
echo "Installing ${BLUE}NixOS ❄ ${NO_COLOR} from nix portable..."
curl -L https://github.com/DavHau/nix-portable/releases/latest/download/nix-portable-$(uname -m) > $HOME/.local/bin/nix-portable
chmod +x $HOME/.local/bin/nix-portable
ln -s $HOME/.local/bin/nix-portable $HOME/.local/bin/nix-shell
ln -s $HOME/.local/bin/nix-portable $HOME/.local/bin/nix
ln -s $HOME/.local/bin/nix-portable $HOME/.local/bin/nix-env

if command -v nix &> /dev/null
then
    echo "nix ❄ has been successfully installed. Great! Version: $(nix --version)"
else
    echo "nix is not installed."
    exit 1
fi

# ========================
# Customize install script
# ========================

# This script is published at get.jetify.com/devbox so users can install via:
# curl -fsSL https://get.jetify.com/devbox | bash

readonly INSTALL_DIR="$HOME/.local/bin"
readonly BIN="devbox"
readonly DOWNLOAD_URL="https://releases.jetify.com/devbox"

readonly TITLE="Devbox 📦 by Jetify"
readonly DESCRIPTION=$(
        cat <<EOF
  Instant, easy and predictable development environments.

  This script downloads and installs the latest devbox binary.
EOF
)
readonly DOCS_URL="https://github.com/jetify-com/devbox"
readonly COMMUNITY_URL="https://discord.gg/jetify"

# ====================
# flags.sh
# ====================
FORCE="${FORCE:-0}"

parse_flags() {
        while [ "$#" -gt 0 ]; do
                case "$1" in
                -f | --force)
                        FORCE=1
                        shift 1
                        ;;
                *)
                        error "Unknown option: $1"
                        exit 1
                        ;;
                esac
        done
}

# =========
# util.sh
# =========
has() {
        command -v "$1" 1>/dev/null 2>&1
}

download() {
        local -r url="$1"
        local -r file="$2"
        local cmd=""

        if has curl; then
                cmd="curl --fail --silent --location --output $file $url"
        elif has wget; then
                cmd="wget --quiet --output-document=$file $url"
        elif has fetch; then
                cmd="fetch --quiet --output=$file $url"
        else
                error "No program to download files found. Please install one of: curl, wget, fetch"
                error "Exiting..."
                return 1
        fi

        if [[ ${3:-} == "--fail" ]]; then
                $cmd && return 0 || rc=$?
                error "Command failed (exit code $rc): ${BLUE}${cmd}${NO_COLOR}"
                exit $rc
        fi

        $cmd && return 0 || rc=$?
        return $rc
}

# ==============
# Implementation
# ==============
intro_msg() {
        title "${TITLE}"
        plain "${DESCRIPTION}"
        printf "\n"
        header "Confirm Installation Details"
        plain "  Location:     ${GREEN}${INSTALL_DIR}/${BIN}${NO_COLOR} (local install)?"
        plain "  Download URL: ${UNDERLINE}${BLUE}${DOWNLOAD_URL}${NO_COLOR}"
        printf "\n"
}

install_flow() {
        confirm "Install ${GREEN}${BIN}${NO_COLOR} to ${GREEN}${INSTALL_DIR}${NO_COLOR}?"
        printf "\n"
        header "Downloading and Installing"

        start_task "Downloading ${BIN} binary"
        local -r tmp_file=$(mktemp)
        download "${DOWNLOAD_URL}" "${tmp_file}" --fail
        delay
        end_task "Downloading ${BIN} binary"

        start_task "Installing in ${INSTALL_DIR}/${BIN} (requires sudo)"
        chmod +x "${tmp_file}"
        bash -c "mkdir -p ${INSTALL_DIR} &&
                mv ${tmp_file} ${INSTALL_DIR}/${BIN}"
        delay
        end_task "Installing in ${INSTALL_DIR}/${BIN}"
        delay

        success "${BOLD}Successfully installed ${GREEN}${BIN}${NO_COLOR}${BOLD}${NO_COLOR} 🚀"
        delay
        printf "\n"
}

next_steps_msg() {
        header "Next Steps"
        plain "  1. ${BOLD}Learn how to use ${BIN}${NO_COLOR}"
        plain "     ${GREY}Run ${CYAN}${BIN} help${GREY} or read the docs at ${UNDERLINE}${BLUE}${DOCS_URL}${NO_COLOR}"
        plain "  2. ${BOLD}Get help and give feedback${NO_COLOR}"
        plain "     ${GREY}Join our community at ${UNDERLINE}${BLUE}${COMMUNITY_URL}${NO_COLOR}"
}

main() {
        parse_flags "$@"
        intro_msg
        install_flow
        next_steps_msg
}

main "$@"

devbox.json

{
    "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
    "packages": [
      "bash@latest"
    ],
    "shell": {
      "init_hook": [
        "echo 'Welcome to devbox!' > /dev/null"
      ],
      "scripts": {
        "test": [
          "echo \"Error: no test specified\" && exit 1"
        ]
      }
    }
  }

devbox.lock:

{
  "lockfile_version": "1",
  "packages": {
    "bash@latest": {
      "last_modified": "2024-08-04T20:22:49Z",
      "resolved": "github:NixOS/nixpkgs/785feb91183a50959823ff9ba9ef673105259cd5#bash",
      "source": "devbox-search",
      "version": "5.2p26",
      "systems": {
        "aarch64-darwin": {
          "outputs": [
            {
              "name": "out",
              "path": "/nix/store/spyn2n8l9ca1pkqn20l40l424xmqwda4-bash-5.2p26",
              "default": true
            },
            {
              "name": "man",
              "path": "/nix/store/q5fi46zsk79vnyr2hyancdfnlxpg5ff4-bash-5.2p26-man",
              "default": true
            },
            {
              "name": "dev",
              "path": "/nix/store/gml2k9ggb35szfbsyzglh4xf9x619mz1-bash-5.2p26-dev"
            },
            {
              "name": "doc",
              "path": "/nix/store/f2i81dshbj71436sa8rq4pbd31k4iy2m-bash-5.2p26-doc"
            },
            {
              "name": "info",
              "path": "/nix/store/ay5j8cw3aw1x3piikijl6knrln4l15dk-bash-5.2p26-info"
            }
          ],
          "store_path": "/nix/store/spyn2n8l9ca1pkqn20l40l424xmqwda4-bash-5.2p26"
        },
        "aarch64-linux": {
          "outputs": [
            {
              "name": "out",
              "path": "/nix/store/mmhpq6dhbhs5a3nwk4qw80varw8xzrwl-bash-5.2p26",
              "default": true
            },
            {
              "name": "man",
              "path": "/nix/store/yp62aqppsd5asmkcdy4nqki7r21lr3l4-bash-5.2p26-man",
              "default": true
            },
            {
              "name": "debug",
              "path": "/nix/store/s395y9p0mf64p1lb2q2vj6ryhsidcfwc-bash-5.2p26-debug"
            },
            {
              "name": "dev",
              "path": "/nix/store/xkfnwsm1mvlwfh9lsh6akzyxicv1f2l3-bash-5.2p26-dev"
            },
            {
              "name": "doc",
              "path": "/nix/store/jzlkkr97a3h5fvckmx9sv5dsinyr5yli-bash-5.2p26-doc"
            },
            {
              "name": "info",
              "path": "/nix/store/s3sghxc44l57gian9dkg1mlk6gz16d4s-bash-5.2p26-info"
            }
          ],
          "store_path": "/nix/store/mmhpq6dhbhs5a3nwk4qw80varw8xzrwl-bash-5.2p26"
        },
        "x86_64-darwin": {
          "outputs": [
            {
              "name": "out",
              "path": "/nix/store/9vh7g0n7qm4n8ivf9i3niy2l20j8h5jn-bash-5.2p26",
              "default": true
            },
            {
              "name": "man",
              "path": "/nix/store/h4rjwxrpxj0chfbwyjgqy94byyscflcl-bash-5.2p26-man",
              "default": true
            },
            {
              "name": "dev",
              "path": "/nix/store/vcpprnw9bw5xkj9zgzm2jz43gnym39s3-bash-5.2p26-dev"
            },
            {
              "name": "doc",
              "path": "/nix/store/kl2xb4gidd1g6xllnf7knf863zdi1903-bash-5.2p26-doc"
            },
            {
              "name": "info",
              "path": "/nix/store/ddjdmg403zk4kzjdnyz7k2422jbdbv58-bash-5.2p26-info"
            }
          ],
          "store_path": "/nix/store/9vh7g0n7qm4n8ivf9i3niy2l20j8h5jn-bash-5.2p26"
        },
        "x86_64-linux": {
          "outputs": [
            {
              "name": "out",
              "path": "/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26",
              "default": true
            },
            {
              "name": "man",
              "path": "/nix/store/qlzcfdbnrdj5w58c75jjvmr3f0cn77n5-bash-5.2p26-man",
              "default": true
            },
            {
              "name": "debug",
              "path": "/nix/store/mrvwrngw0nd50lh8y8dx1hjfmhrniswj-bash-5.2p26-debug"
            },
            {
              "name": "dev",
              "path": "/nix/store/g6gxz380l31kvnxiqb8ixrfixy4g7grv-bash-5.2p26-dev"
            },
            {
              "name": "doc",
              "path": "/nix/store/is6sw9nm8021qx84jibkv6w1jgf9qsic-bash-5.2p26-doc"
            },
            {
              "name": "info",
              "path": "/nix/store/qiajqdldk3nr95g9y3jfcxxcwh17arjh-bash-5.2p26-info"
            }
          ],
          "store_path": "/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26"
        }
      }
    }
  }
}

Devbox version

0.12.0

Nix version

nix (Nix) 2.20.6

What system does this bug occur on?

Linux (x86-64)

Debug logs

time=2024-08-13T11:04:19.419+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:22 msg="finding devbox config" path=""
time=2024-08-13T11:04:19.419+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:66 msg="finding devbox config" dir=/qbio/catbase/mod-struct/xlp
time=2024-08-13T11:04:19.419+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:22 msg="finding devbox config" path=""
time=2024-08-13T11:04:19.419+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:66 msg="finding devbox config" dir=/qbio/catbase/mod-struct/xlp
time=2024-08-13T11:04:19.792+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/nix.go:337 msg="nix --version --debug output" out="nix (Nix) 2.20.6\nSystem type: x86_64-linux\nAdditional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux\nFeatures: gc, signed-caches\nSystem configuration file: /qbio/catbase/.nix-portable/conf/nix.conf\nUser configuration files: /qbio/catbase/.config/nix/nix.conf:/etc/xdg/nix/nix.conf\nStore directory: /nix/store\nState directory: /nix/var/nix\nData directory: /nix/store/j823gnvpxh1fjibycmldrspkk3pgivwp-nix-2.20.6/share\n"
time=2024-08-13T11:04:19.792+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:60 msg="nix command starting" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/qbio/catbase/.local/bin/nix
time=2024-08-13T11:04:20.192+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/nix/command.go:67 msg="nix command exited" cmd.args="nix --extra-experimental-features ca-derivations --option experimental-features 'nix-command flakes fetch-closure' eval --impure --raw --expr builtins.currentSystem" cmd.path=/qbio/catbase/.local/bin/nix cmd.pid=1042762 cmd.code=0 cmd.dur=399.691149ms
time=2024-08-13T11:04:20.193+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:22 msg="finding devbox config" path=""
time=2024-08-13T11:04:20.193+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:66 msg="finding devbox config" dir=/qbio/catbase/mod-struct/xlp
time=2024-08-13T11:04:20.195+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:678 msg="current environment PATH" path=/qbio/catbase/.local/bin:/qbio/catbase/mod-struct/xlp/.devbox/bin
time=2024-08-13T11:04:20.196+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:693 msg="nix environment PATH" path=/nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0/bin:/nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin:/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/bin:/nix/store/nvh3jgs8pqghnsfzbv28004xkigiw8gc-glibc-2.38-23-bin/bin:/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin:/nix/store/h8d2j0prdf7pnpgyrgkxrrbfwnmxbq6y-binutils-wrapper-2.40/bin:/nix/store/p58l5qmzifl20qmjs3xfpl01f0mqlza2-binutils-2.40/bin:/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26/bin:/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin:/nix/store/qyzfglbrqb5ck0dgljplin2bvc4995w7-findutils-4.9.0/bin:/nix/store/x6y2i213maj6ibcn0qzgg7graif5qcvi-diffutils-3.10/bin:/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin:/nix/store/p2r51wfg9m3ga7pp7avslpfhfa7w5y83-gnugrep-3.11/bin:/nix/store/cmn958i8qym0qvmvydl23fh3bm3fbhl7-gawk-5.2.2/bin:/nix/store/f5qy259g9b4qh0hwz22z5j5bq3m53cpv-gnutar-1.35/bin:/nix/store/kmr52zpw7wazxywqvzgpdx0vnn9prd3v-gzip-1.13/bin:/nix/store/w1mar48lwkavwy64mvj567lwaqnm2l11-bzip2-1.0.8-bin/bin:/nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1/bin:/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin:/nix/store/pinwlz7294p37d2sbkdpjildzxii42vv-patch-2.7.6/bin:/nix/store/skrzk0g88jf9rg28labqsyxv7gg357q1-xz-5.4.4-bin/bin:/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45/bin
time=2024-08-13T11:04:20.196+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:721 msg="PATH after plugins and config" path=/qbio/catbase/mod-struct/xlp/.devbox/nix/profile/default/bin:/nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0/bin:/nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin:/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/bin:/nix/store/nvh3jgs8pqghnsfzbv28004xkigiw8gc-glibc-2.38-23-bin/bin:/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin:/nix/store/h8d2j0prdf7pnpgyrgkxrrbfwnmxbq6y-binutils-wrapper-2.40/bin:/nix/store/p58l5qmzifl20qmjs3xfpl01f0mqlza2-binutils-2.40/bin:/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26/bin:/nix/store/qyzfglbrqb5ck0dgljplin2bvc4995w7-findutils-4.9.0/bin:/nix/store/x6y2i213maj6ibcn0qzgg7graif5qcvi-diffutils-3.10/bin:/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin:/nix/store/p2r51wfg9m3ga7pp7avslpfhfa7w5y83-gnugrep-3.11/bin:/nix/store/cmn958i8qym0qvmvydl23fh3bm3fbhl7-gawk-5.2.2/bin:/nix/store/f5qy259g9b4qh0hwz22z5j5bq3m53cpv-gnutar-1.35/bin:/nix/store/kmr52zpw7wazxywqvzgpdx0vnn9prd3v-gzip-1.13/bin:/nix/store/w1mar48lwkavwy64mvj567lwaqnm2l11-bzip2-1.0.8-bin/bin:/nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1/bin:/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin:/nix/store/pinwlz7294p37d2sbkdpjildzxii42vv-patch-2.7.6/bin:/nix/store/skrzk0g88jf9rg28labqsyxv7gg357q1-xz-5.4.4-bin/bin:/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45/bin
time=2024-08-13T11:04:20.196+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:739 msg="filtering out buildInput from PATH" path=/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26/bin input=/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26
time=2024-08-13T11:04:20.196+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:745 msg="PATH after filtering buildInputs" inputs="[/nix/store/i1x9sidnvhhbbha2zhgpxkhpysw6ajmr-bash-5.2p26 /nix/store/qlzcfdbnrdj5w58c75jjvmr3f0cn77n5-bash-5.2p26-man]" path=/qbio/catbase/mod-struct/xlp/.devbox/nix/profile/default/bin:/nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0/bin:/nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin:/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/bin:/nix/store/nvh3jgs8pqghnsfzbv28004xkigiw8gc-glibc-2.38-23-bin/bin:/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin:/nix/store/h8d2j0prdf7pnpgyrgkxrrbfwnmxbq6y-binutils-wrapper-2.40/bin:/nix/store/p58l5qmzifl20qmjs3xfpl01f0mqlza2-binutils-2.40/bin:/nix/store/qyzfglbrqb5ck0dgljplin2bvc4995w7-findutils-4.9.0/bin:/nix/store/x6y2i213maj6ibcn0qzgg7graif5qcvi-diffutils-3.10/bin:/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin:/nix/store/p2r51wfg9m3ga7pp7avslpfhfa7w5y83-gnugrep-3.11/bin:/nix/store/cmn958i8qym0qvmvydl23fh3bm3fbhl7-gawk-5.2.2/bin:/nix/store/f5qy259g9b4qh0hwz22z5j5bq3m53cpv-gnutar-1.35/bin:/nix/store/kmr52zpw7wazxywqvzgpdx0vnn9prd3v-gzip-1.13/bin:/nix/store/w1mar48lwkavwy64mvj567lwaqnm2l11-bzip2-1.0.8-bin/bin:/nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1/bin:/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin:/nix/store/pinwlz7294p37d2sbkdpjildzxii42vv-patch-2.7.6/bin:/nix/store/skrzk0g88jf9rg28labqsyxv7gg357q1-xz-5.4.4-bin/bin:/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45/bin
time=2024-08-13T11:04:20.215+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:764 msg="new path stack is" path_stack=DEVBOX_NIX_ENV_PATH_65e406cfc4789d9c15d20294509a3fa0e3e40b5d44eb8501d89033abb2a759f9:DEVBOX_INIT_PATH
time=2024-08-13T11:04:20.215+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/devbox.go:766 msg="computed environment PATH" path=/qbio/catbase/mod-struct/xlp/.devbox/nix/profile/default/bin:/nix/store/znqwpxy9jlxcgi2ms2hga0ch87bbbr9g-patchelf-0.15.0/bin:/nix/store/zlzz2z48s7ry0hkl55xiqp5a73b4mzrg-gcc-wrapper-12.3.0/bin:/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/bin:/nix/store/nvh3jgs8pqghnsfzbv28004xkigiw8gc-glibc-2.38-23-bin/bin:/nix/store/vwkvhj69z4qqgmpa2lwm97kabf12p26r-coreutils-9.3/bin:/nix/store/h8d2j0prdf7pnpgyrgkxrrbfwnmxbq6y-binutils-wrapper-2.40/bin:/nix/store/p58l5qmzifl20qmjs3xfpl01f0mqlza2-binutils-2.40/bin:/nix/store/qyzfglbrqb5ck0dgljplin2bvc4995w7-findutils-4.9.0/bin:/nix/store/x6y2i213maj6ibcn0qzgg7graif5qcvi-diffutils-3.10/bin:/nix/store/g5p3ky90xa05ggg5szyb0pbbl2vp7n03-gnused-4.9/bin:/nix/store/p2r51wfg9m3ga7pp7avslpfhfa7w5y83-gnugrep-3.11/bin:/nix/store/cmn958i8qym0qvmvydl23fh3bm3fbhl7-gawk-5.2.2/bin:/nix/store/f5qy259g9b4qh0hwz22z5j5bq3m53cpv-gnutar-1.35/bin:/nix/store/kmr52zpw7wazxywqvzgpdx0vnn9prd3v-gzip-1.13/bin:/nix/store/w1mar48lwkavwy64mvj567lwaqnm2l11-bzip2-1.0.8-bin/bin:/nix/store/9dh2csn531by6b1vr9jv85v4k17xwkid-gnumake-4.4.1/bin:/nix/store/lf0wpjrj8yx4gsmw2s3xfl58ixmqk8qa-bash-5.2-p15/bin:/nix/store/pinwlz7294p37d2sbkdpjildzxii42vv-patch-2.7.6/bin:/nix/store/skrzk0g88jf9rg28labqsyxv7gg357q1-xz-5.4.4-bin/bin:/nix/store/h5pshzq92r2xcv6w1p10cmkar4nyv0xp-file-5.45/bin:/qbio/catbase/mod-struct/xlp/.devbox/virtenv/runx/bin:/qbio/catbase/.local/bin:/qbio/catbase/mod-struct/xlp/.devbox/bin
Starting a devbox shell...
time=2024-08-13T11:04:21.575+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/shell.go:86 msg="detected user shell" shell=/nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash initrc=/qbio/catbase/.bashrc
time=2024-08-13T11:04:21.576+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/shell.go:346 msg="wrote devbox shellrc" path=/tmp/devbox2683753145/.bashrc
time=2024-08-13T11:04:21.576+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/shell.go:247 msg="Executing shell %s with args: %v" /nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash="[/nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash --rcfile /tmp/devbox2683753145/.bashrc]"
Error: fork/exec /nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash: no such file or directory

time=2024-08-13T11:04:21.577+09:00 level=ERROR source=go.jetpack.io/devbox/internal/boxcli/midcobra/debug.go:70 msg="command error" execid=5b2e3e4b2807486890b89dff1a99e916 stack="fork/exec /nix/store/5q96kfjc8bxwv89fw0fqczwr6083ny8n-bash-interactive-5.2-p15/bin/bash: no such file or directory\ngo.jetpack.io/devbox/internal/devbox.(*DevboxShell).Run\n\tgo.jetpack.io/devbox/internal/devbox/shell.go:261\ngo.jetpack.io/devbox/internal/devbox.(*Devbox).Shell\n\tgo.jetpack.io/devbox/internal/devbox/devbox.go:229\ngo.jetpack.io/devbox/internal/boxcli.runShellCmd\n\tgo.jetpack.io/devbox/internal/boxcli/shell.go:94\ngo.jetpack.io/devbox/internal/boxcli.shellCmd.func1\n\tgo.jetpack.io/devbox/internal/boxcli/shell.go:43\ngithub.com/spf13/cobra.(*Command).execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:983\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\tgithub.com/spf13/cobra@v1.8.0/command.go:1039\ngo.jetpack.io/devbox/internal/boxcli/midcobra.(*midcobraExecutable).Execute\n\tgo.jetpack.io/devbox/internal/boxcli/midcobra/midcobra.go:61\ngo.jetpack.io/devbox/internal/boxcli.Execute\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:115\ngo.jetpack.io/devbox/internal/boxcli.Main\n\tgo.jetpack.io/devbox/internal/boxcli/root.go:138\nmain.main\n\t./main.go:11\nruntime.main\n\truntime/proc.go:271\nruntime.goexit\n\truntime/asm_amd64.s:1695"
time=2024-08-13T11:04:21.577+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:22 msg="finding devbox config" path=""
time=2024-08-13T11:04:21.577+09:00 level=DEBUG source=go.jetpack.io/devbox/internal/devbox/dir.go:66 msg="finding devbox config" dir=/qbio/catbase/mod-struct/xlp
Cauch-BS commented 3 months ago

Much like before, it seems devbox shell --pure fails because it assumes that the store PATH is under /nix/store. (See this issue)

Cauch-BS commented 3 months ago

As it my relevant, I also share my .bashrc files

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

export CUDA_DEVICE_ORDER=PCI_BUS_ID

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

#>>> cargo initialize >>>
export PATH="$HOME/.cargo/bin:$PATH"

#>>>QOL Improvements >>>
#setup eza
alias ls="eza --color=always --long --git --icons=always\
          --no-filesize --no-time --no-user --no-permissions\
          --sort=extension"
#some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias lde='ls --tree --level=2'
#setup starship
eval "$(starship init bash)"
#setup neovim
export PATH="$HOME/.local/share/bob/nvim-bin:$PATH"
alias vim="nvim"
# Define the `link` function
link() {
    if [ $# -eq 0 ] || [ $# -gt 2 ]; then
        echo "Usage: link <source_file> [target_directory]"
        return 1
    fi

    source_file="$1"
    if [ $# -eq 1 ]; then
        target_dir="."
        echo "Target directory not specified. Using current directory."
    else
        target_dir="$2"
    fi

    target_file="${target_dir}/$(basename "$source_file")"

    ln -s "$source_file" "$target_file"
    echo "Created symbolic link: $target_file -> $source_file"
}
#setup fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
#setup zoxide
eval "$(zoxide init bash)"
alias cd='z'

# Mamba initialization
if [ -f "/home/catbase/.local/bin/micromamba" ] && [ -d "/home/catbase/micromamba" ]; then
    # >>> mamba initialize >>>
    # !! Contents within this block are managed by 'mamba init' !!
    export MAMBA_EXE='/home/catbase/.local/bin/micromamba';
    export MAMBA_ROOT_PREFIX='/home/catbase/micromamba';
    __mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__mamba_setup"
    else
        alias micromamba="$MAMBA_EXE"  # Fallback on help from mamba activate
    fi
    unset __mamba_setup
    # <<< mamba initialize <<<
else
    echo "Mamba files not found. Skipping mamba initialization."
fi

# Conda initialization
if [ -d "$CONDA_PATH" ] && [ -f "$CONDA_PATH/bin/conda" ]; then
    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    __conda_setup="$("$CONDA_PATH/bin/conda" 'shell.bash' 'hook' 2> /dev/null)"
    if [ $? -eq 0 ]; then
        eval "$__conda_setup"
    else
        if [ -f "$CONDA_PATH/etc/profile.d/conda.sh" ]; then
            . "$CONDA_PATH/etc/profile.d/conda.sh"
        else
            export PATH="$CONDA_PATH/bin:$PATH"
        fi
    fi
    unset __conda_setup
    # <<< conda initialize <<<
else
    echo "Conda files not found. Skipping conda initialization."
fi

alias mamba='micromamba'