Vladimír Čunát <[email protected]> wrote:

> For some previous discussion you can see
> https://github.com/NixOS/nix/issues/16
>
> So far there's IMHO been no really good solution proposal. And
> probably none is currently providing binaries to use.

The path-rewriting proposal is a very bad idea and will cause a lot of
breakage.  For many/enough applications rewriting will not work at all,
because they might encode paths in data structures or be using a
non-UTF8 multi-byte encoding.

For example rewriting will fail for pretty much all Haskell packages,
because UTF-16 is a common encoding and path handling is not stringly
typed in Haskell.  In many cases there is an actual data structure for
paths with separated path segments in memory.  Many other strongly typed
languages will cause the same trouble.

In other words:  Do not rewrite paths!  If your proposal requires
violently manipulating binaries, it is most likely a bad idea.

One simple and safe way to do this would involve using private mounts
with chrooting:  Create a private bind-mount of "/" somewhere, then
bind-mount the Nix store at "/nix/store".  Run the application within a
chroot in that directory.  To the application the Nix store will appear
to be mounted at "/nix/store".

The drawback of this method is that it requires the administrator to
allow one SetUID executable for the setup, or perhaps a bunch of entries
in the fstab.  After that no further support from the administrator is
required.

Another way would be to hook the path handling procedures of the libc.
Rewrite "/nix/store" to whatever is in the NIX_STORE variable.  This
would be a lot of hard work, but would work much more reliably than
rewriting paths in binaries, and it would work without help from root.


Greets,
Ertugrul

-- 
Ertugrul Söylemez <[email protected]>

Key-ID: F9B5212A
Fingerprint: 8D89 7AC9 21CF F868 F074  9058 30CB D56F F9B5 212A

Attachment: pgp7GDP_cdOm9.pgp
Description: PGP signature

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to