Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
When I exported a docker image to take look at what it is, it was also just a compressed set of tar'ed file trees. On 08/02/2017 7:46 AM, "Arnold Krille" wrote: > On Mon, 6 Feb 2017 18:33:19 -0600 Matthew Bauer > wrote: > > 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". > > > > 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. > > So instead of pushing docker images around to bring an app into > non-nix-production, we can just push around a tar'ed nix tree? Nice. > > - Arnold > > ___ > 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
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
On Mon, 6 Feb 2017 18:33:19 -0600 Matthew Bauer wrote: > 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". > > 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. So instead of pushing docker images around to bring an app into non-nix-production, we can just push around a tar'ed nix tree? Nice. - Arnold signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
> Any chance this could be combined with lethalman's work on turning > derivations into docker containers? Do you have a link to this project? All I can find is this blog post: http://lethalman.blogspot.com/2016/04/cheap-docker-images-with-nix_15.html We can get most of the advantages of the container features of Docker using just cgroups/namespaces. The main advantage of using Docker is that lots of different systems support it. The Open Container standard might be an easier way to go: it's just a folder with a /config.json file: https://github.com/opencontainers/runtime-spec On Tue, Feb 7, 2017 at 8:32 AM, Peter Hoeg wrote: > Nice work Matthew! > >>> 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. > > > Any chance this could be combined with lethalman's work on turning > derivations into docker containers? There seems to be a fair amount of > overlap and having a generic mechanism to create a runable closure means > we could relatively easily support the containerization mechanism and/or > application distribution format of the day. > > -- > Regards, > Peter > > ___ > 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
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
> One question: Will it create a persistent /nix directory on the machine > the generated binary is running? No, it just creates a temporary chroot in /tmp and bind mounts the /nix/ there. As a side effect, though, you will not have access to your regular /nix/ directory within the bundle (which is probably good for purity reasons). ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
Nice work Matthew! 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. Any chance this could be combined with lethalman's work on turning derivations into docker containers? There seems to be a fair amount of overlap and having a generic mechanism to create a runable closure means we could relatively easily support the containerization mechanism and/or application distribution format of the day. -- Regards, Peter ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
On 17-02-07 11:48am, Tomasz Czyż wrote: > 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? +1 -- Proudly written in Mutt with Vim on NixOS. Q: Why is this email five sentences or less? A: http://five.sentenc.es May take up to five days to read your message. If it’s urgent, call me. ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
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" : +1! This is really cool. Tomasz Czyż 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ż : > >> Matthew, >> very good tool, thank you for sharing. >> >> 2017-02-07 10:32 GMT+00:00 Domen Kožar : >> >>> Awesome! I will need this very soon, good timing :) >>> >>> On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich >>> 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 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@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ż >> > > > > -- > Tomasz Czyż > ___ > 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
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
+1! This is really cool. Tomasz Czyż 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ż : > >> Matthew, >> very good tool, thank you for sharing. >> >> 2017-02-07 10:32 GMT+00:00 Domen Kožar : >> >>> Awesome! I will need this very soon, good timing :) >>> >>> On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich >>> 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 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@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ż >> > > > > -- > Tomasz Czyż > ___ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
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ż : > Matthew, > very good tool, thank you for sharing. > > 2017-02-07 10:32 GMT+00:00 Domen Kožar : > >> Awesome! I will need this very soon, good timing :) >> >> On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich >> 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 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@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ż > -- Tomasz Czyż ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
Matthew, very good tool, thank you for sharing. 2017-02-07 10:32 GMT+00:00 Domen Kožar : > Awesome! I will need this very soon, good timing :) > > On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich > 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 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@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ż ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
Awesome! I will need this very soon, good timing :) On Tue, Feb 7, 2017 at 11:30 AM, Moritz Ulrich 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 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@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
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
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 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@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev -- signature.asc Description: PGP signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
This is very neat! Thank you for sharing! Graham ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] nix-bundle: Bundle Nix derivations to run anywhere
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". 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@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev