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

nix-shell: no longer parses a .drv file #39319

Open
timbertson opened this issue Apr 22, 2018 · 3 comments
Open

nix-shell: no longer parses a .drv file #39319

timbertson opened this issue Apr 22, 2018 · 3 comments

Comments

@timbertson
Copy link
Contributor

Issue description

I have a setup where my various workspace shells are added as GC roots, so they don't get cleaned up. This is a two-step process:

  • build the .drv using nix-instantiate on shell.nix
  • run nix-shell on the .drv

I can workaround this by running nix-shell on the shell.nix file instead, and presumably nothing will be different or rebuilt compared to the .drv, but this used to work so I'm reporting it as a regression:

Steps to reproduce

$ cat shell.nix
{ pkgs ? import <nixpkgs> {}}:
with pkgs;
stdenv.mkDerivation {
  name = "test-0.1";
  buildInputs = [ bash ];
}

$ nix-instantiate shell.nix --show-trace --quiet --indirect --add-root "$PWD/"shell.drv
/home/tim/dev/scratch/shell.drv

$ nix-shell shell.nix --run 'echo 1'
1

$ nix-shell shell.drv --run 'echo 1'
error: syntax error, unexpected ',', expecting ')', at /nix/store/m185dyc2dh7bdbz08hcqn3825hp7nsqy-test-0.1.drv:1:15

relevant .drv contents:

$ ls -l shell.drv
lrwxrwxrwx. 1 tim tim 56 Apr 22 12:18 shell.drv -> /nix/store/m185dyc2dh7bdbz08hcqn3825hp7nsqy-test-0.1.drv

$ cat shell.drv 
Derive([("out","/nix/store/bpysdn9xynmc51cd7faydd66r64dr7bq-test-0.1","","")],[("/nix/store/6bwh53x6086nwm5pv1c87jbj9jc5p06g-stdenv-linux.drv",["out"]),("/nix/store/qhvnja1jzfrir86h3w887nrw3fplxmn9-bash-4.4-p19.drv",["dev","out"])],["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],"x86_64-linux","/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash",["-e","/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],[("buildInputs","/nix/store/fcvnn0gkdlg60z49rbp60dchvnrlg4fr-bash-4.4-p19-dev"),("builder","/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"),("configureFlags",""),("depsBuildBuild",""),("depsBuildBuildPropagated",""),("depsBuildTarget",""),("depsBuildTargetPropagated",""),("depsHostBuild",""),("depsHostBuildPropagated",""),("depsTargetTarget",""),("depsTargetTargetPropagated",""),("name","test-0.1"),("nativeBuildInputs",""),("out","/nix/store/bpysdn9xynmc51cd7faydd66r64dr7bq-test-0.1"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("stdenv","/nix/store/3y0wxpkxzs6yz73iw35d17qr1wp4p2i4-stdenv-linux"),("system","x86_64-linux")])

Technical details

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.15.17-300.fc27.x86_64, Fedora, 27 (Workstation Edition)`
 - multi-user?: `no`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0`
 - channels(tim): `"nixpkgs-18.09pre137305.d91caac6c3e"`
 - nixpkgs: `/home/tim/.nix-defexpr/channels/nixpkgs`
@glaebhoerl
Copy link
Contributor

This looks like the same as NixOS/nix#1958 (which is not actually macOS-specific).

From that discussion, the actual issue is:

nix-shell interprets its argument as a derivation only when it is a store path

@stale
Copy link

stale bot commented Jun 4, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
@gador
Copy link
Contributor

gador commented Apr 24, 2022

I am having the same issue

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants