Packaging/Binaries: Difference between revisions

imported>Declension
m Tidying and minor corrections
Jopejoe1 (talk | contribs)
update guide to follow pkgs/by-name structure
Tags: Mobile edit Mobile web edit
Line 203: Line 203:


== Creating the Derivation for upstream Packaging ==
== Creating the Derivation for upstream Packaging ==
Packaging is straight forward. We just have to add all the steps we did into a simple derivation file. We call it <code>default.nix</code> and store it in the checked out nixpkgs repository at <code>pkgs/applications/office/master-pdf-editor</code>
Packaging is straight forward. We just have to add all the steps we did into a simple derivation file. We call it <code>package.nix</code> and store it in the checked out nixpkgs repository at <code>pkgs/by-name/ma/master-pdf-editor</code>
The content looks like this:
The content looks like this:
<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 261: Line 261:


Because we created a derivation which is meant to be called by callPackage we can build the package now only via:
Because we created a derivation which is meant to be called by callPackage we can build the package now only via:
<code>nix-build -E '((import <nixpkgs> {}).callPackage (import ./default.nix) { })' --keep-failed --no-out-link</code>
<code>nix-build -E '((import <nixpkgs> {}).callPackage (import ./package.nix) { })' --keep-failed --no-out-link</code>
 
== Add the package to nixpkgs ==
In order to add this new package to nixpkgs and be able to install it via <code>nix-build -A pkgs.master-pdf-editor</code> you need to add it to <code>pkgs/top-level/all-packages.nix</code>:
<syntaxHighlight lang=nix>
  ...
  masscan = callPackage ../tools/security/masscan { };
 
  master-pdf-editor = callPackage ../applications/office/master-pdf-editor {};
 
  meson = ../development/tools/build-managers/meson { };
  ...
</syntaxHighlight>


== Creating a Pull Request ==
== Creating a Pull Request ==