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

Replace /bin/cp with cp for nix-build #730

Merged
merged 2 commits into from
Jan 5, 2022
Merged

Conversation

sbellem
Copy link
Contributor

@sbellem sbellem commented Jul 21, 2021

When using nix-build, /bin/cp cannot be found as there's nothing under
/bin except for sh.

Signed-off-by: Sylvain Bellemare sbellem@gmail.com

Unless there's a good reason to keep /bin/cp, it seems that simply using cp is preferable as suggested in https://discourse.nixos.org/t/bin-cp-cannot-be-found-when-using-nix-build/13683/2.

Copy link
Contributor

@veehaitch veehaitch left a comment

Choose a reason for hiding this comment

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

Please merge this to get one step closer to pure reproducible builds using Nix.

@veehaitch
Copy link
Contributor

@veehaitch
Copy link
Contributor

@sbellem would you mind adding this commit veehaitch@f3c0892? Patching the getconf FHS path is also required to build the PSW.

@veehaitch
Copy link
Contributor

@lzha101 anything we can do to get this merged?

sbellem and others added 2 commits January 4, 2022 01:50
When using nix-build, /bin/cp cannot be found as there's nothing under
/bin except for sh.

Signed-off-by: Sylvain Bellemare <sbellem@gmail.com>
Signed-off-by: Vincent Haupert <mail@vincent-haupert.de>
@sbellem
Copy link
Contributor Author

sbellem commented Jan 4, 2022

@veehaitch:

Added commit veehaitch@f3c0892

@lzha101
Copy link
Contributor

lzha101 commented Jan 5, 2022

When using nix-build, /bin/cp cannot be found as there's nothing under
/bin except for sh.

Note that we are using Nix instead of NixOS for reproducible build of several components only. So SGX code doesn't have such problem.

@lzha101 lzha101 merged commit 2ee53db into intel:master Jan 5, 2022
@veehaitch
Copy link
Contributor

Thanks for merging this PR! 🙏🏻

Note that we are using Nix instead of NixOS for reproducible build of several components only. So SGX code doesn't have such problem.

Please note that this change helps you as much as anybody else using Nix to build your software and is not related to NixOS. In fact, it is necessary to have proper reproducibility. You just didn't run into problems with regard to absolute paths to binaries as you have been using Nix on an Ubuntu host with sandboxing disabled:

&& echo 'sandbox = false' > /etc/nix/nix.conf \

From the sandbox section of nix.conf(5):

If set to true, builds will be performed in a sandboxed environment, i.e., they’re isolated from the normal file system hierarchy and will only see their dependencies in the Nix store, the temporary build directory, private versions of /proc, /dev, /dev/shm and /dev/pts (on Linux), and the paths configured with the sandbox-paths option. This is useful to prevent undeclared dependencies on files in directories such as /usr/bin. In addition, on Linux, builds run in private PID, mount, network, IPC and UTS namespaces to isolate them from other processes in the system (except that fixed-output derivations do not run in private network namespace to ensure they can access the network).

Sandboxing is enabled by default. Disabling it means your Nix builds are not hermetic and might contain additional impurities. Against this background, avoiding absolute FHS paths is even a prerequisite for having proper reproducible builds using Nix.

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.

3 participants