Nixpkgs/Building RPM DEB with nixpkgs: Difference between revisions
imported>Matthiasbeyer Created page with initial information |
imported>Sikmir No edit summary |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 20: | Line 20: | ||
The host machine has to be prepared for the build process. | The host machine has to be prepared for the build process. | ||
In the | In the evaluation for this article, a CentOS 7 amd64 machine running in vmware was used. | ||
On the machine, the nix package manager was installed via | On the machine, the nix package manager was installed via <code><nowiki>curl https://nixos.org/nix/install | sh</nowiki></code> as suggested on https://nixos.org/nix/ > "Get Nix". | ||
The configuration file | The configuration file <code>/etc/nix/nix.conf</code> was edited for the following contents: | ||
<syntaxHighlight> | <syntaxHighlight> | ||
sandbox = false | sandbox = false | ||
| Line 34: | Line 34: | ||
== How to build a deb/rpm with nixpkgs == | == How to build a deb/rpm with nixpkgs == | ||
The | The following approach can be used to try out building a <code>.deb</code> package with nixpkgs: | ||
# Clone the official nixpkgs repository into <code>~/nixpkgs</code> | |||
# Add a file to the nixpkgs repository <code>./deb.nix</code> with the following contents: | |||
(In this scenario, ncurses was built for testing the whole approach) | (In this scenario, ncurses was built for testing the whole approach) | ||
| Line 47: | Line 47: | ||
args = { | args = { | ||
diskImage = vm; | diskImage = vm; | ||
diskImageFormat = "qcow2"; | |||
src = pkgs.ncurses.src; | src = pkgs.ncurses.src; | ||
name = "ncurses-deb"; | name = "ncurses-deb"; | ||
| Line 55: | Line 56: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
and then this file was called: | and then this file was called: <code>nix-build ./deb.nix</code>. | ||
This loads the relevant disk images from the channel mirror and spins up the Qemu VM to build the package. | This loads the relevant disk images from the channel mirror and spins up the Qemu VM to build the package. | ||
The deb file (in this case, as we're building a deb with the expression from above) is located in ./result/debs/ after a successful build. | The deb file (in this case, as we're building a deb with the expression from above) is located in ./result/debs/ after a successful build. | ||