Packaging/Binaries: Difference between revisions
imported>Makefu autopatchelf is the preferred way |
imported>Makefu move tutorial-specific text to the "manual way" |
||
Line 1: | Line 1: | ||
Downloading a binary on NixOS and trying to run it will almost never work. This is due to hard-coded paths in the executable. Unfortunately almost all unfree and proprietary comes in binary form - the main reason to include binaries is because no source code is available. | Downloading a binary on NixOS and trying to run it will almost never work. This is due to hard-coded paths in the executable. Unfortunately almost all unfree and proprietary comes in binary form - the main reason to include binaries is because no source code is available. | ||
This tutorial will guide you through packaging a binary executable. | This tutorial will guide you through packaging a binary executable. | ||
== Using AutoPatchelfHook == | == Using AutoPatchelfHook == | ||
Line 63: | Line 59: | ||
== Manual Method == | == Manual Method == | ||
This sections describes the manual method of packaging a binary. It serves as a reference on the packaging issue with binaries and how these issues can be solved in nix derivations. | This sections describes the manual method of packaging a binary. It serves as a reference on the packaging issue with binaries and how these issues can be solved in nix derivations. | ||
This tutorial is about how to patch the executable with <code>patchelf</code> which is sufficient for most cases. If no source is available for a program patchelf is the preferred way in nixpkgs to add support for the package. | |||
However sometimes this is not enough, more hardcoded paths may be scattered all over the place. For this you may need to set up an FHSUserEnv, a Linux Standard Base style directory structure with a final <code>chroot</code> call to fixate all paths. For a tutorial on how to use this technique, check out [https://reflexivereflection.com/posts/2015-02-28-deb-installation-nixos.html Anders Papittos blog post on installing debian packages in nixos]. | |||
=== Starting Point === | === Starting Point === | ||
We want to package a tool called "MasterPDFEditor", the package for debian can be found at [http://get.code-industry.net/public/master-pdf-editor-4.3.10_qt5.amd64.deb] ([https://web.archive.org/web/20170914112947/http://get.code-industry.net/public/master-pdf-editor-4.3.10_qt5.amd64.deb archive.org mirror]). | We want to package a tool called "MasterPDFEditor", the package for debian can be found at [http://get.code-industry.net/public/master-pdf-editor-4.3.10_qt5.amd64.deb] ([https://web.archive.org/web/20170914112947/http://get.code-industry.net/public/master-pdf-editor-4.3.10_qt5.amd64.deb archive.org mirror]). |