Update a package: Difference between revisions
imported>Musicmatze Remove ML link |
m Fix category formatting |
||
(9 intermediate revisions by 7 users not shown) | |||
Line 21: | Line 21: | ||
mkdir ~/devel/ | mkdir ~/devel/ | ||
cd ~/devel/ | cd ~/devel/ | ||
git clone https://github.com/your_username/nixpkgs.git | git clone https://github.com/your_username/nixpkgs.git \ | ||
--depth=1 # Prevents cloning the entire history, which is multiple gigabytes | |||
cd nixpkgs/ | cd nixpkgs/ | ||
git remote add upstream https://github.com/NixOS/nixpkgs.git</syntaxhighlight> | git remote add upstream https://github.com/NixOS/nixpkgs.git</syntaxhighlight> | ||
Line 40: | Line 41: | ||
== Following the white rabbit == | == Following the white rabbit == | ||
* This section does not apply for packages in the directory pkgs/by-name. For them, see the included [https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/README.md pkgs/by-name/README.md]. | |||
* I will center this tutorial on the nix expression that packages the [http://i3wm.org/ i3 window manager], as this expression is quite simple and it was contributing to this expression that I got to understand this whole workflow I am documenting. | * I will center this tutorial on the nix expression that packages the [http://i3wm.org/ i3 window manager], as this expression is quite simple and it was contributing to this expression that I got to understand this whole workflow I am documenting. | ||
* In <tt>~/devel/nixpkgs/default.nix</tt> there is an ''import'' statement that reads <tt>import ./pkgs/top-level/all-packages.nix</tt> | * In <tt>~/devel/nixpkgs/default.nix</tt> there is an ''import'' statement that reads <tt>import ./pkgs/top-level/all-packages.nix</tt> | ||
Line 173: | Line 175: | ||
* If your current directory is, as we said, <tt>~/devel/nixpkgs/</tt>, you can request nix to build the modified package (see <tt>man nix-build</tt>): | * If your current directory is, as we said, <tt>~/devel/nixpkgs/</tt>, you can request nix to build the modified package (see <tt>man nix-build</tt>): | ||
<pre>nix-build -A i3</pre> | <pre>nix-build -A i3</pre> | ||
* In this invocation the <tt>i3</tt> in <tt>-A i3</tt> refers to <tt>i3 = callPackage ...</tt> in <tt>pkgs/top-level/all-packages.nix</tt>. In the same way as the <tt>pango</tt> we talked about above, both names are attributes from the top-level Nix expression being evaluated. In this case <tt>~/devel/nixpkgs/default.nix</tt> | |||
* In | |||
* Here I would have detected the error I introduced on <tt>pkgs/top-level/all-packages.nix</tt>. Too bad I didn't still know how to test my changes: | * Here I would have detected the error I introduced on <tt>pkgs/top-level/all-packages.nix</tt>. Too bad I didn't still know how to test my changes: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
Line 206: | Line 206: | ||
* When the build succeeds, <tt>nix-build</tt> will leave the result linked as <tt>./result</tt> on the current working directory: | * When the build succeeds, <tt>nix-build</tt> will leave the result linked as <tt>./result</tt> on the current working directory: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ stat ./result | $ stat -c %N ./result | ||
File: "./result" -> "/nix/store/agld76p9rgvn3j610z8kgppz67f8kmg7-i3-4.5.1" | File: "./result" -> "/nix/store/agld76p9rgvn3j610z8kgppz67f8kmg7-i3-4.5.1" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 491: | Line 491: | ||
* [[Create and debug nix packages]] | * [[Create and debug nix packages]] | ||
* [[Generic Algorithm on Doing Packaging]] | * [[Generic Algorithm on Doing Packaging]] | ||
* [[Contributing to Nix documentation]] | * [[Contributing#Contributing to the documentation|Contributing to Nix documentation]] | ||
* [[Nixpkgs/Update Scripts]] - automatic updating of packages | |||
[[:Category: | [[Category:Tutorial]] | ||
[[Category:Nixpkgs]] | |||
[[Category:Contributing]] |