<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>reproductible &amp;mdash; csantosb</title>
    <link>https://infosec.press/csantosb/tag:reproductible</link>
    <description>Random thoughts</description>
    <pubDate>Tue, 16 Jun 2026 03:51:54 +0000</pubDate>
    <item>
      <title>ci (gitlab/hub)</title>
      <link>https://infosec.press/csantosb/ci-gitlab-hub</link>
      <description>&lt;![CDATA[img br/&#xA;Remote #ci is the way to go in #modernhw digital design testing. In this #ciseries, let’s see it in practice with some detail using two of the most popular forges out there. !--more-- br/&#xA;&#xA;Gitlab&#xA;&#xA;The gitlab #gitforge includes tones of features. Among these, a facility called the container registry, which stores per project container images. Guix pack allows the creation of custom #reproductible environments as images. In particular, it is possible to create a docker image out of our manifest and channels files with br/&#xA;&#xA;guix time-machine -C channels.scm -- pack --compression=xz --save-provenance -f docker -m manifest.scm&#xA;&#xA;Check the documentation for options. br/&#xA;Remember that there are obviously alternative methods to produce docker images. The point on using guix resides on its reproducibility capabilities: you’ll be able to create a new, identical docker image, out of the manifest and channels files at any point in time. Even more: you’ll have the capacity to retrieve your manifest file out of the binary image in case your manifest file gets lost. br/&#xA;Then, this image must be loaded into the local docker store with br/&#xA;&#xA;docker load &lt; IMAGE&#xA;&#xA;and renamed to something meaningful br/&#xA;&#xA;docker tag IMAGE:latest gitlab-registry.whatever.fr/domain/group/NAME:TAG&#xA;&#xA;go remote&#xA;&#xA;img br/&#xA;Finally, pushed to the remote container registry of your project with br/&#xA;&#xA;docker push gitlab-registry.whatever.fr/domain/group/NAME:TAG&#xA;&#xA;At this point, you have an environment where you’ll run your tests using gitlab&#39;s ci features. You’ll set up your gitlab’s runners and manifest files to use this container to execute your jobs. br/&#xA;As an alternative, you could use a ssh executor running on your own fast and powerful hardware resources (dedicated machine, shared cluster, etc.). In this case, you’d rather produce an apptainer  container image with: br/&#xA;&#xA;guix time-machine -C channels.scm -- pack -f squashfs ...&#xA;&#xA;scp this container file to your computing resources and call it from the #gitlab runner. br/&#xA;&#xA;Github&#xA;&#xA;The github is probably the most popular #gitforge out there. It follows a similar to #gitlab in its conception (pull requests and merge requests, you catch the idea ?). It also includes a container registry, and the set of features if offers may be exchanged with ease with any other #gitforge following the same paradigm. No need to go into more details. br/&#xA;There is a couple of interesting tips about using #github, though. It happens more usually than not that users encounter frequently problems of #reproducibility when using container images hosted on ghcr.io, the hosting service for user images. These images are usually employed for running #ci testing pipelines, and they usually break as upstream changes happen: updates, image definition changes, image packages upgrades, etc. If you read my dependencies hell post, this should ring a bell. br/&#xA;What can be done about in what concerns #modernhw ? Well, we have #guix. Let’s try a differente approach: building an image locally, and pushing it to #github registry. Let’s see how. br/&#xA;&#xA;in practice&#xA;&#xA;An example repository shows tha way to proceed. Its contents allow to create a docker container image to be hosted remotely. It includes all that’s necessary to perform remote #ci testing of a #modernhw #vhdl design. br/&#xA;&#xA;docker pull ghcr.io/csantosb/hdl&#xA;docker images # check $ID&#xA;docker run -ti $ID bash&#xA;&#xA;It includes a couple of #plaintext files to produce a #deterministic container. First, the channels.scm file with the list of guix chanels to use to pull packages from. Then, a manifest.scm, with the list of packages to be install within the container. br/&#xA;The image container may be build with br/&#xA;&#xA;image=$(guix time-machine --channels=channels.scm -- \&#xA;             pack -f docker \&#xA;             -S /bin=bin \&#xA;             --save-provenance \&#xA;             -m manifest.scm)&#xA;&#xA;At this point, it is to be load to the docker store with br/&#xA;&#xA;docker load &lt; $image&#xA;docker images&#xA;&#xA;Now it is time to tag the image br/&#xA;&#xA;docker tag IMID ghcr.io/USER/REPO:RELEASE&#xA;&#xA;and login to ghcr.io br/&#xA;&#xA;docker login -u USER -p PASSWORD ghcr.io&#xA;&#xA;Finally, the image is to be push remotely br/&#xA;&#xA;docker push ghcr.io/USER/HDL:RELEASE&#xA;&#xA;test&#xA;&#xA;You’ll may test this image using the neorv32 project, for example, with: br/&#xA;&#xA;docker pull ghcr.io/csantosb/hdl&#xA;docker run -ti ID bash&#xA;git clone --depth=1 https://github.com/stnolting/neorv32&#xA;cd neorv32&#xA;git clone --depth=1 https://github.com/stnolting/neorv32-vunit test&#xA;cd test&#xA;rm -rf neorv32&#xA;ln -sf ../../neorv32 neorv32&#xA;python3 sim/run.py --ci-mode -v&#xA;`]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/gitlab.png" alt="img"> <br/>
Remote <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a> is the <a href="https://infosec.press/csantosb/tag:ciseries" rel="nofollow">way to go</a> in <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> digital design testing. In this <a href="/csantosb/tag:ciseries" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ciseries</span></a>, let’s see it in practice with some detail using two of the most popular forges out there.  <br/></p>

<h1 id="gitlab">Gitlab</h1>

<p>The <a href="https://gitlab.com/" rel="nofollow">gitlab</a> <a href="/csantosb/tag:gitforge" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitforge</span></a> includes tones of features. Among these, a facility called the <a href="https://docs.gitlab.com/ee/user/packages/container_registry/" rel="nofollow">container registry</a>, which stores per project container images. <a href="https://infosec.press/csantosb/guix-crash-course#packs" rel="nofollow">Guix pack</a> allows the creation of custom <a href="/csantosb/tag:reproductible" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reproductible</span></a> environments as images. In particular, it is possible to create a docker image out of our <a href="https://infosec.press/csantosb/guix-crash-course#manifest-channels" rel="nofollow">manifest and channels files</a> with <br/></p>

<pre><code class="language-sh">guix time-machine -C channels.scm -- pack --compression=xz --save-provenance -f docker -m manifest.scm
</code></pre>

<p>Check the <a href="https://guix.gnu.org/manual/en/html_node/Invoking-guix-pack.html" rel="nofollow">documentation</a> for options. <br/>
Remember that there are obviously alternative methods to produce docker images. The point on using guix resides on its <a href="https://infosec.press/csantosb/use-guix#reproducibility" rel="nofollow">reproducibility</a> capabilities: you’ll be able to create a new, identical docker image, out of the <a href="https://infosec.press/csantosb/guix-crash-course#manifest-channels" rel="nofollow">manifest and channels files</a> at any point in time. Even more: you’ll have the capacity to retrieve your manifest file out of the binary image in case your manifest file gets lost. <br/>
Then, this image must be loaded into the local docker store with <br/></p>

<pre><code class="language-shell">docker load &lt; IMAGE
</code></pre>

<p>and renamed to something meaningful <br/></p>

<pre><code class="language-shell">docker tag IMAGE:latest gitlab-registry.whatever.fr/domain/group/NAME:TAG
</code></pre>

<h2 id="go-remote">go remote</h2>

<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/ci2.png" alt="img"> <br/>
Finally, pushed to the remote container registry of your project with <br/></p>

<pre><code class="language-shell">docker push gitlab-registry.whatever.fr/domain/group/NAME:TAG
</code></pre>

<p>At this point, you have an environment where you’ll run your tests using <a href="https://docs.gitlab.com/ee/ci/" rel="nofollow">gitlab&#39;s ci</a> features. You’ll set up your gitlab’s <a href="https://docs.gitlab.com/runner/" rel="nofollow">runners</a> and <a href="https://docs.gitlab.com/ee/ci/#step-1-create-a-gitlab-ciyml-file" rel="nofollow">manifest files</a> to use this container to execute your jobs. <br/>
As an alternative, you could use a <a href="https://docs.gitlab.com/runner/executors/ssh.html" rel="nofollow">ssh executor</a> running on your own fast and powerful hardware resources (dedicated machine, shared cluster, etc.). In this case, you’d rather produce an apptainer  container image with: <br/></p>

<pre><code class="language-sh">guix time-machine -C channels.scm -- pack -f squashfs ...
</code></pre>

<p><code>scp</code> this container file to your computing resources and call it from the <a href="/csantosb/tag:gitlab" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitlab</span></a> runner. <br/></p>

<h1 id="github">Github</h1>

<p>The <a href="https://github.com/" rel="nofollow">github</a> is probably the most popular <a href="/csantosb/tag:gitforge" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitforge</span></a> out there. It follows a similar to <a href="/csantosb/tag:gitlab" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitlab</span></a> in its conception (pull requests and merge requests, you catch the idea ?). It also includes a <a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry" rel="nofollow">container registry</a>, and the set of features if offers may be exchanged with ease with any other <a href="/csantosb/tag:gitforge" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitforge</span></a> following the same paradigm. No need to go into more details. <br/>
There is a couple of interesting tips about using <a href="/csantosb/tag:github" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">github</span></a>, though. It happens more usually than not that users encounter frequently problems of <a href="/csantosb/tag:reproducibility" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reproducibility</span></a> when using container images hosted on <code>ghcr.io</code>, the hosting service for user images. These images are usually employed for running <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a> testing pipelines, and they <a href="https://github.com/stnolting/neorv32/issues/1116#issuecomment-2532796271" rel="nofollow">usually break</a> as upstream changes happen: updates, image definition changes, image packages upgrades, etc. If you read my <a href="https://infosec.press/csantosb/on-dependencies" rel="nofollow">dependencies hell</a> post, this should ring a bell. <br/>
What can be done about in what concerns <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> ? Well, we have <a href="/csantosb/tag:guix" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guix</span></a>. Let’s try a differente approach: building an image locally, and pushing it to <a href="/csantosb/tag:github" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">github</span></a> registry. Let’s see how. <br/></p>

<h2 id="in-practice">in practice</h2>

<p>An <a href="https://github.com/csantosb/hdl-image.git" rel="nofollow">example repository</a> shows tha way to proceed. Its contents allow to create a docker container image to be hosted remotely. It includes <a href="https://raw.githubusercontent.com/csantosb/hdl-image/refs/heads/master/manifest.scm" rel="nofollow">all that’s necessary</a> to perform remote <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a> testing of a <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> <a href="/csantosb/tag:vhdl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">vhdl</span></a> design. <br/></p>

<pre><code class="language-sh">docker pull ghcr.io/csantosb/hdl
docker images # check $ID
docker run -ti $ID bash
</code></pre>

<p>It includes a couple of <a href="/csantosb/tag:plaintext" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">plaintext</span></a> <a href="https://infosec.press/csantosb/guix-crash-course#manifest-channels" rel="nofollow">files</a> to produce a <a href="/csantosb/tag:deterministic" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">deterministic</span></a> container. First, the <a href="https://github.com/csantosb/hdl-image/blob/master/channels.scm" rel="nofollow">channels.scm</a> file with the list of guix chanels to use to pull packages from. Then, a <a href="https://github.com/csantosb/hdl-image/blob/master/manifest.scm" rel="nofollow">manifest.scm</a>, with the list of packages to be install within the container. <br/>
The image container may be <a href="https://git.sr.ht/~csantosb/hdl-image/tree/b1ab9a56802e56e3326c8985bd1b61c93173c5ab/readme.org#L3" rel="nofollow">build</a> with <br/></p>

<pre><code class="language-sh">image=$(guix time-machine --channels=channels.scm -- \
             pack -f docker \
             -S /bin=bin \
             --save-provenance \
             -m manifest.scm)
</code></pre>

<p>At this point, it is to be load to the docker store with <br/></p>

<pre><code class="language-sh">docker load &lt; $image
# docker images
</code></pre>

<p>Now it is time to tag the image <br/></p>

<pre><code class="language-sh">docker tag IMID ghcr.io/USER/REPO:RELEASE
</code></pre>

<p>and login to <code>ghcr.io</code> <br/></p>

<pre><code class="language-sh">docker login -u USER -p PASSWORD ghcr.io
</code></pre>

<p>Finally, the image is to be push remotely <br/></p>

<pre><code class="language-sh">docker push ghcr.io/USER/HDL:RELEASE
</code></pre>

<h2 id="test">test</h2>

<p>You’ll may test this image using the <a href="https://github.com/stnolting/neorv32" rel="nofollow">neorv32</a> project, for example, with: <br/></p>

<pre><code class="language-sh">docker pull ghcr.io/csantosb/hdl
docker run -ti ID bash
git clone --depth=1 https://github.com/stnolting/neorv32
cd neorv32
git clone --depth=1 https://github.com/stnolting/neorv32-vunit test
cd test
rm -rf neorv32
ln -sf ../../neorv32 neorv32
python3 sim/run.py --ci-mode -v
</code></pre>
]]></content:encoded>
      <guid>https://infosec.press/csantosb/ci-gitlab-hub</guid>
      <pubDate>Wed, 11 Dec 2024 12:50:04 +0000</pubDate>
    </item>
    <item>
      <title>ci (intro)</title>
      <link>https://infosec.press/csantosb/ci-intro</link>
      <description>&lt;![CDATA[img br/&#xA;How to seek, detect, be notified, analyze logs, understand and react to the different possible kind of issues one may encounter in a digital design is a vast topic of research, well beyond the scope of this modest post. But there are a couple of things we may state about here, though: automatizing issue detection is the way to go. Continuous integration (#ci) testing is a practice to adopt in #modernhw as a way to ensure that our design complies with its constraints. Let’s see this in more detail. !--more-- br/&#xA;&#xA;git&#xA;&#xA;We said #git, then, as mandatory when tracking changes (in documentation, project development, taking notes, etc.). Meaningful changes imply new commits (and good commit messages, for what it takes), but this comes along with a risk of introducing issues. Some kind of mechanism is necessary to automatize the execution of a checkout list to be run per new commit. The list is project aware, for sure, but may also be different following the git branch, and even the kind of commit (merges are to be considered differently to regular commits in topic branches, for example). We need to consider what an issue exactly is, and then you’ll need to adopt a different perspective on kinds of checkout lists. br/&#xA;&#xA;verification&#xA;&#xA;First (ideally), one starts with clear specifications about the goals of current development effort (in practice this never happens in research, and if you ever have it, they’ll evolve with time). These specifications (you’ll figure out where to find them somehow) will define the tests to run. For example, if you need to implement in firmware a deep neural network, you’ll probably have access to a test data set to verify the outcomes are correct. You may tune, improve or even completely change the architecture of your network, at the very end, you’ll have to verify your design with help of the test data set. Additionally, you may define more sophisticated tests: consumption, area, resources, etc. These all fall into the category of verification testing. br/&#xA;&#xA;unit tests&#xA;&#xA;Secondly, you’ll be running unit tests during your whole design cycle (and they’ll evolve along with it), and target tests (the one we mentioned just before). Does this addition perform correctly ? What if we stress a module with random inputs ? Are we going through all code in a given design unit ? Do we cover all values of some input/output signal in this important module ? These are all unit testing checkouts, and they’ll help us to detect issues in an early stage of design. br/&#xA;&#xA;codesign&#xA;&#xA;Codesign falls somewhere in between the two previous: as a testing methodology, it includes concepts of verification and unit testing (and can be combined with them). It is way more ambitious and complex, but also more powerful. No matter your testing strategy, the point here is that you’ll be running these tests (fully or partially) automatically at the several different stages of your development cycle. If they fail, you’ll have to be warned. br/&#xA;&#xA;guix&#xA;&#xA;img br/&#xA;Guix, as a package manager, provides all necessary software to deploy our tests (and can be extended with additional tooling). It also includes all that&#39;s necessary to create a running environment where we will execute our tests. Most importantly, #guix does so in a #deterministic and #reproductible way: we will be able to reproduce our tests in the future under exactly the same conditions. Shell containers, profiles and the time machine mechanism allow the degree of #reproducibility we need here. All it takes is a couple of text files. br/&#xA;&#xA;---&#xA;&#xA;Most usually, we will focus on two strategies to seek for issues: local, and remote. Local strategies are greatly based on git hooks, and will be topic of another post. Let’s see now in practice what can be done with help of remote tools, based on #ci, understood as a methodology consisting on automatically executing a set of tests procedures on a digital design. br/&#xA;ciseries br/]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/ci.png" alt="img"> <br/>
How to seek, detect, be notified, analyze logs, understand and react to the <a href="https://infosec.press/csantosb/on-testing" rel="nofollow">different possible kind of issues</a> one may encounter in a digital design is a vast topic of research, well beyond the scope of this modest post. But there are a couple of things we may state about here, though: automatizing issue detection is the way to go. <a href="https://en.wikipedia.org/wiki/Continuous_integration" rel="nofollow">Continuous integration</a> (<a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a>) testing is a practice to adopt in <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> as a way to ensure that our design complies with its constraints. Let’s see this in more detail.  <br/></p>

<h1 id="git">git</h1>

<p>We said <a href="/csantosb/tag:git" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">git</span></a>, then, as mandatory when <a href="https://infosec.press/csantosb/on-dependencies" rel="nofollow">tracking changes</a> (in documentation, project development, taking notes, etc.). Meaningful changes imply new commits (and good <a href="https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/" rel="nofollow">commit messages</a>, for what it takes), but this comes along with a risk of introducing issues. Some kind of mechanism is necessary to automatize the execution of a checkout list to be run per new commit. The list is project aware, for sure, but may also be different following the git branch, and even the kind of commit (merges are to be considered differently to regular commits in topic branches, for example). We need to consider what an issue exactly is, and then you’ll need to adopt a different perspective on kinds of checkout lists. <br/></p>

<h1 id="verification">verification</h1>

<p>First (ideally), one starts with clear specifications about the goals of current development effort (in practice this never happens in research, and if you ever have it, they’ll evolve with time). These specifications (you’ll figure out where to find them somehow) will define the tests to run. For example, if you need to implement in firmware a deep neural network, you’ll probably have access to a test data set to verify the outcomes are correct. You may tune, improve or even completely change the architecture of your network, at the very end, you’ll <a href="https://infosec.press/csantosb/on-testing#osvvm" rel="nofollow">have to verify your design</a> with help of the test data set. Additionally, you may define more sophisticated tests: consumption, area, resources, etc. These all fall into the category of <strong>verification testing</strong>. <br/></p>

<h1 id="unit-tests">unit tests</h1>

<p>Secondly, you’ll be running <a href="https://infosec.press/csantosb/on-testing#vunit" rel="nofollow">unit tests</a> during your whole design cycle (and they’ll evolve along with it), and target tests (the one we mentioned just before). Does this addition perform correctly ? What if we stress a module with random inputs ? Are we going through all code in a given design unit ? Do we cover all values of some input/output signal in this important module ? These are all <strong>unit testing</strong> checkouts, and they’ll help us to detect issues in an early stage of design. <br/></p>

<h1 id="codesign">codesign</h1>

<p><a href="https://infosec.press/csantosb/on-testing#cocotb" rel="nofollow">Codesign</a> falls somewhere in between the two previous: as a testing methodology, it includes concepts of verification and unit testing (and can be combined with them). It is way more ambitious and complex, but also more powerful. No matter your testing strategy, the point here is that you’ll be running these tests (fully or partially) automatically at the several different stages of your development cycle. If they fail, you’ll have to be warned. <br/></p>

<h1 id="guix">guix</h1>

<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/guix.png" alt="img"> <br/>
<a href="https://infosec.press/csantosb/use-guix" rel="nofollow">Guix</a>, as a package manager, provides all necessary software to deploy our tests (and can be <a href="https://infosec.press/csantosb/guix-channels" rel="nofollow">extended</a> with additional tooling). It also includes <a href="https://infosec.press/csantosb/guix-crash-course" rel="nofollow">all that&#39;s necessary</a> to create a running environment where we will execute our tests. Most importantly, <a href="/csantosb/tag:guix" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guix</span></a> does so in a <a href="/csantosb/tag:deterministic" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">deterministic</span></a> and <a href="/csantosb/tag:reproductible" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reproductible</span></a> way: we will be able to reproduce our tests in the future under exactly the same conditions. <a href="https://infosec.press/csantosb/guix-crash-course#shell-containers" rel="nofollow">Shell containers</a>, <a href="https://infosec.press/csantosb/guix-crash-course#profiles-and-generations" rel="nofollow">profiles</a> and the <a href="https://infosec.press/csantosb/guix-crash-course#time-machine" rel="nofollow">time machine mechanism</a> allow the degree of <a href="/csantosb/tag:reproducibility" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reproducibility</span></a> we need here. All it takes is <a href="https://infosec.press/csantosb/guix-crash-course#manifest-channels" rel="nofollow">a couple of text files</a>. <br/></p>

<hr>

<p>Most usually, we will focus on two strategies to seek for issues: local, and remote. Local strategies are greatly based on <a href="https://git-scm.com/book/ms/v2/Customizing-Git-Git-Hooks" rel="nofollow">git hooks</a>, and will be topic of another post. <a href="https://infosec.press/csantosb/tag:ciseries" rel="nofollow">Let’s see now in practice</a> what can be done with help of remote tools, based on <a href="/csantosb/tag:ci" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ci</span></a>, understood as a methodology consisting on automatically executing a set of tests procedures on a digital design. <br/>
<a href="/csantosb/tag:ciseries" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ciseries</span></a> <br/></p>
]]></content:encoded>
      <guid>https://infosec.press/csantosb/ci-intro</guid>
      <pubDate>Sun, 08 Dec 2024 21:19:43 +0000</pubDate>
    </item>
    <item>
      <title>guix channels</title>
      <link>https://infosec.press/csantosb/guix-channels</link>
      <description>&lt;![CDATA[img br/&#xA;guix includes the concept of channels, or git repositories of package definitions. This gives a chance for anyone to complete the collection of packages provided by the distribution, in case this is not enough. Keep reading for an intro on how to create your own channels, or how to use the most popular third party guix channels around. !--more-- br/&#xA;Guix itself only provides #freesoftware and #reproductible packages (no binary pre compiled blobs, then), which should be enough to most needs. Unfortunately, this is not always the case. Sometimes one needs to package #nonfree software including binary files to make work a graphic or network card, sometimes the source code of the compiler necessary to produce a package got lost somewhere in a dusty office, and cannot be found other than in a pre compiled form, impossible to bootstrap from its root. br/&#xA;Additionally, guix is not perfect (but getting closer). Even if becoming better thanks to contributions from the community, there are rough edges an lots of issues. One of the most frequent complaints is the time it takes for submitted patches to be review and accepted, if ever. This inconvenient is usually circunvented by creating a personal collection of package definitions. br/&#xA;In such situations, as in many others, package definitions may be written with help of the community (or using the guix packager !) and used normally, even if they have little chance to reach one day the main upstream guix repository (none in the case of nonfree stuff).  Where these definitions live ? In topic channels. Users have the possibility to develop their own channels and use custom packages, extending guix, while submitting patches upstream in parallel. Once the patch is merged, it may be removed from the channel. br/&#xA;&#xA;usual suspects&#xA;&#xA;Other than guix channel itself, you may have a feeling of what a guix channel looks like taking a look at the guix-science organization. In there, you’ll find collections of package definitions intended to be used in a context of specific research domains, both in its free and nonfree forms. For one reason or another, they have not their place in the main guix repository, and they live their life in here. Interesting enough, guix-past channel brings old-fashioned software to the present, which reveals useful to reproduce results older than guix itself. Another interesting examples are guixrus, by the ~whereiseveryone collective, providing packages not yet fully tested, nightly releases or alpha quality software; or the guix-hpc channel, with packages related to high performance computing; also guix-bioc, containing bioconductor packages, etc. You get the idea. br/&#xA;To include additional channels, other than the default ones, in your ~/.config/guix/channels.scm file, follow the documentation, and check with guix describe: you’ll get a list of all the channels in use next time you do a guix pull. At this point, you’ll have plenty of new packages to install at your hands ! Just remember the discussion about substitutes: some channels provide substitute servers, some not. This might be an issue, or not, depending of the computing resources necessary to build certain packages. br/&#xA;&#xA;your first personal channel&#xA;&#xA;Guix channels are simple to create and use. Just put your #guile modules, containing your package definitions, in a git repository. To use them, complete the default guix load path as in br/&#xA;&#xA;guix install -L ~/guix-channel PACKAGE&#xA;&#xA;You may opt to include this local channel into your ~/.config/guix/channels.scm file, or include the -L flag in your commands. As an alternative, guix searches for package definitions in the $GUIXPACKAGEPATH, so you may put your channel path in this variable. Remember that guix builds packages by compiling source code: no substitute server will do the job for you in this case, so plan accordingly with your local resources and patience. br/&#xA;&#xA;electronics channel&#xA;&#xA;This is about #modernhw after all, so let’s see an example more on detail, my own guix-electronics channel which complements the ./gnu/packages/electronics.scm guix module. This is the channel I’m using daily, where I include all the packages I need and doesn’t yet exist upstream. When they get merged somewhere else, I remove them from here. In the meantime, I’m a happy user of my custom packages. br/&#xA;I classify all my package definitions in #guile modules under ./electronics/packages/MODULE.scm. This is the reason why the compilers module, for example, starts by br/&#xA;&#xA;(define-module (electronics packages compilers)&#xA;&#xA;Then, proceed as usual (check the guix repo itself for inspiration), putting your packages below br/&#xA;&#xA;(define-public mypackage&#xA;  (package&#xA;    (name &#34;mypackage&#34;)&#xA;    ...&#xA;    ))&#xA;&#xA;I create a git repo, commit my changes and push it online to a #gitforge. br/&#xA;I need a .guix-channel file with the url of my channel and a version number. If the code in the channel depends on other channels other than main guix channel, one needs to specify this information in this file too.  In this case, for example, several of the package definitions include a dependency on ghdl-clang, provided by guix-science channel, so I need to declare it in here too. br/&#xA;It is also necessary a .guix-authorizations file, with the (GPG key) list of developers with right to push to this channel. This is how guix authenticates channels. Finally, it is important to create a readme file or similar where introduce the channel (first commit, signing key fingerprint). That’s it. Include the channel introduction into your ~/.config/guix/channels.scm file, and you’ll be pulling from your online guix channel. br/&#xA;&#xA;contributing&#xA;&#xA;The advantage of using a custom channel is to benefit from an increased degree of freedom when using guix, without being dependent of someone’s else time availability to consider your particular needs. Remember, guix is a huge project which follows closely the #freesoftware paradigm, and collaboration works in two directions. You take advantage of other developers contributions to guix, while you participate yourself to improving guix repositories with your package definitions, once they have been tested. br/&#xA;Take for example the list of packages in my electronics channel. I have included here utilities for #vhdl code editing under #emacs, specific to the electronic digital design field, which are not yet available in guix upstream channel. There is also a cosimulation library, #cocotb, which allows coupling #python and #ghdl to simulate a design. I have submitted a patch to include this in guix itself, similarly to python-vunit; once merged, I’ll remove them from here. br/&#xA;Some packages, like open fpga loader are now part of guix. Some others, like the gnat ada compiler and ghdl-clang stable have been merged already on guix-science, as gnat package is obtained from binaries (and so ghdl-clang is also impacted, from guix perspective). I include here a more recent ghdl-clang, non yet released, as it includes some fixes and improvements I am interested in, without having to wait until guix incorporates a new release. br/&#xA;Catch the idea ? br/&#xA;Contributing your code to guix comes to sending #email with your patches attached, it’s that simple. Dont be intimidated by the workflow (this is used by the linux project, for example). Once your patches are submitted, a review of your code folllows, see details. Some tools, like mumi, are helpful to that purpose. br/&#xA;These simple steps will allow you to start contributing to guix: br/&#xA;&#xA;git clone guix itselft br/&#xA;add and commit your changes, watch the commit message br/&#xA;don’t forget to use guix lint/style/refresh -l to check your code br/&#xA;use git send-email to create and send a patch br/&#xA;cosider reviews, if any, updating your patch accordingly with git ammend br/&#xA;resend a new patch including a patch version (v1, v2 ...) br/&#xA;&#xA;Interested ? Consult the doc for details, you’ll learn a lot about how to contribute to a common good and collaboration with other people. br/]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://git.sr.ht/~csantosb/csbwiki/blob/master/pics/guix-crash-course.png" alt="img"> <br/>
<a href="/csantosb/tag:guix" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guix</span></a> includes the concept of <a href="https://guix.gnu.org/manual/en/html_node/Channels.html" rel="nofollow">channels</a>, or git repositories of package definitions. This gives a chance for anyone to complete the collection of <a href="https://packages.guix.gnu.org/" rel="nofollow">packages</a> provided by the distribution, in case this is not enough. Keep reading for an intro on how to create your own channels, or how to use the most popular third party guix channels around.  <br/>
Guix itself only provides <a href="/csantosb/tag:freesoftware" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">freesoftware</span></a> and <a href="/csantosb/tag:reproductible" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">reproductible</span></a> packages (no binary pre compiled blobs, then), which should be enough to most needs. Unfortunately, this is not always the case. Sometimes one needs to package <a href="/csantosb/tag:nonfree" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">nonfree</span></a> software including binary files to make work a graphic or network card, sometimes the source code of the compiler necessary to produce a package got lost somewhere in a dusty office, and cannot be found other than in a pre compiled form, impossible to bootstrap from its root. <br/>
Additionally, guix is not perfect (but <a href="https://infosec.press/csantosb/guix-crash-course" rel="nofollow">getting closer</a>). Even if becoming better thanks to contributions from the <a href="https://guix.gnu.org/en/contact/" rel="nofollow">community</a>, there are rough edges an <a href="https://issues.guix.gnu.org/" rel="nofollow">lots of issues</a>. One of the most frequent complaints is the time it takes for submitted patches to be review and accepted, if ever. This inconvenient is usually circunvented by creating a personal collection of package definitions. <br/>
In such situations, as in many others, package definitions may be written with help of the community (or using the <a href="https://guix-hpc.gitlabpages.inria.fr/guix-packager/" rel="nofollow">guix packager</a> !) and used normally, even if they have little chance to reach one day the main upstream guix repository (none in the case of nonfree stuff).  Where these definitions live ? In topic channels. Users have the possibility to develop their own channels and use custom packages, extending guix, while <a href="https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html" rel="nofollow">submitting patches upstream</a> in parallel. Once the patch is merged, it may be removed from the channel. <br/></p>

<h1 id="usual-suspects">usual suspects</h1>

<p>Other than <a href="https://hpc.guix.info/channel/guix" rel="nofollow">guix channel</a> itself, you may have a feeling of what a guix channel looks like taking a look at the <a href="https://codeberg.org/guix-science" rel="nofollow">guix-science</a> organization. In there, you’ll find collections of package definitions intended to be used in a context of specific research domains, both in its <a href="https://codeberg.org/guix-science/guix-science" rel="nofollow">free</a> and <a href="https://codeberg.org/guix-science/guix-science-nonfree" rel="nofollow">nonfree</a> forms. For one reason or another, they have not their place in the main guix repository, and they live their life in here. Interesting enough, <a href="https://codeberg.org/guix-science/guix-past" rel="nofollow">guix-past</a> channel brings old-fashioned software to the present, which reveals useful to reproduce results older than guix itself. Another interesting examples are <a href="https://sr.ht/~whereiseveryone/guixrus/" rel="nofollow">guixrus</a>, by the <a href="https://sr.ht/~whereiseveryone/" rel="nofollow">~whereiseveryone</a> collective, providing packages not yet fully tested, nightly releases or alpha quality software; or the <a href="https://hpc.guix.info/channel/guix-hpc" rel="nofollow">guix-hpc</a> channel, with packages related to high performance computing; also <a href="https://hpc.guix.info/channel/guix-bioc" rel="nofollow">guix-bioc</a>, containing bioconductor packages, etc. You get the idea. <br/>
To include additional channels, other than the default ones, in your <code>~/.config/guix/channels.scm</code> file, follow the <a href="https://guix.gnu.org/manual/en/html_node/Specifying-Additional-Channels.html" rel="nofollow">documentation</a>, and check with <code>guix describe</code>: you’ll get a list of all the channels in use next time you do a <code>guix pull</code>. At this point, you’ll have plenty of new packages to install at your hands ! Just remember the <a href="https://infosec.press/csantosb/guix-crash-course#packages" rel="nofollow">discussion</a> about substitutes: some channels provide substitute servers, some not. This might be an issue, or not, depending of the computing resources necessary to build certain packages. <br/></p>

<h1 id="your-first-personal-channel">your first personal channel</h1>

<p>Guix channels are <a href="https://guix.gnu.org/cookbook/en/html_node/Channels.html" rel="nofollow">simple to create</a> and use. Just put your <a href="/csantosb/tag:guile" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guile</span></a> modules, containing your package definitions, in a git repository. To use them, complete the default guix load path as in <br/></p>

<pre><code class="language-sh">guix install -L ~/guix-channel PACKAGE
</code></pre>

<p>You may opt to include this local channel into your <code>~/.config/guix/channels.scm</code> file, or include the <code>-L</code> flag in your commands. As an alternative, guix searches for package definitions in the <code>$GUIX_PACKAGE_PATH</code>, so you may put your channel path in this variable. Remember that guix builds packages by compiling source code: no substitute server will do the job for you in this case, so plan accordingly with your local resources and patience. <br/></p>

<h1 id="electronics-channel">electronics channel</h1>

<p>This is about <a href="/csantosb/tag:modernhw" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">modernhw</span></a> after all, so let’s see an example more on detail, my own <a href="https://git.sr.ht/~csantosb/guix.channel-electronics" rel="nofollow">guix-electronics</a> channel which complements the <a href="https://codeberg.org/guix/guix/src/master/gnu/packages/electronics.scm" rel="nofollow">./gnu/packages/electronics.scm</a> guix module. This is the channel I’m using daily, where I include all the packages I need and doesn’t yet exist upstream. When they <a href="https://codeberg.org/csantosb/guix-science/commit/d33b748" rel="nofollow">get merged somewhere else</a>, I remove them from here. In the meantime, I’m a happy user of my custom packages. <br/>
I classify all my package definitions in <a href="/csantosb/tag:guile" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">guile</span></a> modules under <code>./electronics/packages/MODULE.scm</code>. This is the reason why the compilers module, for example, <a href="https://git.sr.ht/~csantosb/guix.channel-electronics/tree/main/electronics/packages/compilers.scm#L20" rel="nofollow">starts by</a> <br/></p>

<pre><code class="language-scheme">(define-module (electronics packages compilers)
</code></pre>

<p>Then, proceed as usual (check the guix repo itself for inspiration), putting your packages below <br/></p>

<pre><code class="language-scheme">(define-public mypackage
  (package
    (name &#34;mypackage&#34;)
    ...
    ))
</code></pre>

<p>I create a git repo, commit my changes and push it online to a <a href="/csantosb/tag:gitforge" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">gitforge</span></a>. <br/>
I need a <code>.guix-channel</code> <a href="https://git.sr.ht/~csantosb/guix.channel-electronics/tree/main/.guix-channel" rel="nofollow">file</a> with the url of my channel and a version number. If the code in the channel <a href="https://guix.gnu.org/manual/en/html_node/Declaring-Channel-Dependencies.html" rel="nofollow">depends on other channels</a> other than main guix channel, one needs to specify this information in this file too.  In this case, for example, several of the package definitions include a dependency on <code>ghdl-clang</code>, provided by <code>guix-science</code> channel, so I need to declare it in here too. <br/>
It is also necessary a <code>.guix-authorizations</code> <a href="https://git.sr.ht/~csantosb/guix.channel-electronics/tree/main/.guix-authorizations" rel="nofollow">file</a>, with the (GPG key) list of developers <a href="https://guix.gnu.org/manual/en/html_node/Specifying-Channel-Authorizations.html" rel="nofollow">with right to push to this channel</a>. This is how guix <a href="https://guix.gnu.org/manual/en/html_node/Channel-Authentication.html" rel="nofollow">authenticates</a> channels. Finally, it is important to create a <a href="https://git.sr.ht/~csantosb/guix.channel-electronics/tree/main/readme.org#L50" rel="nofollow">readme</a> file or similar where introduce the channel (first commit, signing key fingerprint). That’s it. Include the channel introduction into your <code>~/.config/guix/channels.scm</code> file, and you’ll be pulling from your online guix channel. <br/></p>

<h1 id="contributing">contributing</h1>

<p>The advantage of using a custom channel is to benefit from an increased degree of freedom when using guix, without being dependent of someone’s else time availability to consider your particular needs. Remember, guix is a huge project which follows closely the <a href="/csantosb/tag:freesoftware" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">freesoftware</span></a> paradigm, and collaboration works in two directions. You take advantage of other developers contributions to guix, while you participate yourself to improving guix repositories with your package definitions, once they have been tested. <br/>
Take for example the list of <a href="https://gitlab.com/csantosb/guix/channel-electronics/-/blob/main/packages.org" rel="nofollow">packages</a> in my electronics channel. I have included here utilities for <a href="/csantosb/tag:vhdl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">vhdl</span></a> code editing under <a href="/csantosb/tag:emacs" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">emacs</span></a>, specific to the electronic digital design field, which are not yet available in guix upstream channel. There is also a cosimulation library, <a href="/csantosb/tag:cocotb" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">cocotb</span></a>, which allows coupling <a href="/csantosb/tag:python" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">python</span></a> and <a href="/csantosb/tag:ghdl" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ghdl</span></a> to simulate a design. I have submitted a <a href="https://issues.guix.gnu.org/68153" rel="nofollow">patch</a> to include this in guix itself, similarly to <a href="https://issues.guix.gnu.org/74242" rel="nofollow">python-vunit</a>; once merged, I’ll remove them from here. <br/>
Some packages, like <a href="https://git.savannah.gnu.org/cgit/guix.git/commit/?id=9fb7333fc9" rel="nofollow">open fpga loader</a> are now part of guix. Some others, like the <a href="https://codeberg.org/guix-science/guix-science/pulls/46" rel="nofollow">gnat ada compiler</a> and <code>ghdl-clang</code> stable have been merged already on <code>guix-science</code>, as <code>gnat</code> package is obtained from binaries (and so <code>ghdl-clang</code> is also impacted, from guix perspective). I include here a more recent <code>ghdl-clang</code>, non yet released, as it includes some fixes and improvements I am interested in, without having to wait until guix incorporates a new release. <br/>
Catch the idea ? <br/>
<a href="https://guix.gnu.org/manual/en/html_node/Contributing.html" rel="nofollow">Contributing</a> your code to guix comes to <a href="https://git-send-email.io/" rel="nofollow">sending <a href="/csantosb/tag:email" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">email</span></a></a> <a href="https://www.futurile.net/2022/03/07/git-patches-email-workflow/" rel="nofollow">with your patches</a> attached, it’s that simple. Dont be intimidated by the workflow (this is used by the linux project, for example). Once your patches are submitted, a review of your code folllows, see <a href="https://libreplanet.org/wiki?title=Group:Guix/PatchReviewSessions2024" rel="nofollow">details</a>. Some tools, like <a href="https://www.youtube.com/watch?v=8m8igXrKaqU" rel="nofollow">mumi</a>, are helpful to that purpose. <br/>
These simple steps will allow you to start contributing to guix: <br/></p>
<ul><li>git clone guix itselft <br/></li>
<li>add and commit your changes, watch the commit message <br/></li>
<li>don’t forget to use <code>guix lint/style/refresh -l</code> to check your code <br/></li>
<li>use <code>git send-email</code> to create and send a patch <br/></li>
<li>cosider reviews, if any, updating your patch accordingly with <code>git ammend</code> <br/></li>
<li>resend a new patch including a patch version (v1, v2 ...) <br/></li></ul>

<p>Interested ? Consult <a href="https://guix.gnu.org/manual/en/html_node/Contributing.html" rel="nofollow">the doc</a> for details, you’ll learn a lot about how to contribute to a common good and collaboration with other people. <br/></p>
]]></content:encoded>
      <guid>https://infosec.press/csantosb/guix-channels</guid>
      <pubDate>Tue, 31 Jan 2023 23:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>