You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[nix-installer] auto-install nix if we detect it's missing (#343)
## Summary
This change makes devbox attempt to install nix if it is missing and the command the user ran requires it. It shows yellow text alerting the user before it starts (otherwise it is really jarring). One improvement could be to combine the sudo warning into the yellow text.
If the installation fails we show the error that caused it. If the installation succeeds we show a user warning which is yellow text. This warning is an error which causes the CLI execution to end. We need this because nix requires restarting the terminal. This is another area where having a pkg installer may be an improvement.
cc: @Lagoja
## How was it tested?
Ran `devbox add mariadb` without having nix installed. Got:
<img width="471" alt="image" src="https://user-images.githubusercontent.com/544948/205784786-c76d90f2-9846-418e-93db-d2605eddfc32.png">
Pressing enter started the installation.
After installation we show:
<img width="741" alt="image" src="https://user-images.githubusercontent.com/544948/205785207-da291c1b-2c5f-4004-9bb5-a3a3e053e94c.png">
Co-authored-by: Greg Curtis <[email protected]>
Copy file name to clipboardExpand all lines: boxcli/run.go
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ import (
11
11
"github.com/pkg/errors"
12
12
"github.com/spf13/cobra"
13
13
"go.jetpack.io/devbox"
14
+
"go.jetpack.io/devbox/nix"
14
15
"golang.org/x/exp/slices"
15
16
)
16
17
@@ -25,7 +26,7 @@ func RunCmd() *cobra.Command {
25
26
Short: "Starts a new devbox shell and runs the target script",
26
27
Long: "Starts a new interactive shell and runs your target script in it. The shell will exit once your target script is completed or when it is terminated via CTRL-C. Scripts can be defined in your `devbox.json`",
returnerrors.New("could not find nix in your PATH\nInstall nix by following the instructions at https://nixos.org/download.html and make sure you've set up your PATH correctly")
0 commit comments