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

WIP: use proot and xz #69

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

WIP: use proot and xz #69

wants to merge 1 commit into from

Conversation

DavHau
Copy link

@DavHau DavHau commented Nov 16, 2020

(currently based against v0.4.0 since master is broken)

I switched out nix-user-chroot with proot, since proot doesn't require userspaces and therefore should work on all distros.
This should solve #50

I also swapped out bzip2 with xz -1 (lzma) which uses multiple cores to compress and also should be significantly faster to extract according to online benchmarks (see for example: https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/)

Alternatively we could use gzip/pigz to compress, which would be even faster to decompress, but the file size will be much larger.
I found xz -1 to be a good middle ground.

The current problem is that some dependencies of proot seem to be missing. If I execute the bundled binary inside an alpine docker container it raises the following error:
./nix/store/mmcsv1szs7w0mjh430jrvj2nrhz6rwr8-proot-20190510/bin/proot: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: Error 20
@matthewbauer Any idea how to solve that?

Also I don't quite understand what the PATH_ENV variable previously set in makeFlags of nix-user-chroot was needed for.
Maybe that could be the missing part.

Tested via:

let
  pkgs = import <unstable> {};
  nixBundle = import ./nix-bundle { nixpkgs = pkgs; };
in

nixBundle.nix-bootstrap-path {
  target = pkgs.hello;
  run = "/bin/hello"; 
}

@takeda
Copy link
Contributor

takeda commented Apr 14, 2021

@DavHau any idea if this will be incorporated into the project? nix-bundle looks very exciting, but it still has these issues :(

@DavHau
Copy link
Author

DavHau commented Apr 14, 2021

I was originally working on this PR because I wanted to use this bundler for https://github.com/davhau/nix-portable
But eventually I ended up doing my own bundling from scratch.

Anyways, I think the fix here is simple. Proot needs to be built static. But then again, the nixpkgs static proot package is broken. We could just pull a static proot binary from proot's gitlab like I did it with nix-portable.

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