[Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
Tomasz Czyż
tomasz.czyz at gmail.com
Tue Feb 7 12:48:03 CET 2017
I would vote for mirroring this tool in nixos github namespace (or even
trying to make this project official one) as it can have big impact of
propagating/implementing nix ideas into environments where it's not
straight forward to use it.
What do you think people?
2017-02-07 11:31 GMT+00:00 Tomasz Czyż <tomasz.czyz at gmail.com>:
> Matthew,
> very good tool, thank you for sharing.
>
> 2017-02-07 10:32 GMT+00:00 Domen Kožar <domen at dev.si>:
>
>> Awesome! I will need this very soon, good timing :)
>>
>> On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich <moritz at tarn-vedra.de>
>> wrote:
>>
>>>
>>> Hey Matthew,
>>>
>>> This sounds great! I'll give it a try :-)
>>>
>>> One question: Will it create a persistent /nix directory on the machine
>>> the generated binary is running?
>>>
>>> Cheers
>>> Moritz
>>>
>>> Matthew Bauer <mjbauer95 at gmail.com> writes:
>>>
>>> > GitHub page: https://github.com/matthewbauer/nix-bundle
>>> >
>>> > I just wanted to post about a little project I've been working on. I'm
>>> > calling it "nix-bundle".
>>> >
>>> > Basically, what it does is: take a Nix closure, compress it into a
>>> > tarball, and turn that tarball into an executable using "Arx". The
>>> > final result looks like a plain shell script, but actually has a
>>> > tarball closure appended to it. When you run that script, Arx will
>>> > execute "nix-user-chroot" (which is included in the closure) which
>>> > will setup a /nix/ directory, then execute a target executable. All of
>>> > this should work "out of the box" for any Nix derivation folder with a
>>> > valid executable.
>>> >
>>> > For example, to generate a "hello" bundle:
>>> >
>>> > ./nix-bundle.sh hello /bin/hello
>>> >
>>> > "hello" specifies pkgs.hello and /bin/hello specifies the file
>>> > ${pkgs.helloi}/bin/hello to be executed. The output file will just be
>>> > called "hello".
>>> >p
>>> > The result is a "bundle" that can run without Nix being installed! No
>>> > external dependencies are needed because they are all contained within
>>> > the Nix closure.
>>> >
>>> > There are two main drawbacks: slow startup and large file size.
>>> > Extracting the tarball takes time and this adds on to startup times.
>>> > Also, because everything is included from the Nix closure, complicated
>>> > apps tend to be much larger because of the dependency tree.
>>> >
>>> > I've been experimenting with using AppImage as a format to package
>>> > them in, but it is not currently ready yet.
>>> > _______________________________________________
>>> > nix-dev mailing list
>>> > nix-dev at lists.science.uu.nl
>>> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>
>>> --
>>>
>>> _______________________________________________
>>> nix-dev mailing list
>>> nix-dev at lists.science.uu.nl
>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>
>>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>>
>
>
> --
> Tomasz Czyż
>
--
Tomasz Czyż
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170207/13aeeadd/attachment-0001.html>
More information about the nix-dev
mailing list