Packaging/Tutorial: Difference between revisions

imported>Fadenb
m syntaxhighlight changes
imported>Fadenb
m Syntax highlighting
Line 13: Line 13:
<li><p>Modify source URL and sha256. Don't forget about that sha256 stuff! What I do, I change last symbol of sha256, let the package fail, and then paste correct sha256 again into expression. There are also various prefetch techniques</p></li>
<li><p>Modify source URL and sha256. Don't forget about that sha256 stuff! What I do, I change last symbol of sha256, let the package fail, and then paste correct sha256 again into expression. There are also various prefetch techniques</p></li>
<li><p>Run <code>nix-shell</code> on this expression. Then run in order:</p>
<li><p>Run <code>nix-shell</code> on this expression. Then run in order:</p>
<syntaxhighlight lang="bash"> $ unpackPhase
<syntaxhighlight lang="console">
  $ cd DIR_AFTER_UNPACK
$ unpackPhase
  $ patchPhase
$ cd DIR_AFTER_UNPACK
  $ configurePhase
$ patchPhase
  $ buildPhase</syntaxhighlight>
$ configurePhase
$ buildPhase</syntaxhighlight>
<p>(visit [https://nixos.org/nixpkgs/manual/#sec-stdenv-phases stdenv-phases] chapter to learn more about phases)</p></li></ol>
<p>(visit [https://nixos.org/nixpkgs/manual/#sec-stdenv-phases stdenv-phases] chapter to learn more about phases)</p></li></ol>


You may need to run <code>$ eval &quot;$configurePhase&quot;</code> sometimes if build expression overrides that phase.
You may need to run <syntaxhighlight lang="console" inline>$ eval "$configurePhase"</syntaxhighlight> sometimes if build expression overrides that phase.


It most likely will fail.
It most likely will fail.
Line 53: Line 54:
In first case, you can run
In first case, you can run


<syntaxhighlight lang="bash"> $ installPhase</syntaxhighlight>
<syntaxhighlight lang="console">
$ installPhase
</syntaxhighlight>
directly and examine using <code>tree $out</code> your package files. If something is missing or too many, fix the <code>postInstallPhase</code> or <code>preInstallPhase</code> or <code>installPhase</code> in your expression.
directly and examine using <code>tree $out</code> your package files. If something is missing or too many, fix the <code>postInstallPhase</code> or <code>preInstallPhase</code> or <code>installPhase</code> in your expression.