Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapTools.makeSnap: init #63457

Merged
merged 1 commit into from Jul 7, 2019
Merged

snapTools.makeSnap: init #63457

merged 1 commit into from Jul 7, 2019

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Jun 18, 2019

Hopefully the docs I wrote explains it!

The result of my Snapcraft.io summit in Montreal.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@grahamc
Copy link
Member Author

grahamc commented Jun 19, 2019

This is actually blocked on upstream support (cc @jdstrand). Snap's store validates every path in the package exists, and thinks /nix/store/foo does not exist when it does.

@jdstrand
Copy link

FYI, this is fixed in the review-tools of the store but it isn't in production yet. Feel free to upload to the store and request a manual review and we can manually approve it in the meantime.

@disassembler
Copy link
Member

Experienced issues in manual review when I had coreutils added into the path of a script:

Feedback for version bh9l2dnzvjrkf4lvwrhs2prwhsw78192 (12) upload of jormungandr.

$ snap-review ./ea3h8Lw22pDjjwr4fIOofgj58AnWkwSL_12.snap 
Errors
------
 - lint-snap-v2:external_symlinks
        package contains external symlinks: nix/store/zh1q7yvyaxlcmj3n6g0rrdaq0v73pp90-linux-pam-1.3.1/bin/unix_chkpwd
./ea3h8Lw22pDjjwr4fIOofgj58AnWkwSL_12.snap: FAIL

This error is real:

$ ls -l nix/store/zh1q7yvyaxlcmj3n6g0rrdaq0v73pp90-linux-pam-1.3.1/bin/unix_chkpwd
lrwxrwxrwx 1 jamie jamie 29 Dec 31  1969 nix/store/zh1q7yvyaxlcmj3n6g0rrdaq0v73pp90-linux-pam-1.3.1/bin/unix_chkpwd -> /run/wrappers/bin/unix_chkpwd

/run/wrappers/bin/unix_chkpwd isn't guaranteed to exist out side of the snap (and indeed doesn't in, for example, Ubuntu.

Derivation of script is here: https://github.com/input-output-hk/jormungandr-nix/blob/master/default.nix#L136

and building snappy package is here: https://github.com/input-output-hk/jormungandr-nix/blob/master/linux/default.nix

@grahamc
Copy link
Member Author

grahamc commented Jun 25, 2019

It would be interesting to walk the store paths and verify there are no symlinks to /run, and also that the commands are executable files.

@grahamc grahamc merged commit 39a5867 into NixOS:master Jul 7, 2019
@samueldr
Copy link
Member

This PR broke the manual build (I think).

[...]
warning: failed to load external entity "../pkgs/build-support/snap/example-hello.nix"
functions/snaptools.xml:41: element include: XInclude error : could not load ../pkgs/build-support/snap/example-hello.nix, and no fallback was found
warning: failed to load external entity "../pkgs/build-support/snap/example-firefox.nix"
functions/snaptools.xml:60: element include: XInclude error : could not load ../pkgs/build-support/snap/example-firefox.nix, and no fallback was found
jing doc-support/result/docbook.rng manual-full.xml
/build/doc/manual-full.xml:13541:98: error: element "xi:include" not allowed here; expected the element end-tag, text or element "abbrev", "accel", "acronym", "alt", "anchor", "annotation", "application", "author", "biblioref", "citation", "citebiblioid", "citerefentry", "citetitle", "classname", "co", "code", "command", "computeroutput", "constant", "coref", "database", "date", "editor", "email", "emphasis", "envar", "errorcode", "errorname", "errortext", "errortype", "exceptionname", "filename", "firstterm", "footnote", "footnoteref", "foreignphrase", "function", "glossterm", "guibutton", "guiicon", "guilabel", "guimenu", "guimenuitem", "guisubmenu", "hardware", "indexterm", "info", "initializer", "inlineequation", "inlinemediaobject", "interfacename", "jobtitle", "keycap", "keycode", "keycombo", "keysym", "lineannotation", "link", "literal", "markup", "menuchoice", "methodname", "modifier", "mousebutton", "nonterminal", "olink", "ooclass", "ooexception", "oointerface", "option", "optional", "org", "orgname", "package", "parameter", "person", "personname", "phrase", "productname", "productnumber", "prompt", "property", "quote", "remark", "replaceable", "returnvalue", "shortcut", "subscript", "superscript", "symbol", "systemitem", "tag", "termdef", "textobject", "token", "trademark", "type", "uri", "userinput", "varname", "wordasword" or "xref"
/build/doc/manual-full.xml:13560:100: error: element "xi:include" not allowed here; expected the element end-tag, text or element "abbrev", "accel", "acronym", "alt", "anchor", "annotation", "application", "author", "biblioref", "citation", "citebiblioid", "citerefentry", "citetitle", "classname", "co", "code", "command", "computeroutput", "constant", "coref", "database", "date", "editor", "email", "emphasis", "envar", "errorcode", "errorname", "errortext", "errortype", "exceptionname", "filename", "firstterm", "footnote", "footnoteref", "foreignphrase", "function", "glossterm", "guibutton", "guiicon", "guilabel", "guimenu", "guimenuitem", "guisubmenu", "hardware", "indexterm", "info", "initializer", "inlineequation", "inlinemediaobject", "interfacename", "jobtitle", "keycap", "keycode", "keycombo", "keysym", "lineannotation", "link", "literal", "markup", "menuchoice", "methodname", "modifier", "mousebutton", "nonterminal", "olink", "ooclass", "ooexception", "oointerface", "option", "optional", "org", "orgname", "package", "parameter", "person", "personname", "phrase", "productname", "productnumber", "prompt", "property", "quote", "remark", "replaceable", "returnvalue", "shortcut", "subscript", "superscript", "symbol", "systemitem", "tag", "termdef", "textobject", "token", "trademark", "type", "uri", "userinput", "varname", "wordasword" or "xref"
make: *** [Makefile:29: validate] Error 1
builder for '/nix/store/xlnk7zwx55yccml3kq718c0ayjlii5hd-nixpkgs-manual.drv' failed with exit code 2

@grahamc grahamc deleted the snap branch July 10, 2019 14:59
@grahamc
Copy link
Member Author

grahamc commented Jul 10, 2019

Fixed! Thank you, sorry about that :(

@djmaze
Copy link
Contributor

djmaze commented Jul 26, 2020

Tried to wrap my head around on how this works. You still need a machine running snap in order to build the final snap package, right? So, as snap is not (yet) working on NixOS, you cannot build snap packages on NixOS for now. Which would be quite valuable in order to provide packages for other distributions from a NixOS development machine.

UPDATE: Nevermind, just realized that the created squashfs file is the actual snap package. Sorry for the noise..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants