Packaging/Tutorial: Difference between revisions
imported>Makefu add link to nixpkgs manual |
Arminius-smh (talk | contribs) m fix formatting |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ outdated | This page has duplicate info from [[Create and debug nix packages|with this other wiki page here]]. That page has much more info that might be of more help for you. This page currently has a discussion if it should be deprecated, but at the meantime it still might be useful until a decision is made to migrate over. }} | |||
If you are a new Nix adept and want to package some new software, you will benefit from reading existing Nix package descriptions. The more you read, the faster you'll be able to build your package. I've even based a "Generic Algorithm on Doing Packaging Using Existing Knowledge" on this fact. | If you are a new Nix adept and want to package some new software, you will benefit from reading existing Nix package descriptions. The more you read, the faster you'll be able to build your package. I've even based a "Generic Algorithm on Doing Packaging Using Existing Knowledge" on this fact. | ||
The nixpkgs manual describes the [https://nixos.org/nixpkgs/manual/#chap-quick-start standard workflow to adding packages to nixpkgs]. Be sure to read this one first. | The nixpkgs manual describes the [https://nixos.org/nixpkgs/manual/#chap-quick-start standard workflow to adding packages to nixpkgs]. Be sure to read this one first. | ||
NOTE 0: If you have time, read [https://unix.stackexchange.com/questions/717168/how-to-package-my-software-in-nix-or-write-my-own-package-derivation-for-nixpkgs this tutorial] first | |||
NOTE 1: If you have time, [https://nixos.org/nixos/nix-pills/ read Nix Pills] first | |||
NOTE 2: If you have even more time, [https://nixos.org/nix/manual/#chap-writing-nix-expressions read Nix manual] to get familiar with Nix syntax | |||
NOTE 3: If you definitely have lots of time, then [https://nixos.org/nixpkgs/manual read Nixpkgs manual] | |||
<ol style="list-style-type: decimal;"> | <ol style="list-style-type: decimal;"> | ||
Line 17: | Line 23: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ unpackPhase | $ unpackPhase | ||
$ cd | $ cd $sourceRoot # $sourceRoot is created in unpack phase, see https://nixos.org/manual/nixpkgs/stable/#ssec-unpack-phase for details. | ||
$ patchPhase | $ patchPhase | ||
$ configurePhase | $ configurePhase | ||
Line 26: | Line 32: | ||
<p>It most likely will fail.</p> | <p>It most likely will fail.</p> | ||
<p>NOTE: You can use the [https://nixos.org/manual/nixpkgs/stable/#breakpointhook breakpointHook] to attach into the build environment when an error happens.</p> | |||
</li></ol> | </li></ol> | ||