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

Permit installation of dev/test dependencies via Nix #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

charles-dyfis-net
Copy link
Contributor

Lets folks on NixOS (or other Linux distros with Nix installed on top) run ./scripts/test by first running nix-shell or nix-develop to enter an environment with a Go compiler, buildkit, rootlesskit, and runc in their PATH.

@@ -74,7 +74,7 @@ func SpawnBuildkitd(req Request, opts *BuildkitdOpts) (*Buildkitd, error) {
if os.Getuid() == 0 {
cmd = exec.Command("buildkitd", buildkitdFlags...)
} else {
cmd = exec.Command("rootlesskit", append([]string{"buildkitd"}, buildkitdFlags...)...)
cmd = exec.Command("rootlesskit", append([]string{"buildkitd", "--rootless"}, buildkitdFlags...)...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one related or is it a bug left from before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly NixOS-specific, and certainly reasonable to separate out into a different PR to be individually evaluated. While debugging, it came up that buildkit (or at least, the version shipped in NixOS 21.11) has a --rootless which is documented to enable configuration changes for better compatibility with rootlesskit -- but that said, I didn't go back after getting other issues ironed out to confirm that we were unable to run tests without it.

I'll do that now and follow up with findings.

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give some info about this line? Thx.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. NixOS doesn't have a /bin/bash; the only executables with hardcoded locations are /bin/sh and /usr/bin/env; everything else comes from a generated PATH with pointers into /nix/store/<hash>-<application>-<version>/bin (allowing NixOS to have different versions of the same application, or differently-compiled versions of the same application version, simultaneously installed; similarly, dynamic library linkage all uses explicit rpaths with a hash component, so applications only link the specific library versions they were compiled and tested against, even if some newer or differently-patched version of the library is installed for a different application's use).

Using #!/usr/bin/env bash causes a PATH lookup to be used to find the shell interpreter.

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

Successfully merging this pull request may close these issues.

None yet

2 participants