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

Go toolchain binaries not symlinked in /bin #83

Open
mkmik opened this issue Feb 13, 2020 · 1 comment
Open

Go toolchain binaries not symlinked in /bin #83

mkmik opened this issue Feb 13, 2020 · 1 comment
Labels
bug Something isn't working needs-fhs Issues blocked by issue #58

Comments

@mkmik
Copy link

mkmik commented Feb 13, 2020

I'm not familiar with Nix nor nixery so I'm likely doing something wrong. That said, I noticed an inconsistent behaviour while trying nixery out:

I tried to run the nixery.dev/shell/go image and I noticed that the go and gofmt binaries were not in the path (although they were in the /nix/store/...)

I noticed that other packages get installed and symlinked from /bin (I tried with a few packages like findutils and kubeseal and they indeed become accessible via a symlink from /bin).

Here is how to reproduce with a small/minimal example:

has symlink:

$ docker run -ti nixery.dev/kubeseal/bash/coreutils sh
sh-4.4# ls -l /bin/kubeseal
lrwxrwxrwx 1 0 0 71 Jan  1  1970 /bin/kubeseal -> /nix/store/dz3cf474s8pxw530n322r5hxmlpg41a2-kubeseal-0.9.6/bin/kubeseal
sh-4.4# exit

doesn't have the symlink:

$ docker run -ti nixery.dev/go/bash/coreutils sh
sh-4.4# ls -l /bin/go
ls: cannot access '/bin/go': No such file or directory
sh-4.4# ls -l /nix/store/*-go*/bin/go
-r-xr-xr-x 1 0 0 15112249 Jan  1  1970 /nix/store/s84r3m5162gy1glc6kb0sfsadw8792lq-go-1.13.5/bin/go

I'd expect the go package to be accessible from /bin/go.

Interestingly, when using the go package alone, it seems in the PATH (at least docker can run it as a command):

$ docker run -ti nixery.dev/go go
Go is a tool for managing Go source code.
...

while when I add any other package to it, it cannot be run:

docker run -ti nixery.dev/go/coreutils go
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"go\": executable file not found in $PATH": unknown
@tazjin tazjin added the bug Something isn't working label Feb 14, 2020
@tazjin
Copy link
Owner

tazjin commented Feb 14, 2020

Hey! Thanks for flagging this. I think I see what's going on:

tazjin@vauxhall ~> nix-build -E '(import <nixpkgs> {}).go'; and ls -lh result/
/nix/store/h0wih1nab037j9biy39laagl5dwlgp29-go-1.13.6
total 8.0K
lrwxrwxrwx 1 tazjin primarygroup   12 Jan  1  1970 bin -> share/go/bin/
dr-xr-xr-x 2 tazjin primarygroup 4.0K Jan  1  1970 nix-support/
dr-xr-xr-x 3 tazjin primarygroup 4.0K Jan  1  1970 share/

The Nix derivation for Go places the actual binaries in share/go/bin for some reason and symlinks them from the package's root, this symlink will be dropped by the mechanism that Nixery uses to construct the file-system root (nixpkgs.symlinkJoin).

To solve this generically (which we'll need to, as having package-specific overrides isn't really sustainable) we either need a symlinkJoin that "merges" symlinks or defer to #58. I'll have a think about it!

@tazjin tazjin added the needs-fhs Issues blocked by issue #58 label Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-fhs Issues blocked by issue #58
Projects
None yet
Development

No branches or pull requests

2 participants