nixpkgs/doc/functions/snaptools.xml

60 lines
2.5 KiB
XML
Raw Normal View History

2019-06-18 16:51:58 +00:00
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
xml:id="sec-pkgs-snapTools">
<title>pkgs.snapTools</title>
<para>
2019-09-18 20:12:54 +00:00
<varname>pkgs.snapTools</varname> is a set of functions for creating Snapcraft images. Snap and Snapcraft is not used to perform these operations.
2019-06-18 16:51:58 +00:00
</para>
<section xml:id="ssec-pkgs-snapTools-makeSnap-signature">
<title>The makeSnap Function</title>
<para>
2019-09-18 20:12:54 +00:00
<function>makeSnap</function> takes a single named argument, <parameter>meta</parameter>. This argument mirrors <link xlink:href="https://docs.snapcraft.io/snap-format">the upstream <filename>snap.yaml</filename> format</link> exactly.
2019-06-18 16:51:58 +00:00
</para>
<para>
2019-09-18 20:12:54 +00:00
The <parameter>base</parameter> should not be be specified, as <function>makeSnap</function> will force set it.
2019-06-18 16:51:58 +00:00
</para>
<para>
2019-09-18 20:12:54 +00:00
Currently, <function>makeSnap</function> does not support creating GUI stubs.
2019-06-18 16:51:58 +00:00
</para>
</section>
<section xml:id="ssec-pkgs-snapTools-build-a-snap-hello">
<title>Build a Hello World Snap</title>
<example xml:id="ex-snapTools-buildSnap-hello">
<title>Making a Hello World Snap</title>
<para>
The following expression packages GNU Hello as a Snapcraft snap.
</para>
2019-07-10 15:01:45 +00:00
<programlisting><xi:include href="./snap/example-hello.nix" parse="text" /></programlisting>
2019-06-18 16:51:58 +00:00
<para>
2019-09-18 20:12:54 +00:00
<command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>hello</command> will now be the Snapcraft version of the package.
2019-06-18 16:51:58 +00:00
</para>
</example>
</section>
<section xml:id="ssec-pkgs-snapTools-build-a-snap-firefox">
<title>Build a Hello World Snap</title>
<example xml:id="ex-snapTools-buildSnap-firefox">
<title>Making a Graphical Snap</title>
<para>
2019-09-18 20:12:54 +00:00
Graphical programs require many more integrations with the host. This example uses Firefox as an example, because it is one of the most complicated programs we could package.
2019-06-18 16:51:58 +00:00
</para>
2019-07-10 15:01:45 +00:00
<programlisting><xi:include href="./snap/example-firefox.nix" parse="text" /></programlisting>
2019-06-18 16:51:58 +00:00
<para>
2019-09-18 20:12:54 +00:00
<command>nix-build</command> this expression and install it with <command>snap install ./result --dangerous</command>. <command>nix-example-firefox</command> will now be the Snapcraft version of the Firefox package.
2019-06-18 16:51:58 +00:00
</para>
<para>
2019-09-18 20:12:54 +00:00
The specific meaning behind plugs can be looked up in the <link xlink:href="https://docs.snapcraft.io/supported-interfaces">Snapcraft interface documentation</link>.
2019-06-18 16:51:58 +00:00
</para>
</example>
</section>
</section>