wiki/literature.courtesCodeStagingGNU2017.html

28 lines
10 KiB
HTML
Raw Permalink Normal View History

2022-07-29 15:41:17 +00:00
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Code Staging in GNU Guix</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
MathJax = {
tex: {
inlineMath: [ [&#x27;$&#x27;,&#x27;$&#x27;], [&#x27;\(&#x27;,&#x27;\)&#x27;] ],
displayMath: [ [&#x27;$$&#x27;,&#x27;$$&#x27;], [&#x27;[&#x27;,&#x27;]&#x27;] ]
},
options = {
processHtmlClass = &quot;math&quot;
}
}
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Code Staging in GNU Guix</h1><section class="post-metadata"><span>Date: <!-- -->2022-06-11 17:36:08 +08:00</span><span>Date modified: <!-- -->2022-06-11 18:10:24 +08:00&gt;</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><ul><li><p>describes the code staging process for package definitions in <a href="/wiki/2020-08-19-08-21-44">Guix package manager</a>;
mainly describing <a href="roam:Guix G-expressions">roam:Guix G-expressions</a></p></li><li><p>creating package definitions often certain parts of the definitions to carry through the build stage;
oftentimes, these parts of code include additional build instructions for non-trivial packages and additional inputs for that package
</p></li><li><p>while S-expressions (sexp) are nice, they can be verbose at times;
this is where G-expressions (gexp) comes in handy
</p><ul><li><p>gexp are hygenic — they preserve lexical scope across different stages
</p></li><li><p>they can easily refer to the high-level objects (e.g., packages, local file) in the store (i.e., <code class="inline-code">/gnu/store</code>)
</p></li><li><p>first-class Scheme values
</p></li><li><p>binds deployment to staging — when brought into staging, all inputs are also deployed as well
</p></li></ul></li><li><p>use cases for gexps
</p><ul><li><p>code sharing between multiple stages;
this is mostly present such as defining packages and building them
</p></li><li><p>cross-compilation — there are additional operators to denote &quot;nativeness&quot; where it will refer to the &quot;native&quot; version rather than the target version
</p></li><li><p>package definitions — less verbose definitions which is always nice especially with the use of referring to the absolute file names from the store
</p></li><li><p>system services — the process and lifecycle of system services is similar to defining packages being composed of multiple stages: one in definition and one in building the services in the init system
</p></li><li><p>system tests — they can be defined through the <code class="inline-verbatim">operating-system</code> interface which are derivations describing entire operating systems;
in Guix, this is implemented through a tool called <code class="inline-verbatim">marionette</code> which introduces another stage in the pipeline
</p></li></ul></li></ul></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2022-06-11 17:36:08 +08:00","date_modified":"2022-06-11 18:10:24 +08:00\u003e","language":"en","source":""},"title":"Code Staging in GNU Guix","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"describes the code staging process for package definitions in "},{"type":"element","tagName":"a","properties":{"href":"/2020-08-19-08-21-44"},"children":[{"type":"text","value":"Guix package manager"}]},{"type":"text","value":";\n mainly describing "},{"type":"element","tagName":"a","properties":{"href":"roam:Guix G-expressions"},"children":[{"type":"text","value":"roam:Guix G-expressions"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"creating package definitions often certain parts of the definitions to carry through the build stage;\n oftentimes, these parts of code include additional build instructions for non-trivial packages and additional inputs for that package\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"while S-expressions (sexp) are nice, they can be verbose at times;\n this is where G-expressions (gexp) comes in handy\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"gexp are hygenic they preserve lexical scope across different stages\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"they can easily refer to the high-level objects (e.g., packages, local file) in the store (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"/gnu/store"}]},{"type":"text","value":")\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"first-class Scheme values\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"binds deployment to staging when brought into staging, all inputs are also deployed as well\n"}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"use cases for gexps\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"code sharing between multiple stages;\n this is mostly present such as defining packages and building them\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"cross-compilation there are additional operators to denote \"nativeness\" where it will refer to the \"native\" version rather than the target version\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"package definitions less verbose definitions which is always nice especially with the use of referring to the absolute file names from the store\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties"