Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bud command does not work due to error "This script must be run either from the flake's devshell" #382

Closed
pio2398 opened this issue Oct 2, 2021 · 8 comments · Fixed by #386
Labels
bug Something isn't working

Comments

@pio2398
Copy link

pio2398 commented Oct 2, 2021

Since commit 1df67a3

Expected Behavior

Current Behavior

✘ piotrek@Pc1Nix  ~/Projects/nixos  ➦ 1df67a3  git checkout 1df67a3
Found existing alias for "git checkout". You should use: "gco"
HEAD is now at 1df67a3 update digga lock
piotrek@Pc1Nix  ~/Projects/nixos  ➦ 1df67a3  bud
This script must be run either from the flake's devshell or its root path must be specified
✘ piotrek@Pc1Nix  ~/Projects/nixos  ➦ 1df67a3  git checkout f10a8fd
Found existing alias for "git checkout". You should use: "gco"
Previous HEAD position was 1df67a3 update digga lock
HEAD is now at f10a8fd chore: update nvfecher
direnv: loading ~/Projects/nixos/.envrc
direnv: using flake
direnv: ([/nix/store/l6flm08wv6cgy0n6myzc8g3k68wiqayf-direnv-2.28.0/bin/direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
direnv: renewed cache
🔨 Welcome to nixos

[devos]

agenix
bud - Your highly customizable system ctl
cachix - Command line client for Nix binary cache hosting https://cachix.org
deploy-rs - A Simple multi-profile Nix-flake deploy tool
nix
nvfetcher - Generate nix sources expr for the latest version of packages

[docs]

mdbook - Create books from MarkDown

[general commands]

menu - prints this menu

[linter]

editorconfig-checker - A tool to verify that your files are in harmony with your .editorconfig
nixpkgs-fmt - Nix code formatter for nixpkgs

direnv: export +DEVSHELL_DIR +DEVSHELL_ROOT +IN_NIX_SHELL +NIXPKGS_PATH +NIX_SSL_CERT_FILE ~NIX_PROFILES ~PATH ~XDG_DATA_DIRS
piotrek@Pc1Nix  ~/Projects/nixos  ➦ f10a8fd  bud

Usage: bud COMMAND [ARGS]

Commands:
build HOST BUILD Build a variant of your configuration from system.build

get [DEST] Copy the desired template to DEST

home [switch] (user@fqdn | USER HOST | USER) Home-manager config of USER from HOST or host-less portable USER for current architecture

install HOST [ARGS] Shortcut for nixos-install

rebuild HOST (switch|boot|test) Shortcut for nixos-rebuild

repl [FLAKE] Enter a repl with the flake's outputs

ssh-show HOST USER | USER@HOSTNAME Show target host's SSH ed25519 key

up Generate /home/piotrek/Projects/nixos/hosts/Pc1Nix/default.nix

update [INPUT] Update and commit /home/piotrek/Projects/nixos/flake.lock file or specific input

vm HOST Generate & run a one-shot vm for HOST

piotrek@Pc1Nix  ~/Projects/nixos  ➦ f10a8fd

Possible Solution

Steps to Reproduce

Context

Your Environment

@pio2398 pio2398 added the bug Something isn't working label Oct 2, 2021
@pio2398 pio2398 changed the title Bud command does not work due to error This script must be run either from the flake's devshell or its root path must be specified from commit 1df67a3f2ac5e109fef54dc0b761aca0d64c2c5c Bud command does not work due to error This script must be run either from the flake's devshell Oct 2, 2021
@pio2398 pio2398 changed the title Bud command does not work due to error This script must be run either from the flake's devshell Bud command does not work due to error "This script must be run either from the flake's devshell" Oct 2, 2021
@ghost
Copy link

ghost commented Oct 2, 2021

As a quick workaround you can do export DEVSHELL_ROOT=/path/to/flake

@codygman
Copy link
Contributor

codygman commented Oct 2, 2021

Yep, I just used: ❯ DEVSHELL_ROOT=$(pwd) bud rebuild tower switch

I think CI for devos needs a Can run bud script test.

@Pacman99
Copy link
Member

Pacman99 commented Oct 3, 2021

@GTrunSec Do you have any thoughts on this? It seems like you have done research on the recent devshell updates.

@GTrunSec
Copy link
Contributor

GTrunSec commented Oct 4, 2021

thanks for your reporting. @Pacman99 divnix/bud#24 please review it.

@jmc-figueira
Copy link

Yep, I just used: ❯ DEVSHELL_ROOT=$(pwd) bud rebuild tower switch

I think CI for devos needs a Can run bud script test.

I would just like to add that this workaround (perhaps predictably), doesn't work if the command requires running as root, such as the case with bud up (for btrfs subvolume show to work):

at 13:20:09 ✖1 ❯ DEVSHELL_ROOT=$(pwd) sudo bud up
This script must be run either from the flake's devshell or its root path must be specified

@GTrunSec
Copy link
Contributor

GTrunSec commented Oct 5, 2021

Yep, I just used: ❯ DEVSHELL_ROOT=$(pwd) bud rebuild tower switch
I think CI for devos needs a Can run bud script test.

I would just like to add that this workaround (perhaps predictably), doesn't work if the command requires running as root, such as the case with bud up (for btrfs subvolume show to work):

at 13:20:09 ✖1 ❯ DEVSHELL_ROOT=$(pwd) sudo bud up
This script must be run either from the flake's devshell or its root path must be specified

How about:

nix flake lock --update-input bud   
sudo -E bud up

@jmc-figueira
Copy link

That now results in the btrfs command failing, same as not using sudo at all.

at 12:55:37 ❯ sudo -E bud up
Failed to execute: btrfs subvol show /persist

@luxus
Copy link
Contributor

luxus commented May 14, 2022

@jmc-figueira have you fixed it somehow?
i have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants