Skip to content

[Bug] By default, nix-shell -p $package fails, with a (difficult-to-comprehend) trace, when flakes are enabled. #499

@RokeJulianLockhart

Description

@RokeJulianLockhart

I am attempting to reproduce PowerShell/PowerShell/issues/16746#issuecomment-1076995838. However, nix-shell -p powershell fails. discussions/498 depicts a workaround. However, it's not ideal.

An Example

Welcome to Nix-on-Droid!
If nothing works, open an issue at https://github.com/nix-community/nix-on-droid/issues or try the rescue shell.
Setting default user profile...
Sourcing Nix environment...

Nix-on-Droid can be set up with channels or with flakes (still experimental).
Do you want to set it up with flakes? (y/N) y
Setting up Nix-on-Droid with flakes...
Installing flake from default template...
wrote: /data/data/com.termux.nix/files/home/.config/nix-on-droid/flake.nix
wrote: /data/data/com.termux.nix/files/home/.config/nix-on-droid/nix-on-droid.nix
Overriding system value in the flake...
Installing first Nix-on-Droid generation...
Building activation package...
warning: creating lock file '/data/data/com.termux.nix/files/home/.config/nix-on-droid/flake.lock'
Executing activation script...
Activating linkBinSh
Activating linkUsrBinEnv
Activating installLogin
Activating installLoginInner
Activating installPackages
installing 'nix-on-droid-path'
building '/nix/store/b900196ax35hjf6xbjgsylx81rxdz9zx-user-environment.drv'...
Activating installProotStatic
Activating setUpEtc
Removing obsolete symlink '/etc/UNINTIALISED'...
Activating unlinkColors
Activating unlinkFont
Activating linkProfile

Congratulations! Now you have Nix installed with some default packages like bashInteractive, coreutils, cacert and, most importantly, Nix-on-Droid itself to manage local configuration, see
  nix-on-droid help
or the flake
  ~/.config/nix-on-droid/

You can go for the bare Nix-on-Droid setup or you can configure your phone via home-manager. See other templates in github:nix-community/nix-on-droid/release-24.05.

bash-5.2$ nix-shell -p powershell
warning: Nix search path entry '/data/data/com.termux.nix/files/home/.nix-defexpr/channels/nixpkgs/' does not exist, ignoring
error:
       … <borked>

         at «none»:0: (source not available)while calling the 'import' builtin

         at «string»:1:18:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (powershell) ]; } ""
             |                  ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
bash-5.2$ nix profile install nixpkgs#powershell
bash-5.2$

I do not know what --show-trace should be appended to.

My Environment

  • The Application

    versionName=0.118.0_v0.3.7_nix
    versionCode=188037
  • The OS

    [ro.build.version.release]: [15]
    [ro.build.display.id]: [FP5.VT2K.C.076.20251222]
  • The Hardware

    [ro.product.brand]: [Fairphone]
    [ro.build.product]: [FP5]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions