[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nix-dev
Subject:    Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
From:       Maarten Hoogendoorn <maarten () moretea ! nl>
Date:       2017-02-07 11:57:25
Message-ID: CAHcRk1KoNZC_Xhc7WWc8XeE43AVqjx0vT+CcGbanwaHnahqb4Q () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


It could also be used to implement an offline NixOS installer. I guess it
needs to run as root given that you're setting up a chroot env?

Op 7 feb. 2017 12:50 p.m. schreef "Shea Levy" <shea@shealevy.com>:

+1! This is really cool.
Tomasz Czy=C5=BC <tomasz.czyz@gmail.com> writes:

> 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=C5=BC <tomasz.czyz@gmail.com>:
>
>> Matthew,
>> very good tool, thank you for sharing.
>>
>> 2017-02-07 10:32 GMT+00:00 Domen Ko=C5=BEar <domen@dev.si>:
>>
>>> Awesome! I will need this very soon, good timing :)
>>>
>>> On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich <moritz@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 machin=
e
>>>> the generated binary is running?
>>>>
>>>> Cheers
>>>> Moritz
>>>>
>>>> Matthew Bauer <mjbauer95@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 b=
e
>>>> > called "hello".
>>>> >p
>>>> > The result is a "bundle" that can run without Nix being installed! N=
o
>>>> > 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@lists.science.uu.nl
>>>> > http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>>
>>>> --
>>>>
>>>> _______________________________________________
>>>> nix-dev mailing list
>>>> nix-dev@lists.science.uu.nl
>>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> nix-dev mailing list
>>> nix-dev@lists.science.uu.nl
>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>
>>>
>>
>>
>> --
>> Tomasz Czy=C5=BC
>>
>
>
>
> --
> Tomasz Czy=C5=BC
> _______________________________________________
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

[Attachment #5 (text/html)]

<div dir="auto">It could also be used to implement an offline NixOS installer. I \
guess it needs to run as root given that you&#39;re setting up a chroot \
env?</div><div class="gmail_extra"><br><div class="gmail_quote">Op 7 feb. 2017 12:50 \
p.m. schreef &quot;Shea Levy&quot; &lt;<a \
href="mailto:shea@shealevy.com">shea@shealevy.com</a>&gt;:<br \
type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex">+1! This is really cool.<br> <div \
class="elided-text">Tomasz Czyż &lt;<a \
href="mailto:tomasz.czyz@gmail.com">tomasz.czyz@gmail.com</a>&gt; writes:<br> <br>
&gt; I would vote for mirroring this tool in nixos github namespace (or even<br>
&gt; trying to make this project official one) as it can have big impact of<br>
&gt; propagating/implementing nix ideas into environments where it&#39;s not<br>
&gt; straight forward to use it.<br>
&gt;<br>
&gt; What do you think people?<br>
&gt;<br>
&gt; 2017-02-07 11:31 GMT+00:00 Tomasz Czyż &lt;<a \
href="mailto:tomasz.czyz@gmail.com">tomasz.czyz@gmail.com</a>&gt;:<br> &gt;<br>
&gt;&gt; Matthew,<br>
&gt;&gt; very good tool, thank you for sharing.<br>
&gt;&gt;<br>
&gt;&gt; 2017-02-07 10:32 GMT+00:00 Domen Kožar &lt;<a \
href="mailto:domen@dev.si">domen@dev.si</a>&gt;:<br> &gt;&gt;<br>
&gt;&gt;&gt; Awesome! I will need this very soon, good timing :)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich &lt;<a \
href="mailto:moritz@tarn-vedra.de">moritz@tarn-vedra.de</a>&gt;<br> &gt;&gt;&gt; \
wrote:<br> &gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hey Matthew,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; This sounds great! I&#39;ll give it a try :-)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; One question: Will it create a persistent /nix directory on the \
machine<br> &gt;&gt;&gt;&gt; the generated binary is running?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Cheers<br>
&gt;&gt;&gt;&gt; Moritz<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Matthew Bauer &lt;<a \
href="mailto:mjbauer95@gmail.com">mjbauer95@gmail.com</a>&gt; writes:<br> \
&gt;&gt;&gt;&gt;<br> &gt;&gt;&gt;&gt; &gt; GitHub page: <a \
href="https://github.com/matthewbauer/nix-bundle" rel="noreferrer" \
target="_blank">https://github.com/<wbr>matthewbauer/nix-bundle</a><br> \
&gt;&gt;&gt;&gt; &gt;<br> &gt;&gt;&gt;&gt; &gt; I just wanted to post about a little \
project I&#39;ve been working on. I&#39;m<br> &gt;&gt;&gt;&gt; &gt; calling it \
&quot;nix-bundle&quot;.<br> &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; Basically, what it does is: take a Nix closure, compress it \
into a<br> &gt;&gt;&gt;&gt; &gt; tarball, and turn that tarball into an executable \
using &quot;Arx&quot;. The<br> &gt;&gt;&gt;&gt; &gt; final result looks like a plain \
shell script, but actually has a<br> &gt;&gt;&gt;&gt; &gt; tarball closure appended \
to it. When you run that script, Arx will<br> &gt;&gt;&gt;&gt; &gt; execute \
&quot;nix-user-chroot&quot; (which is included in the closure) which<br> \
&gt;&gt;&gt;&gt; &gt; will setup a /nix/ directory, then execute a target executable. \
All of<br> &gt;&gt;&gt;&gt; &gt; this should work &quot;out of the box&quot; for any \
Nix derivation folder with a<br> &gt;&gt;&gt;&gt; &gt; valid executable.<br>
&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; For example, to generate a &quot;hello&quot; bundle:<br>
&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; ./nix-bundle.sh hello /bin/hello<br>
&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; &quot;hello&quot; specifies pkgs.hello and /bin/hello specifies \
the file<br> &gt;&gt;&gt;&gt; &gt; ${pkgs.helloi}/bin/hello to be executed. The \
output file will just be<br> &gt;&gt;&gt;&gt; &gt; called &quot;hello&quot;.<br>
&gt;&gt;&gt;&gt; &gt;p<br>
&gt;&gt;&gt;&gt; &gt; The result is a &quot;bundle&quot; that can run without Nix \
being installed! No<br> &gt;&gt;&gt;&gt; &gt; external dependencies are needed \
because they are all contained within<br> &gt;&gt;&gt;&gt; &gt; the Nix closure.<br>
&gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; There are two main drawbacks: slow startup and large file \
size.<br> &gt;&gt;&gt;&gt; &gt; Extracting the tarball takes time and this adds on to \
startup times.<br> &gt;&gt;&gt;&gt; &gt; Also, because everything is included from \
the Nix closure, complicated<br> &gt;&gt;&gt;&gt; &gt; apps tend to be much larger \
because of the dependency tree.<br> &gt;&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt;&gt; &gt; I&#39;ve been experimenting with using AppImage as a format to \
package<br> &gt;&gt;&gt;&gt; &gt; them in, but it is not currently ready yet.<br>
&gt;&gt;&gt;&gt; &gt; ______________________________<wbr>_________________<br>
&gt;&gt;&gt;&gt; &gt; nix-dev mailing list<br>
&gt;&gt;&gt;&gt; &gt; <a \
href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br> \
&gt;&gt;&gt;&gt; &gt; <a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" \
rel="noreferrer" target="_blank">http://lists.science.uu.nl/<wbr>mailman/listinfo/nix-dev</a><br>
 &gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt;&gt;&gt; nix-dev mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
 &gt;&gt;&gt;&gt; <a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" \
rel="noreferrer" target="_blank">http://lists.science.uu.nl/<wbr>mailman/listinfo/nix-dev</a><br>
 &gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt;&gt; nix-dev mailing list<br>
&gt;&gt;&gt; <a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
 &gt;&gt;&gt; <a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" \
rel="noreferrer" target="_blank">http://lists.science.uu.nl/<wbr>mailman/listinfo/nix-dev</a><br>
 &gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Tomasz Czyż<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Tomasz Czyż<br>
&gt; ______________________________<wbr>_________________<br>
&gt; nix-dev mailing list<br>
&gt; <a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
&gt; <a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" rel="noreferrer" \
target="_blank">http://lists.science.uu.nl/<wbr>mailman/listinfo/nix-dev</a><br> \
</div><br>______________________________<wbr>_________________<br> nix-dev mailing \
list<br> <a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
 <a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" rel="noreferrer" \
target="_blank">http://lists.science.uu.nl/<wbr>mailman/listinfo/nix-dev</a><br> \
<br></blockquote></div><br></div>



_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic