about summary refs log tree commit diff
path: root/nixpkgs/doc/functions/snaptools.xml
blob: a951c36730d3c8dc723a4f2450403152d1cb5de9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<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>
  <varname>pkgs.snapTools</varname> is a set of functions for creating
  Snapcraft images. Snap and Snapcraft is not used to perform these operations.
 </para>

 <section xml:id="ssec-pkgs-snapTools-makeSnap-signature">
  <title>The makeSnap Function</title>

  <para>
   <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.
  </para>

  <para>
   The <parameter>base</parameter> should not be be specified, as
   <function>makeSnap</function> will force set it.
  </para>

  <para>
   Currently, <function>makeSnap</function> does not support creating GUI
   stubs.
  </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>
<programlisting><xi:include href="../../pkgs/build-support/snap/example-hello.nix" parse="text" /></programlisting>
   <para>
    <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.
   </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>
    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.
   </para>
<programlisting><xi:include href="../../pkgs/build-support/snap/example-firefox.nix" parse="text" /></programlisting>
   <para>
    <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.
   </para>
   <para>
    The specific meaning behind plugs can be looked up in the
    <link xlink:href="https://docs.snapcraft.io/supported-interfaces">Snapcraft
    interface documentation</link>.
   </para>
  </example>
 </section>
</section>