Skip to content

Running devbox run test with a single-user installation doesn't work #2342

Open
@DerArkeN

Description

@DerArkeN

What happened?

When running devbox run test I got the following error for all testscripts:

    --- FAIL: TestScripts/add_outputs.test (1.06s)
        testscript.go:558: # Testscript to add packages with non-default outputs (1.030s)
            # Add prometheus with default outputs. It will not have promtool. (0.026s)
            > exec devbox add prometheus
            [stderr]

            Error: Unable to find nix startup file. If /nix directory exists it's possible the installation did not complete successfully. Follow instructions at https://nixos.org/download.html for manual install.

            [exit status 1]
            FAIL: add/add_outputs.test.txt:6: unexpected command failure

When adding a print to internal/nix/source.go in the func SourceNixEnv() loop I found out that since a go test is in it's own environment the home variable refers to something like: /tmp/TestScriptspath.test632767911/001/
This means the test looks for nix installations in following directories:

            /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
            /tmp/TestScriptspath.test632767911/001/.nix-profile/etc/profile.d/nix.sh
            /tmp/TestScriptspath.test632767911/001/.local/state/nix/profile/etc/profile.d/nix.sh
            /tmp/TestScriptspath.test632767911/001/.local/state/nix/profiles/profile/etc/profile.d/nix.sh

Since I am running a single-user installation I don't have /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh which results in the tests failing.

Running devbox run docker-testscripts results in an endless lines of errors as well.

Steps to reproduce

  1. Install devbox and nix with a single-user installation
  2. Clone this repository
  3. Start a devbox shell
  4. Run devbox run test

Command

No response

devbox.json

No response

Devbox version

0.13.3

Nix version

No response

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions