<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Snamellit - linux</title>
      <link>https://www.snamellit.com</link>
      <description></description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://www.snamellit.com/tags/linux/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Fri, 09 Oct 2026 00:00:00 +0000</lastBuildDate>
      <item>
          <title>Measuring CI budgets with Guix and Grafana before setting quotas</title>
          <pubDate>Fri, 09 Oct 2026 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/measuring-ci-budgets-with-guix-and-grafana/</link>
          <guid>https://www.snamellit.com/posts/measuring-ci-budgets-with-guix-and-grafana/</guid>
          <description xml:base="https://www.snamellit.com/posts/measuring-ci-budgets-with-guix-and-grafana/">&lt;p&gt;Emma does several jobs for me. It runs &lt;a href=&quot;/posts/deploying-cuirass-on-guixsd/&quot;&gt;Cuirass&lt;/a&gt; for Guix builds and a Forgejo Actions runner, and I would like to add more services without discovering too late that CI ate the machine. My first instinct was to give each workload a quota: 11 GiB and four CPU cores for builds, 2 GiB and one core for the runner. Those are useful planning numbers, but applying them before measuring the jobs would have been guesswork.&lt;/p&gt;
&lt;p&gt;So this is the &lt;em&gt;measurement&lt;/em&gt; stage of setting a quota. The numbers appear as lines in Grafana; they are &lt;strong&gt;not&lt;/strong&gt; &lt;code&gt;memory.max&lt;/code&gt;, &lt;code&gt;memory.high&lt;/code&gt; or &lt;code&gt;cpu.max&lt;/code&gt;. A graph can show that a workload crossed a line without throttling or killing it. I will only consider limits after watching real, overlapping jobs, checking the host&#39;s spare capacity and comparing CI completion times.&lt;/p&gt;
&lt;h2 id=&quot;guix-owns-the-layout&quot;&gt;Guix owns the layout&lt;/h2&gt;
&lt;p&gt;Emma runs Guix System, so I put the plumbing in its &lt;code&gt;machines/emma/system.scm&lt;/code&gt; configuration rather than relying on a script somebody has to remember to rerun after a reboot. A one-shot Shepherd service prepares these cgroup-v2 paths:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/sys/fs/cgroup/emma/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── ci-builds/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   ├── cuirass/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;│   └── guix-daemon/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── emma-runner/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ├── runner/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    └── podman/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Its Python helper, &lt;code&gt;workload_cgroups.py&lt;/code&gt;, checks that the &lt;code&gt;cpu&lt;/code&gt;, &lt;code&gt;memory&lt;/code&gt; and &lt;code&gt;io&lt;/code&gt; controllers are available, enables them on the parents and creates the leaves. It is idempotent and refuses to proceed if the required controllers are missing. The Cuirass and Guix-daemon leaves stay root-owned; only the runner&#39;s own leaves are delegated to its service account. PostgreSQL and host-management processes do not belong to either workload.&lt;/p&gt;
&lt;p&gt;In Scheme, the dependency is explicit. The service graph requires the layout before the daemons can be started:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;define&lt;/span&gt;&lt;span&gt; %emma-cgroup-layout&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  (&lt;/span&gt;&lt;span&gt;shepherd-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    (&lt;/span&gt;&lt;span&gt;provision &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;emma-cgroup-layout&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    (&lt;/span&gt;&lt;span&gt;requirement &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;user-processes cgroups2-fs-owner&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   file-system-/sys/fs/cgroup&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    (&lt;/span&gt;&lt;span&gt;one-shot? &lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;#t&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    (&lt;/span&gt;&lt;span&gt;start #~&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;make-forkexec-constructor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span&gt; #$&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;file-append python &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/bin/python3&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                     #$&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;local-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;workload_cgroups.py&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;    (&lt;/span&gt;&lt;span&gt;stop #~&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;make-kill-destructor&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;simple-service &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;emma-cgroup-layout&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                shepherd-root-service-type&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;                (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span&gt; %emma-cgroup-layout&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That &lt;code&gt;local-file&lt;/code&gt; matters. The helper becomes part of the system build, tied to the configuration generation. The service definitions and the private Guix channel supplying the launchers are versioned together. A deployment can be built and checked before switching the running host, and the previous system generation remains a separate rollback path from Git.&lt;/p&gt;
&lt;h2 id=&quot;put-processes-in-the-group-before-they-drop-privileges&quot;&gt;Put processes in the group before they drop privileges&lt;/h2&gt;
&lt;p&gt;Creating a cgroup is easy. Accounting for the &lt;em&gt;actual descendants&lt;/em&gt; is harder. Moving a running service supervisor into a group later can miss children it has already launched. The Guix channel therefore supplies a &lt;code&gt;cgroup-launch-overlay&lt;/code&gt;: a file-like package tree that preserves the original package but replaces one executable with an &lt;code&gt;exec&lt;/code&gt;-in-place launcher. The launcher writes its own PID to the leaf&#39;s &lt;code&gt;cgroup.procs&lt;/code&gt;, drops to the normal service account where needed, then executes the original daemon. If placement fails, the service does not silently run outside accounting.&lt;/p&gt;
&lt;p&gt;This ordering caught a real bug in the first draft. The normal Cuirass Shepherd start dropped to &lt;code&gt;cuirass&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; my wrapper tried to enter its root-owned leaf. It failed with &lt;code&gt;Permission denied&lt;/code&gt;. I adapted the Cuirass service type&#39;s two Shepherd starts instead, keeping the upstream account, activation sockets and other service extensions while entering the group as root and switching back to &lt;code&gt;cuirass&lt;/code&gt; before executing the daemon. The shared Guix daemon has its own leaf because builds it starts cannot honestly be counted as Cuirass-only work.&lt;/p&gt;
&lt;p&gt;The Forgejo runner has a separate leaf for host-mode jobs, and its rootless Podman socket service has another. The runner depends on the Podman socket and on &lt;code&gt;emma-cgroup-layout&lt;/code&gt;. Having the socket daemon in the right group is not proof that a container process lands there; descendant placement needs to be checked during a real container job.&lt;/p&gt;
&lt;h2 id=&quot;from-sys-fs-cgroup-to-grafana&quot;&gt;From &lt;code&gt;/sys/fs/cgroup&lt;/code&gt; to Grafana&lt;/h2&gt;
&lt;p&gt;A second Python helper reads each &lt;em&gt;parent&lt;/em&gt; group&#39;s &lt;code&gt;memory.current&lt;/code&gt;, &lt;code&gt;memory.swap.current&lt;/code&gt;, &lt;code&gt;cpu.stat&lt;/code&gt;, &lt;code&gt;memory.events&lt;/code&gt; and &lt;code&gt;io.stat&lt;/code&gt;. Parent counters include their descendant leaves. Guix installs an mcron job that runs the collector every minute and atomically replaces a &lt;code&gt;.prom&lt;/code&gt; file in node exporter&#39;s textfile directory:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;define&lt;/span&gt;&lt;span&gt; %emma-workload-job&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #~&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;job &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;next-minute &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;range &lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;0 60&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;         (&lt;/span&gt;&lt;span&gt;string-append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          #$&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;file-append python &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/bin/python3&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;) &amp;quot; &amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          #$&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;local-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;workload_metrics.py&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;          &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --output /var/lib/prometheus/node-exporter/emma-workloads.prom&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;          &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --group ci-builds=emma/ci-builds&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;          &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --budget ci-builds=11,4&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;          &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --group emma-runner=emma/emma-runner&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;          &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --budget emma-runner=2,1&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The budget pairs mean GiB and CPU cores. The collector exports &lt;code&gt;emma_workload_budget_memory_bytes&lt;/code&gt; and &lt;code&gt;emma_workload_budget_cpu_cores&lt;/code&gt; as &lt;em&gt;reference gauges&lt;/em&gt;, alongside measured memory, swap, CPU time, throttling, OOM events and I/O bytes. It also emits &lt;code&gt;emma_workload_present&lt;/code&gt; and a collection timestamp. An incomplete or missing group gets &lt;code&gt;present=0&lt;/code&gt; &lt;strong&gt;without invented usage samples&lt;/strong&gt;. Node exporter exposes the textfile, Prometheus scrapes it, and Grafana reads Prometheus; Grafana does not create or enforce any quota. This follows node exporter&#39;s &lt;a rel=&quot;external&quot; href=&quot;https://github.com/prometheus/node_exporter#textfile-collector&quot;&gt;textfile-collector pattern&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I use the existing &lt;strong&gt;Emma Capacity &amp;amp; Budgets&lt;/strong&gt; dashboard. Here are its two workload panels from a live, two-hour Grafana view on 9 October 2026. The screenshot shows the &lt;code&gt;ci-builds&lt;/code&gt; CPU curve crossing its four-core planning line. That is an observation, not throttling or evidence that a quota has been applied. The capture predates the completed 24-hour review.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/emma-grafana-workload-budgets-2026-10-09.png&quot; alt=&quot;Two Grafana panels showing Emma workload memory and CPU measurements beside planning lines for ci-builds and emma-runner&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The memory panel plots actual usage and the planning line for each workload:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;emma_workload_memory_bytes{machine=&amp;quot;emma&amp;quot;,workload=~&amp;quot;ci-builds|emma-runner&amp;quot;} / 1024^3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;emma_workload_budget_memory_bytes{machine=&amp;quot;emma&amp;quot;,workload=~&amp;quot;ci-builds|emma-runner&amp;quot;} / 1024^3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The CPU panel uses a five-minute rate against the core budget:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rate(emma_workload_cpu_seconds_total{machine=&amp;quot;emma&amp;quot;,workload=~&amp;quot;ci-builds|emma-runner&amp;quot;}[5m])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;emma_workload_budget_cpu_cores{machine=&amp;quot;emma&amp;quot;,workload=~&amp;quot;ci-builds|emma-runner&amp;quot;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Those are two Grafana queries per time-series panel, not a command that installs limits. I keep the host&#39;s available memory, root disk space, CPU execution versus I/O wait and OOM/swap activity alongside them. The coverage stat reads &lt;code&gt;emma_workload_present&lt;/code&gt;; a missing series is &lt;em&gt;No data&lt;/em&gt;, not zero usage. The dashboard was designed before the exporter existed and still contains some &quot;proposed / not yet verified&quot; explanatory text. Some per-workload curves are now live, but that text should only be revised once completed jobs and descendants have been checked. Until then, a pretty plot is not proof of correct attribution.&lt;/p&gt;
&lt;h2 id=&quot;rollout-not-just-reconfigure&quot;&gt;Rollout, not just reconfigure&lt;/h2&gt;
&lt;p&gt;I tested the layout and launch ordering in a disposable, network-disabled Guix VM. A read-only-store VM was enough to check placement but could not run an actual Cuirass register that wrote to the store, so I repeated that check with a guest-owned writable QCOW2 store. Both real Cuirass daemons then ran as &lt;code&gt;cuirass&lt;/code&gt; in the intended leaf. That still was not a representative online build.&lt;/p&gt;
&lt;p&gt;For Emma itself, I reviewed the channel and system changes on separate Git branches, ran the service regression check and &lt;code&gt;guix system shepherd-graph&lt;/code&gt;, and dry-ran the system build. A full build on Emma used one build job and one core after an earlier attempt ran into memory pressure. Only then did an operator reconfigure the host and, later, perform a normal reboot with the previous generation available at the console. After restarting the affected services, I checked actual PIDs in &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/cgroup&lt;/code&gt;, the collector file and successive healthy Prometheus scrapes. The post-boot 24-hour observation began on 9 October 2026 at 14:39 UTC, &lt;em&gt;after&lt;/em&gt; those checks.&lt;/p&gt;
&lt;p&gt;That reboot exposed a separate loose end: Cuirass, the runner, its Podman socket, git-pages and node exporter did not all start unattended. We brought them up manually. A Tailscale-address race might explain some listeners, but it does not explain every stopped CI service; the boot logs still need investigation. Manual recovery is not a successful boot test.&lt;/p&gt;
&lt;p&gt;The next pass is to match the curves against completed Cuirass builds and Forgejo jobs (including container descendants), inspect the same-window service logs and compare job duration with a baseline. The shared Guix daemon&#39;s counters measure &lt;em&gt;all&lt;/em&gt; its clients, not just Cuirass. Until that work is done, I have a useful accounting experiment and a rollback path, not a safe quota recommendation.&lt;/p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https://guix.gnu.org/manual/en/html_node/Invoking-guix-system.html&quot;&gt;Guix system manual&lt;/a&gt; covers generations and reconfiguration; the &lt;a rel=&quot;external&quot; href=&quot;https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html&quot;&gt;kernel cgroup-v2 documentation&lt;/a&gt; explains the counter and control files. Grafana&#39;s &lt;a rel=&quot;external&quot; href=&quot;https://grafana.com/docs/grafana/latest/visualizations/&quot;&gt;visualization documentation&lt;/a&gt; covers building panels from Prometheus queries.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Install GUIX on Macbook 12</title>
          <pubDate>Fri, 20 Mar 2026 11:01:00 +0100</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20260320t110150-install-guix-on-macbook-12-guix-linux-sysadmin/</link>
          <guid>https://www.snamellit.com/posts/20260320t110150-install-guix-on-macbook-12-guix-linux-sysadmin/</guid>
          <description xml:base="https://www.snamellit.com/posts/20260320t110150-install-guix-on-macbook-12-guix-linux-sysadmin/">&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;/h2&gt;
&lt;p&gt;I have an old Intel macbook 12 of begin 2016, one of the so-called
&quot;Retina Macbooks&quot;. It is an ideal couch device but far too slow to run
modern OS-X, provided you wanted to run that to begin with.&lt;/p&gt;
&lt;p&gt;I wanted to revive this machine to avoid lugging the BIG laptop,
especially for the friday SystemCrafters stream in my comfy chair in
the living.&lt;/p&gt;
&lt;p&gt;I saw some experience reports with Ubuntu, which worked, but then I
never used it because Ubuntu is, well it is Ok, there is nothing wrong
with it... Gnome works fine, KDE worked fine, it is just all different
from my usual Arch/Guix machines for little added benefit.&lt;/p&gt;
&lt;p&gt;Because I was curious about immutable distros and leveraging
containers like toolbox/flatpak I installed Fedora Silverblue. Again
it is fine, Gnome is really luxurious on this machine. It all works
well, but again different. Distributing the software between immutable
host (which you have to reboot to make packages appear  after
install), flatpaks and toolbox containers works fine again, but
inevitably causes friction when crossing the domains,
e.g. Emacs. Nothing insurmountable. Also I am not impresssed by
toolbox, it is simple, but it does nothing that distrobox does not
seem to do better, while being less tied to the OS. I am not a fan of
the dev container workflow, and Fedora Silverblue didn&#39;t sell it to
me. Again in large deployments the balance might be different.&lt;/p&gt;
&lt;p&gt;AFAICT Guix offers (almost) the same immutability features and
drawbacks but less pronounced. i.e. you do not have to reboot to make
host software available in most cases. The diffferent profiles allow
much more granular control with several half-way points to find the
right balance of reproducability and creature comfort. Of course this
is also means more opportunity to let it run out of control and create
a confusing mess. In any case I can leverage the GUIX configuration of
my servers and big laptop and ensure a consistent experience if I can
get it on the lil&#39; macbook and liberate it to fight another day.&lt;/p&gt;
&lt;h2 id=&quot;installation-process&quot;&gt;Installation Process&lt;/h2&gt;
&lt;p&gt;Installing Ubuntu and Silverblue learned me that there is nothing
specially difficult for the intel mac. It kinda just works with some
small caveats.&lt;/p&gt;
&lt;p&gt;A quick hardware check shows a BCM4350 wireless network adapter which
is not on the open hardware list AFAIK, and since the laptop needs to
do laptop duty and has only a single USB-C port WiFi is the only way
to get something in and out of it. Intel graphics should not be a
problem. An intel soundchip. Some Apple NVMe controller (foreshadowing)&lt;/p&gt;
&lt;p&gt;So we probably need the nonguix version to support the firmware blobs.&lt;/p&gt;
&lt;h3 id=&quot;creating-installation-media&quot;&gt;Creating Installation Media&lt;/h3&gt;
&lt;p&gt;Check out on your local friendly Guix enabled device, a foreign
install is fine, checkout the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/SystemCrafters/guix-installer/releases/tag/v202503220148&quot;&gt;SystemCrafters Guix Installer Repo&lt;/a&gt;. In
the root of the project is a script &lt;code&gt;build.iso&lt;/code&gt;. Run it and have a
walk outside or something. It takes a while. If you have no Guix
enabled machine yet, you can download the last released version, which
is over a year old, so the first &lt;code&gt;guix pull&lt;/code&gt; on the macbook will be
epic... .&lt;/p&gt;
&lt;p&gt;You&#39;ll end up with a file &lt;code&gt;guix-installer-202603162333.iso&lt;/code&gt; with of
course a probably newer timestamp is spacetime is behaving
consistently in your locati
This can be written to a thumb drive. Ensure you check with &lt;code&gt;dmesg -w&lt;/code&gt;
which device the USB stick uses. On insertion you&#39;ll see&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo dmesg -w&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; lots of lines skipped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308042.889695&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: new high-speed USB device number 12 using xhci_hcd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.000238&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: New USB device found, idVendor&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;0781,&lt;/span&gt;&lt;span&gt; idProduct&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;5572,&lt;/span&gt;&lt;span&gt; bcdDevice&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; 1.00&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.000242&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: New USB device strings: Mfr&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;1,&lt;/span&gt;&lt;span&gt; Product&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;2,&lt;/span&gt;&lt;span&gt; SerialNumber&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.000244&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: Product: Cruzer Switch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.000246&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: Manufacturer: SanDisk&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.000247&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb 1-4.3.2: SerialNumber: 4C530001061011107340&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.038906&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usb-storage 1-4.3.2:1.0: USB Mass Storage device detected&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.039031&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; scsi host2: usb-storage 1-4.3.2:1.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.039112&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usbcore: registered new interface driver usb-storage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308043.042575&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; usbcore: registered new interface driver uas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308044.049756&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer Switch    1.00 PQ: 0 ANSI: 6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308044.055625&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; sd 2:0:0:0: &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;sda&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; 62521344 512-byte logical blocks: (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;32.0&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; GB/29.8 GiB&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308044.056787&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; sd 2:0:0:0: &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;sda&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; Write Protect is off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308044.056790&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; sd 2:0:0:0: &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;sda&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; Mode Sense: 43 00 00 00&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;308044.057159&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; sd 2:0:0:0: &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;[&lt;/span&gt;&lt;span&gt;sda&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;]&lt;/span&gt;&lt;span&gt; Write cache: disabled, read cache: enabled, doesn&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;t support DPO or FUA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;[308044.093399]  sda: sda1 sda2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;[308044.093545] sd 2:0:0:0: [sda] Attached SCSI removable disk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &#39;[sda]&#39; on the last lines shows that the USB is now available as
&lt;code&gt;/dev/sda&lt;/code&gt;. Be careful as using your current harddisk by accident will
cause an unscheduled backup/restore excercise. To be safe make sure
you use the data which appeared on screen when inserting the
drive. Pull it out and insert it again to be sure.&lt;/p&gt;
&lt;p&gt;Also don&#39;t mount/open it if your smart desktop assistent comes asking
helpfully. It only makes things slower and more complicated.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo dd if=guix-installer-202603162333.iso of=/dev/sda bs=1M&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sync&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;bs=1M&lt;/code&gt; is to speed things up otherwise it takes forever. Value is
not critical but this is easy to type and _reasonable_™.&lt;/p&gt;
&lt;p&gt;This will probably take a &lt;span class=&quot;underline&quot;&gt;refill coffee&lt;/span&gt; amount of time to
complete. The `sync` should ensure the buffers are written before
unplugging the device.&lt;/p&gt;
&lt;h3 id=&quot;installation-process&quot;&gt;Installation Process&lt;/h3&gt;
&lt;p&gt;One of the biggest challenges to start the installation process is to
build a Jenga tower of USB dongles to ensure you can power the macbook
and insert the USB stick. This device only has a single USB-C port, it
dislikes thunderbolt docks or even many USB-C docks. I used a
Steamdeck dock. In practice I assume most of the cheap USB extender
dongles will do it, however I had to experiment before it worked.&lt;/p&gt;
&lt;p&gt;You can probably install the OS on whatever capacity is remaining
after all this time, but I would not rely on it and I would not want
to do the crypto setup of the disks with the battery draining like a
&lt;a rel=&quot;external&quot; href=&quot;https://youtu.be/DoQwKe0lggw&quot;&gt;James Bond Villain Death Trap&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I installed it a few times. First without disk encryption. Worked
fine. You follow the prompts.&lt;/p&gt;
&lt;p&gt;Then with disk encryption. Worked fine.&lt;/p&gt;
&lt;p&gt;I choose separate volumes for &lt;code&gt;root&lt;/code&gt; and &lt;code&gt;home&lt;/code&gt; formatted in ext4. When encrypting the
volumes using LUKS we now get an interesting issue. During boot up we
are asked 4 times to unlock the drives. Also once we selected the
image to boot in Grub the kernel will ask to unlock the disks, but the
internal laptop keyboard does not work. This can be solved by adding a
USB keyboard to your Jenga Tower and unlock the drives. This get tired
really quickly. For installation it is not a blocker so we plod on.&lt;/p&gt;
&lt;p&gt;Also at some point the graphical installer decide that black is the
new orange and show nothing else than that. However the manual
installer is well documented.&lt;/p&gt;
&lt;p&gt;Also the installation process for GUIXSD is far less important than
for other distros as you can completely control the OS using `guix
system reconfigure`. So if you can boot in a terminal and get on your
network you&#39;re golden.&lt;/p&gt;
&lt;h3 id=&quot;crypto-setup&quot;&gt;Crypto Setup&lt;/h3&gt;
&lt;p&gt;I am going to forget the keyboard issue for now and deal with the
passwords. Because if that is fixed the keyboard does not matter
anymore as once the kernel is fully started it works again.&lt;/p&gt;
&lt;p&gt;If you followed along the installer will already have created the
partitioning and LUKS encryption of the volumes. We can use a keyfile
to unlock the partitions but we have to make sure the keyfile is not
exposed on an unencrypted volume. Some people suggest a keyfile on a
USB stick but this is not very practical on this device (think Jenga
tower).&lt;/p&gt;
&lt;p&gt;There is no way to pass secrets from Grub to the booting
kernel. However we have access to files in the initial ramdisk. The
GUIX bootloader configuration has the &lt;code&gt;extra-initrd&lt;/code&gt; option which was
originally added for this very purpose and adding the keyfile is
explained there.&lt;/p&gt;
&lt;p&gt;So the plan is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;add a key from a keyfile to a slot in the LUKS partitions&lt;/li&gt;
&lt;li&gt;wrap the keyfile in a cpio image to merge to the initial ramdisk&lt;/li&gt;
&lt;li&gt;configure the mapped devices to use this keyfile&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;add-keyfile-to-initrd&quot;&gt;add keyfile to initrd&lt;/h4&gt;
&lt;p&gt;I created a random file&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; dd if=/dev/urandom of=/keyfile.bin bs=&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; count=&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;512&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; chmod&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 0400&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /keyfile.bin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; echo /key-file.bin&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; cpio&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -oH newc&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.cpio&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; chmod&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 0000&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /keyfile.cpio&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;add the keyfile as a key to the LUKS partitions.&lt;/p&gt;
&lt;p&gt;Update &lt;code&gt;/etc/config.scm&lt;/code&gt; to add the &lt;code&gt;extra-initrd&lt;/code&gt; option to make the file
accessible during early boot.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;bootloader &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;bootloader-configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               (&lt;/span&gt;&lt;span&gt;bootloader grub-efi-bootloader&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               (&lt;/span&gt;&lt;span&gt;targets &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/boot/efi&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               (&lt;/span&gt;&lt;span&gt;keyboard-layout keyboard-layout&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	              (&lt;/span&gt;&lt;span&gt;extra-initrd &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.cpio&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&quot;tell-kernel-to-use-the-keyfile&quot;&gt;Tell kernel to use the keyfile&lt;/h4&gt;
&lt;p&gt;To configure the kernel to use the keyfile instead of asking for a
password, we have to add the &lt;code&gt;#:key-file &quot;/key-file.bin&quot;&lt;/code&gt; to the luks mapping&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;mapped-devices&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; (&lt;/span&gt;&lt;span&gt;mapped-device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;source &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;uuid &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;47642581-ea45-4c53-84c8-d1baf81c70de&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;target &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;my-root&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;type luks-device-mapping&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	        (&lt;/span&gt;&lt;span&gt;arguments &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;#:key-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.bin&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;       (&lt;/span&gt;&lt;span&gt;mapped-device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;source &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;uuid &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;f2d3ee87-7cc7-4a95-8f4c-1f6c0fa750ee&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;target &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;my-home&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;type luks-device-mapping&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	        (&lt;/span&gt;&lt;span&gt;arguments &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;#:key-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.bin&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&quot;apply-it&quot;&gt;Apply it&lt;/h4&gt;
&lt;p&gt;run a &lt;code&gt;guix system reconfigure&lt;/code&gt; and reboot and now you will only have to
enter 2x the password. A 50% improvement  ( or 500%, 600% according to
some world leader).&lt;/p&gt;
&lt;p&gt;Now why does grub insist in decrypting the &lt;code&gt;/home&lt;/code&gt; partition?&lt;/p&gt;
&lt;p&gt;A quick look in &lt;code&gt;/boot/grub/grub.cfg&lt;/code&gt; shows:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat /boot/grub/grub.cfg&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; head&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;# This file was generated from your Guix configuration.  Any changes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;# will be lost upon reconfiguration.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;insmod&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; luks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;insmod&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; luks2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cryptomount&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -u 47642581ea454c5384c8d1baf81c70de&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cryptomount&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -u f2d3ee877cc74a958f4c1f6c0fa750ee&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;# Set &amp;#39;root&amp;#39; to the partition that contains /gnu/store.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, that explains it. But why?&lt;/p&gt;
&lt;p&gt;The manual does not give me any hints. Looking in the source code of
the guix bootloader generator shows that it makes a list of all mapped
devices which have a valid UUID and add it to grub. It throws a
warning when a mapped device uses the regular linux devicename instead
of the UUID as grub cannot find the devices with the linux name. This
makes sense and we can abuse it to get rid of the 2nd password prompt:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;mapped-devices&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; (&lt;/span&gt;&lt;span&gt;mapped-device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;source &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;uuid &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;47642581-ea45-4c53-84c8-d1baf81c70de&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;target &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;my-root&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;type luks-device-mapping&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	  (&lt;/span&gt;&lt;span&gt;arguments &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;#:key-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.bin&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;       (&lt;/span&gt;&lt;span&gt;mapped-device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;        ;;(source (uuid &amp;quot;f2d3ee87-7cc7-4a95-8f4c-1f6c0fa750ee&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	  (&lt;/span&gt;&lt;span&gt;source &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/dev/nvme0n1p3&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;target &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;my-home&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;        (&lt;/span&gt;&lt;span&gt;type luks-device-mapping&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	  (&lt;/span&gt;&lt;span&gt;arguments &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;(&lt;/span&gt;&lt;span&gt;#:key-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/key-file.bin&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If we replace the UUID with the regular device name, it will no longer
be exported to &lt;code&gt;grub.cfg&lt;/code&gt; and the kernel kan still find the device for
mapping it.&lt;/p&gt;
&lt;p&gt;A quick reconfigure and reboot later confirms this. I can now remove
the keyboard from the Jenga tower, but that would be cheating.&lt;/p&gt;
&lt;h3 id=&quot;fixing-the-keyboard&quot;&gt;Fixing the keyboard&lt;/h3&gt;
&lt;p&gt;Some searching in the Guix mailing list showed that &quot;hid_apple&quot; was
removed from the standard initrd somewhere in &#39;24 because of issues
with RISCV.&lt;/p&gt;
&lt;p&gt;That is where the &lt;code&gt;initrd-modules&lt;/code&gt; option is for:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;operating-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  (&lt;/span&gt;&lt;span&gt;initrd-modules &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cons&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;hid_apple&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; %base-initrd-modules&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This fixes the issue. I forgot how I tested it, but it does.&lt;/p&gt;
&lt;h2 id=&quot;post-installation&quot;&gt;Post Installation&lt;/h2&gt;
&lt;h3 id=&quot;system-does-not-allow-to-login-after-sleep&quot;&gt;System does not allow to login after sleep&lt;/h3&gt;
&lt;p&gt;Actually the problem is that the disk is still sleeping (remember the
foreshadowing when seeing the Apple NVMe device). This is not GUIX
specific as I already had to fix it in Ubuntu and Fedora. There you
add&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 0&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/sys/bus/pci/devices/0000&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\:&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;01&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\:&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;00.0/d3cold_allowed&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in the &lt;code&gt;crontab&lt;/code&gt; on the &lt;code&gt;@reboot&lt;/code&gt; event.&lt;/p&gt;
&lt;p&gt;This syntax is not supported by the herd scheduled jobs and I did not
find an alternative and got no suggestions on the #guix IRC
channel. So I decided to make a small shepherd service for this.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; disk-sleep-shepherd-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;shepherd-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;   (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;provision&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;(disk-sleep))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   (documentation &amp;quot;Disallow disk to go to d3cold state to prevent crash on wake up.&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   (one-shot? #t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   (start #~(lambda _&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;	       (call-with-output-file &amp;quot;/sys/bus/pci/devices/0000:01:00.0/d3cold_allowed&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;		 (lambda (port) (display &amp;quot;0&amp;quot; port)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;	       #t))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The only part I struggled with is that the &lt;code&gt;start&lt;/code&gt; field takes a
function with a variable number of arguments. The &lt;code&gt;/var/log/messages&lt;/code&gt;
registered the error but was not very helpful. Herd did not show the
service at all until it was fixed. Comparing to other implementation
gave the needed clues.&lt;/p&gt;
&lt;p&gt;To add this to the system:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;operating-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; (&lt;/span&gt;&lt;span&gt;services&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  (&lt;/span&gt;&lt;span&gt;simple-service &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span&gt;disk-sleep-service shepherd-root-service-type&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;span&gt; disk-sleep-shepherd-service&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  ))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;sound-no-sound-from-speakers-dot&quot;&gt;Sound : no sound from speakers.&lt;/h3&gt;
&lt;p&gt;There is no sound coming from the speakers.&lt;/p&gt;
&lt;p&gt;There is sound coming from the headphone jack. Good enough for use in
the living.&lt;/p&gt;
&lt;p&gt;I&#39;ll call this a feature, not a bug.&lt;/p&gt;
&lt;h2 id=&quot;things-i-would-do-differently&quot;&gt;Things I would do differently&lt;/h2&gt;
&lt;p&gt;Basically use btrfs to have a single encrypted LUKS volume to deal with and
split the volumes in btrfs. That would also give the other goodness of
btrfs and should be well supported by grub.&lt;/p&gt;
&lt;p&gt;But for now I&#39;ll enjoy my new couch laptop.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Screenshot in Sway with GUIX</title>
          <pubDate>Sat, 25 Oct 2025 14:19:00 +0200</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/</link>
          <guid>https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/</guid>
          <description xml:base="https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/">&lt;h2 id=&quot;screenshots-in-sway-with-guix-home-manager&quot;&gt;Screenshots in Sway with Guix Home Manager&lt;/h2&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https://kaibreucker.dev/en/content/foss/sway/screenshots/&quot;&gt;blog post&lt;/a&gt; documented an elegant way to configure screenshots in
wayland using &lt;strong&gt;grim&lt;/strong&gt; and &lt;strong&gt;grimshot&lt;/strong&gt;. After moving my sway config to use
the &lt;strong&gt;GUIX&lt;/strong&gt; &lt;code&gt;sway-service&lt;/code&gt; to generate the config file Iost my configured
screenshot bindings.&lt;/p&gt;
&lt;h3 id=&quot;output-files&quot;&gt;Output Files&lt;/h3&gt;
&lt;p&gt;The screenshots will be placed  in the &lt;code&gt;Pictures/screenshots&lt;/code&gt; folder
with the timestamp as filename.  To avoid duplication and ensure
consistency we&#39;ll add  a variable to generate the filename&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;sway-configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  (&lt;/span&gt;&lt;span&gt;variables &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;span&gt; %sway-default-variables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		     `&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;((&lt;/span&gt;&lt;span&gt;menu &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;.&lt;/span&gt;&lt;span&gt;  ,#~&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;string-append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    #$fuzzel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;                                    &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/bin/fuzzel&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;                                    &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -w 50 -x 8 -y 8 -r 3 -b 232635ff -t A6Accdff -s A6Accdff -S 232635ff -C c792eacc -m c792eacc -f &lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;JetBrains Mono:weight=light:size=10&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --icon-theme=&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Papirus-Dark&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --no-exit-on-keyboard-focus-loss&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;		       (&lt;/span&gt;&lt;span&gt;term &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;.&lt;/span&gt;&lt;span&gt; ,&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;file-append alacritty &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/bin/alacritty&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;		       (&lt;/span&gt;&lt;span&gt;screenshot_out &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;. &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;$(xdg-user-dir PICTURES)/screenshots/$(date +&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;%Y%m%d-%H%M%S&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;).png&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;		     ))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;key-bindings&quot;&gt;Key Bindings&lt;/h3&gt;
&lt;p&gt;I often use various screenshots pasted in chat windows or Jira tickets
so the clipboard is an important destination.
Alternatively saving them to move them to a target folder for
inclusion whereverr they needed is an important secondary use-case.&lt;/p&gt;
&lt;p&gt;We can now use the variable made previously and add the following keybindings:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;scheme&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;sway-configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;	    (&lt;/span&gt;&lt;span&gt;keybindings &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			  `&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;(&lt;/span&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;			    ;; Special key to take a screenshot with grim&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;			    (&lt;/span&gt;&lt;span&gt;$mod+Shift+p &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;. &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;exec grimshot copy anything&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;			    (&lt;/span&gt;&lt;span&gt;$mod+Shift+s &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;. &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;exec grimshot save screen $screenshot_out&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;			    (&lt;/span&gt;&lt;span&gt;$mod+Shift+w &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;. &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;exec grimshot save window $screenshot_out&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;			    (&lt;/span&gt;&lt;span&gt;$mod+Shift+a &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;. &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;exec grimshot save area $screenshot_out&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			    ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;			    )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;deploying-the-configuration&quot;&gt;Deploying the configuration&lt;/h2&gt;
&lt;p&gt;To activate the configuration&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; make home&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; Loading modules from ~/.config/dotfiles/guix/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Loading&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; modules from /home/pti/.config/dotfiles/guix/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;guix&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; home reconfigure -L ~/.config/dotfiles/guix/channel -c&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 32&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.config/dotfiles/guix/home-config-&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;hostname&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; cut&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -d. -f1&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;.scm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which quickly (for some value of quick) updates the home
configuration, writing a new &lt;strong&gt;~/.config/sway/config&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;When the prompt returns a quick reload of the sway config with
&lt;code&gt;$mod+Shift+c&lt;/code&gt; and testing if the modifications are active.&lt;/p&gt;
&lt;h2 id=&quot;testing-it-out&quot;&gt;Testing it Out&lt;/h2&gt;
&lt;p&gt;I opened libre office writer to paste copied screenshots and made a
mess to show the &lt;code&gt;copy anything&lt;/code&gt; works as expected. It does, it
highlights what it understands depending on your mouse location, a
window if hovering over a window, a rectangle if you start selecting
and all the screen if you move the mouse outside all windows (i.e. the
boundary on a tiling wm). It is a bit fiddly so sometimes I select the
wrong thing, but since it only clobbers the clipboard and I can
quickly try again, this seems reasonable.&lt;/p&gt;
&lt;p&gt;Similarly using the 3 other bindings to save different type of
screenshots.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  $&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls ~/Pictures/screenshots/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;20251025-141106.png&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  20251025-145006.png  20251025-145019.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cool, that made a mess in the folder and &lt;strong&gt;displaying&lt;/strong&gt; them show that it
are actually screenshots. Cool.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Consolidating Secrets in Pass</title>
          <pubDate>Sat, 28 Jun 2025 13:15:00 +0200</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/</link>
          <guid>https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/</guid>
          <description xml:base="https://www.snamellit.com/posts/20250628t131556-consolidating-secrets-in-pass-emacs-linux-security/">&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;Like a lot of people I&#39;ve had  a long history managing passwords and
secrets over the years.  From a little black book, over an Excel sheet,
using a GPG encoded secrets file (works really well with Emacs gpg
support), 1password (till they racked up their prices), lastpass (till
they got bought by the Evil LogMeIn Corp), KeepassXC and lately &lt;a rel=&quot;external&quot; href=&quot;https://passwordstore.org&quot;&gt;pass&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I was perfectly happy with KeepassXC for a very long time, except for
the command line integration.  So I kept ending up with passwords in
&lt;strong&gt;.envrc&lt;/strong&gt; files in folders and excluded in the global &lt;strong&gt;.gitignore&lt;/strong&gt; to avoid
too many red cheeks.  While this does keep secrets out of harms way
mostly, it kept nagging that I had them in plain text in those
files.  In theory there is &lt;strong&gt;keepassxc-cli&lt;/strong&gt; to query the passwords from
the command line, but let&#39;s say the experience does not spark joy.  It
has no easy way to cache the password between calls and it is
optimized for interactive use.  (AFAICT, just the giant size of the
command to type gives me dread).&lt;/p&gt;
&lt;p&gt;Some day I stumbled over &lt;strong&gt;pass&lt;/strong&gt; and found that after setup I could just
&lt;code&gt;pass snamellit/website&lt;/code&gt; to get the password on stdout.  I &lt;a rel=&quot;external&quot; href=&quot;https://www.snamellit.com/blog/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/&quot;&gt;wrote about
the setup and emacs integration in a previous post&lt;/a&gt;. Since it
leverage gpg, password caching is handled by the gpg-agent and my
&lt;strong&gt;.envrc&lt;/strong&gt; files quickly were purged of blasphemous secrets, replace by
pure bliss:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;export&lt;/span&gt;&lt;span&gt; MY_SECRET&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; my/secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;export&lt;/span&gt;&lt;span&gt; OTHER_SECRET&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;$(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; other/secret&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;similarly in emacs I can consistently get my passwords and related
info with:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(org-gcal-client-id (auth-source-pass-get &amp;#39;secret &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snamellit/org-gcal-client&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(org-gcal-client-secret (auth-source-pass-get &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;snamellit/org-gcal-client&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When needed the &lt;strong&gt;gpg-agent&lt;/strong&gt; will launch the appropriate pin-entry
program whether in terminal or in the GUI and the caching will not
force me to login several times when entering the folder.&lt;/p&gt;
&lt;p&gt;So I ended up with my interactive use covered by &lt;strong&gt;KeepassXC&lt;/strong&gt; and
automated use by &lt;strong&gt;pass&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;However, after some time I ended up with hundreds of secrets in
&lt;strong&gt;KeepassXC&lt;/strong&gt;, hundreds in &lt;strong&gt;pass&lt;/strong&gt;, it is not always clear whether use is
interactive or automated so confusion and duplication starts and
things become harder to manage.  In addition &lt;strong&gt;KeepassXC&lt;/strong&gt; was using
historically Dropbox to make it available on all my devices, recently
migrated to Nextcloud, which has issues with dealing with conflicts
which occasionally bite me in the behind.  On the other hand &lt;strong&gt;pass&lt;/strong&gt;
secrets are stored encrypted in git where conflict punch you in the
face.  I prefer the latter.  And started contemplating whether to move
everything to pass.&lt;/p&gt;
&lt;p&gt;Thanks to the encouragement of SummerEmacs, one of the more
enthusiastic SystemCrafters, ensuring the great experience in browsers
and iOS mobile devices I had no more excuses to keep postponing it.&lt;/p&gt;
&lt;h2 id=&quot;preparation&quot;&gt;Preparation&lt;/h2&gt;
&lt;p&gt;I started out with keeping my pass passwords as part of my
dotfiles.   This was convenient when they were few.  However this is
&lt;span class=&quot;underline&quot;&gt;weird&lt;/span&gt; so this will attract &lt;span class=&quot;underline&quot;&gt;weirdness&lt;/span&gt; when configuring all integrations
I&#39;ll need.&lt;/p&gt;
&lt;p&gt;Also &lt;strong&gt;pass&lt;/strong&gt; supports a &lt;strong&gt;git&lt;/strong&gt; command to manage the password-store with git
which is not really useful when it is part of something else.   So the
first order of the day is to move all secrets to a separate repository
and update the &lt;strong&gt;dotfiles&lt;/strong&gt; to check for presence and clone the repo if
missing (and do a gently pull when it is).
A quick visit to each of the machines in my machine park to apply this
change.
Everything still seems to be working.&lt;/p&gt;
&lt;h2 id=&quot;migration-of-the-keepassxc-data&quot;&gt;Migration of the KeepassXC data&lt;/h2&gt;
&lt;p&gt;I used the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/roddhjav/pass-import&quot;&gt;pass-import&lt;/a&gt; tool which adds in &lt;strong&gt;import&lt;/strong&gt; command to pass which
supports a crazy amount of password managers, including keepassxc.  For
keepassxc it need the &lt;strong&gt;pykeepass&lt;/strong&gt;.  If you&#39;re running on Arch, everything
is a &lt;code&gt;yay -S&lt;/code&gt; away.  However on Ubuntu and its derivatives it is the
usual slog we start to get accustomed to.  It&#39;s all in the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/roddhjav/pass-import&quot;&gt;pass-import
README&lt;/a&gt; , note that on Ubunty the &lt;strong&gt;pykeepass&lt;/strong&gt; library is available with
&lt;code&gt;apt install python3-pykeepass&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Once it is installed I tried  a dry run (with the &lt;code&gt;-d&lt;/code&gt; flag) to see if
basic functionality is working&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pass&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; import -a -d keepassxc ~/Nextcloud/Apps/Keepassxc/Passwords.kdbx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Password&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; for /home/pti/Nextcloud/Apps/Keepassxc/Passwords.kdbx:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Data would be imported from keepassxc to pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Passwords imported from: /home/pti/Nextcloud/Apps/Keepassxc/Passwords.kdbx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Passwords exported to: /home/pti/.password-store&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   Number of password imported:&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2035&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;   All data imported&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  w&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Weak password detected: eDGQqipE might be weak.  Score&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2&lt;/span&gt;&lt;span&gt; (100000001&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guesses&lt;/span&gt;&lt;span&gt;).  This estimate is based on the sequence eDGQqipE(&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;bruteforce&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  large list of names of secrets&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This asks for the password of the Keepass file and some remarks it
has.&lt;/p&gt;
&lt;p&gt;This all looks reasonable.  So we can try the import.  Since the
password-store is a git repo no real damage can be done to it (as it
is safely pushed somewhere else where the import tool cannot touch it)
and any damage done can be reverted....&lt;/p&gt;
&lt;p&gt;Now is a good time to check if the mooring lines of your laptop are
properly secured as encrypting all the secrets will spin up the
propellors if the number is large enough.&lt;/p&gt;
&lt;p&gt;I run it again without the &lt;code&gt;-d&lt;/code&gt; flag and after several minutes the
noise dies down and I am left with a lot of additional folders in my
&lt;code&gt;~/.password-store&lt;/code&gt; which match the grouping in KeepassXC.  The files
contain the secrets and the expected metadata.  This looks good so I
add/commit the things to complete the level.&lt;/p&gt;
&lt;h2 id=&quot;integration-with-ios-for-my-iphone&quot;&gt;Integration with iOS for my iPhone&lt;/h2&gt;
&lt;p&gt;Let&#39;s start with the most scary one : the iPhone.&lt;/p&gt;
&lt;p&gt;Upon recommendation I had installed &lt;strong&gt;passforios&lt;/strong&gt; which needs to be
configured.&lt;/p&gt;
&lt;p&gt;Configuring the host, repo and username to use for the git repository
is straightforward enough.&lt;/p&gt;
&lt;p&gt;I always use ssh to access my repos so we need to add an ssh keypair
for this purpose.  There is no support to generate key-pairs in
passforios for reasons, so I have to do it externally and upload the
key. A quick &lt;code&gt;ssh-keygen&lt;/code&gt; , uploading the public key to the forge,
allowing access to the repo and if I can get the private key on my
phone we can access the repo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;passforios&lt;/strong&gt; has a nice feature to load ascii armored keys via a QR
code. A bit digging surfaced the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/yishilin14/asc-key-to-qr-code-gif&quot;&gt;asc-key-to-qr-code-gif tool&lt;/a&gt; which
was made for this specific purpose. The ssh key is already in the
appropriate format so this can be directly converted&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;./asc-to-gif.sh&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.ssh/id-passforios ssh-pub.gif&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ssh-pub.gif&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then go to the repository settings, press the circled i  on the &lt;strong&gt;SSH
Key&lt;/strong&gt; button, select the ASCII-Armor Key and click to scan the QR
code. Point the camera to the QR code on the screen and it should
appear in the key field in the app.&lt;/p&gt;
&lt;p&gt;We have to repeat this 2 more times to get the private and public key
for the password-store into the app. First exporting the keys&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --export -a 1234ABCD&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;gpg.pub&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --export-secret-key -a 1234ABCD&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;gpg.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;converting to a gif, displaying them and scanning them in *Settings -&amp;gt;
PGP Key -&amp;gt; ASCII-Armor Key in the respective fields.&lt;/p&gt;
&lt;p&gt;If, after synching, you go now to the Passwords you should be greeted
with a listing of all folders and keys and the secrets should be
visible if made visible by tapping the eye icon.&lt;/p&gt;
&lt;p&gt;I needed to enable &lt;strong&gt;passforios&lt;/strong&gt; as a source for autofill : Settings -&amp;gt;
Passwords -&amp;gt; Autofill Passwords and slide the toggle for &lt;strong&gt;Pass&lt;/strong&gt;. I also
disabled the toggle for &lt;strong&gt;Strongbox&lt;/strong&gt; which I was using for integration
with the Keepass database.&lt;/p&gt;
&lt;p&gt;Now I see the option to select the secrets from the &lt;strong&gt;passforios&lt;/strong&gt; app. It
does not narrow down to the right key, but that is a problem for
future me.&lt;/p&gt;
&lt;p&gt;Ok, the hard part is done. Or at least the most risky part, ... in my
eyes... whatever. Moving on...&lt;/p&gt;
&lt;h2 id=&quot;integration-with-firefox&quot;&gt;Integration with FireFox&lt;/h2&gt;
&lt;p&gt;Checking at the bottom of the &lt;a rel=&quot;external&quot; href=&quot;https://www.passwordstore.org/&quot;&gt;pass website&lt;/a&gt; we find that &lt;strong&gt;passff&lt;/strong&gt; is the
good stuff for integration with FireFox.  From previous adventures with
KeepassXC and NativeMessaging I assumed there had to be a host part to
be installed too.&lt;/p&gt;
&lt;p&gt;Indeed we are directed to the &lt;a rel=&quot;external&quot; href=&quot;https://codeberg.org/PassFF/passff-host&quot;&gt;passff-host github repo&lt;/a&gt; to get an
install-script which generates the native messaging json for the
different browsers and a small executable python script which contains
remarkable clean and no-dependency code.  Similarly the install script
is straightforward. I do not understand why it support half a dozen
browser, mostly chrome based as for the life of me I cannot find an
extension which uses this host program.  So either I need bigger
glasses or there is some knowledge beyond my grasp.&lt;/p&gt;
&lt;p&gt;Running the installer, installing the extension, restarting firefox
for good luck and the extension appears and offers passwords on the
sites I try.&lt;/p&gt;
&lt;p&gt;Out of curiosity I check the configuration in
~.mozilla/native-messaging :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls .mozilla/native-messaging-hosts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;org.keepassxc.keepassxc_browser.json&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  passff.json  passff.py&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat .mozilla/native-messaging-hosts/passff.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;name&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;passff&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;description&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Host for communicating with zx2c4 pass&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;path&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/home/pti/.mozilla/native-messaging-hosts/passff.py&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;type&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;stdio&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  &amp;quot;allowed_extensions&amp;quot;:&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;passff@invicem.pro&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat .mozilla/native-messaging-hosts/passff.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/usr/bin/python3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    Host application of the browser extension PassFF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    that wraps around the zx2c4 pass script.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Nothing out of the ordinary, the passff.py python is the same as in
the repo.  My old keepassxc extension support is still there.&lt;/p&gt;
&lt;p&gt;Firefox is installed natively on this machine, not with a flatpak
which I assume will come with its own challenges.&lt;/p&gt;
&lt;h2 id=&quot;chromium-support&quot;&gt;Chromium Support&lt;/h2&gt;
&lt;p&gt;Time to tackle the Chrome family. Chrome is required to put food on
the table so we have to get that going eventually. But Chrome is
distributed as a flatpak (or a snap but I am &lt;strong&gt;NOT&lt;/strong&gt; going to deal with
that), and I can install Chromium natively, and apparently native
installs are &lt;strong&gt;MUCH&lt;/strong&gt; better supported than the versions in wrappers so
let&#39;s start with that one first.&lt;/p&gt;
&lt;p&gt;From the &lt;a rel=&quot;external&quot; href=&quot;https://www.passwordstore.org/&quot;&gt;pass website&lt;/a&gt; we find that &lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-extension&quot;&gt;browserpass&lt;/a&gt;&lt;/strong&gt; is the way to go for
the chrome family. The browser extension installs from the usual
places without drama and starts promptly complaining it cannot find
the native host to talk to.&lt;/p&gt;
&lt;p&gt;The native host in question is from &lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-native&quot;&gt;the browsaerpass-native sister
repo&lt;/a&gt; . As usual for all distro&#39;s there are packages ready to install
but because Ubuntu-derivative I can compile from source. Downloading
the source for version 3.1.0 from the &lt;a rel=&quot;external&quot; href=&quot;https://github.com/browserpass/browserpass-native/releases&quot;&gt;releases page&lt;/a&gt;. Again this repo
refers to all browsers including firefox although I cannot for the
life of me find a Firefox Extension supporting this host app.&lt;/p&gt;
&lt;p&gt;Then building and installing timelapse :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;tar&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -xzvf ~/Downloads/browserpass-native-3.1.0.tar.gz&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass-native-3.1.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;less&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; README.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; configure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; make PREFIX=/usr/local install&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;which&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which shows the executable lives at &lt;code&gt;/usr/local/bin/browserpass&lt;/code&gt; and
this totally went fine the first time (NOT!!!!).&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;Makefile&lt;/code&gt; has support to install the magic json to enable native
messaging for the different browsers.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; hosts-chromium-user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PREFIX&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; make&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; hosts-chrome-user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second invocation is a hail-mary because I already know the Chrome
flatpak does not look in the same places and will require some
additional finnagling&lt;/p&gt;
&lt;p&gt;For now focus on Chromium and check if the configuration looks
reasonable:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; ~&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cd .config/chromium/NativeMessagingHosts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.c/c/NativeMessagingHost&lt;/span&gt;&lt;span&gt;s&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;com.github.browserpass.native.json@&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pti@tuxedo&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.c/c/NativeMessagingHost&lt;/span&gt;&lt;span&gt;s&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cat com.github.browserpass.native.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;name&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;com.github.browserpass.native&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;description&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Browserpass native component for the Chromium extension&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;path&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/usr/local/bin/browserpass&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;type&amp;quot;:&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;stdio&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    &amp;quot;allowed_origins&amp;quot;:&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://naepdomgkenhinolocfifgehidddafch/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://pjmbgaakjkbhpopmakjoedenlfdmcdgm/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        &amp;quot;chrome-extension://klfoddkbhleoaabpmiigbmpbjfljimgb/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cool, the executable is looked at where it is installed (this is not
obvious, don&#39;t ask how I know). The rest looks also like how these
things should look. Let&#39;s try...&lt;/p&gt;
&lt;p&gt;The extension settings page is no longer complaining the native host
is missing and there are password entries visible. Checking with some
website shows the password is injected. yay!.&lt;/p&gt;
&lt;p&gt;Level complete, ready for the final boss.&lt;/p&gt;
&lt;h2 id=&quot;enabling-chrome-support-now-with-more-flatpak&quot;&gt;Enabling Chrome Support, now with more Flatpak!&lt;/h2&gt;
&lt;p&gt;Ok, we have a working chromium support so repo access, host app,
native host configuration et al are proven working. We can only focus
on jumping over the Flatpak Firewall...&lt;/p&gt;
&lt;p&gt;As a good cargo cultist I do a literature study and find that I should&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;find the config location of the flatpak app&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;use &lt;code&gt;flatpak-spawn&lt;/code&gt; to spawn the native messaging host app&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;enable D-Bus Session socket access for chrome&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Package up the calling of the host app in a single script to
configure in the json.&lt;/p&gt;
&lt;p&gt;Not necessarily in that order....&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the permission to access D-Bus Session start up &lt;strong&gt;flatseal&lt;/strong&gt; from
flathub, navigate to &lt;strong&gt;com.google.Chrome&lt;/strong&gt; and enable the D-Bus Session
socket. This should be possible with some additional cursing in the
manifest file of Chrome. I cannot find decent reference documentation
in a reasonable time, so &lt;strong&gt;flatseal&lt;/strong&gt; it is.&lt;/p&gt;
&lt;p&gt;The configuration of the flatpak app is easy too, painful experience
seared in my brain that flatpaks look in  &lt;strong&gt;~/.var/app/&lt;/strong&gt; folder so for
Chrome this will be &lt;strong&gt;~/.var/app/com.google.Chrome&lt;/strong&gt; . From the hail-mary
install for chrome done above I know that it just creates a symbolic
link to
&lt;strong&gt;/usr/local/lib/browserpass/hosts/chromium/com.github.browserpass.native&lt;/strong&gt;
so we can start from there. We will have to edit that so copy it. We
also need a wrapper to call the native host app&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~/.var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cp&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; /usr/local/lib/browserpass/hosts/chromium/com.github.browserpass.native&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ec&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; browserpass.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the content of the wrapper&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;#!/bin/sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ~&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;/usr/bin/flatpak-spawn&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --host /usr/local/bin/browserpass&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/tmp/browserpass-error.log&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I added the optional redirect of &lt;strong&gt;stderr&lt;/strong&gt; to an error logfile because
from experience I know nothing ever goes wrong if you enable error
reporting beforehand.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;chmod&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; +x browserpass.sh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pwd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pwd&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; wl-copy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ec&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; com.github.browserpass.native.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Installing the browserpass extension in Chrome after restarting it (I
am not superstitious, just careful) and I can bask in the glory of
seeing proposals for passwords when trying to log in. Most of the
proposals are pretty garbage, but that is a problem for future me.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I have access to my password-store secrets on my phone, my browsers on laptop and
desktop, and most importantly &lt;strong&gt;Emacs&lt;/strong&gt;. Narrowing of the proposed secrets
is, euhmmm, sub-optimal, but since it is sub-optimal in the same way
on all platforms I assume that some TLC in the password-store and
cleaning of the migrated secrets will fix that in time.&lt;/p&gt;
&lt;p&gt;In the process I gained much more confidence in configuring flatpak
apps. I can decommission the keepassxc system including dealing with
the sync conflicts (which was admittedly super easy with the merge
database feature in KeepassXC). I no longer have to deal with giving
the KeepassXC window a place on the desktop and autostarting it.&lt;/p&gt;
&lt;p&gt;I am a bit puzzled about the host-apps referring to supporting
browsers for which no extensions are available. This probably might
warrant some additional investigation.&lt;/p&gt;
&lt;p&gt;Big step forward&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Samba Adventures with Guix</title>
          <pubDate>Sat, 17 Aug 2024 00:00:00 +0200</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20240817-samba-adventures-in-guix/</link>
          <guid>https://www.snamellit.com/posts/20240817-samba-adventures-in-guix/</guid>
          <description xml:base="https://www.snamellit.com/posts/20240817-samba-adventures-in-guix/">&lt;p&gt;Samba or CIFS file sharing is a finicky area at best, but widely used,
especially since it was heavily pushed by Microsoft in the Windows
ecosystem, This makes it widely used in corporate and NAS environments
and even for Linux file sharing.&lt;/p&gt;
&lt;p&gt;In this post I will look at some ways to use CIFS file sharing as a
client. Personally I find hardly any uses for Samba file serving
nowadays from my compute environments, with &lt;strong&gt;git&lt;/strong&gt;, &lt;strong&gt;ssh&lt;/strong&gt;, &lt;strong&gt;http(s)&lt;/strong&gt;,
databases, MQTT, file synchronization services ... it hardly ever happens that
I face a situation where I think : &quot;Hey, I wish I could serve my files
from my PC/VPS/VM/... with Samba&quot;. It is such a generic non-specific
service I usually find a more opinionated data sharing
service. Actually I find the same for NFS.&lt;/p&gt;
&lt;p&gt;That being said, it is still ubiquitous to get enterprise data and to
connect to NAS or remote hard disks.&lt;/p&gt;
&lt;h2 id=&quot;cifs-server-simulator&quot;&gt;CIFS Server Simulator&lt;/h2&gt;
&lt;p&gt;In practice setting up and connecting to a CIFS server is a
frustrating experience due to a bewildering array of different
protocols, security systems, credentials, ... .&lt;/p&gt;
&lt;p&gt;To test out accessing a Samba server without having to deal with too
many moving pieces at the same time I like to use a known fixed local
basic samba server. This enables me to get working client - server
configurations which I find easier to tweak to real life servers than
starting from scratch.&lt;/p&gt;
&lt;p&gt;Docker hub provides preconfigured images for Samba servers which are
easy to use :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; docker run --name test-smb -p 4139:139 --rm -p 4445:445 -v&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; `&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;pwd&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;`&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;/samples/:/mnt/export&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; --rm -d dperson/samba -p -u&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;joe;schmoe&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -s&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;export;/mnt/export/;yes;no;no;joe;;;Test Share&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will start a samba server and listen on ports 4139 and 4445 so it
does not clash if a server is running on the machine we&#39;re using and
we do not need special privileges other than being in the &lt;code&gt;docker&lt;/code&gt; group
to run &lt;strong&gt;docker&lt;/strong&gt; as a regular user. The &lt;code&gt;-s ...&lt;/code&gt; option configures a share
name &lt;strong&gt;export&lt;/strong&gt; which is browsable, not readonly, not accessible by guest
users and  can only be accessed with the &lt;strong&gt;joe&lt;/strong&gt; user account. This is to
make the experience a bit more in line with usual real world
configuration which are seldom as open as the default settings for
shares. For more details, see &lt;a rel=&quot;external&quot; href=&quot;https://hub.docker.com/r/dperson/samba&quot;&gt;the github repo for the image&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Because this is not a fun command line to type I like to put them in a
&lt;strong&gt;Makefile&lt;/strong&gt; in a folder with some support files&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cd ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; mkdir test-smb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cd test-smb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; mkdir samples&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; echo&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Hello, Samba&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;samples/hello.txt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then add the Makefile&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;make&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;servers-start&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;        docker run --name test-smb -p 4139&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;span&gt;139 --rm -p 4445:445 -v `pwd`/samples/:/mnt/export --rm -d dperson/samba -p -u &amp;quot;joe;schmoe&amp;quot; -s &amp;quot;export;/mnt/export/;yes;no;no;joe;;;Test Share&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;servers-stop&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        docker stop test-smb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;guix-notes-for-docker&quot;&gt;Guix Notes for Docker&lt;/h3&gt;
&lt;p&gt;Docker  (and podman too) need some OS support to talk to the kernel to
create the namespaces to make the containers work. Even though podman
does not need a daemon to run, it still needs some &lt;strong&gt;setuid&lt;/strong&gt; helpers. I
tend to mostly use &lt;strong&gt;docker&lt;/strong&gt; because of habit and everyone else uses it
and tends to be better supported and documented for my use cases. In
any case I did not have any luck getting either to work in a local
&lt;code&gt;guix shell&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To enable &lt;strong&gt;docker&lt;/strong&gt; on Guix-SD I have the following in my system configuration.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (use-service-modules cups desktop docker networking ssh xorg)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(operating-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (users&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (cons*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (user-account&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     (supplementary-groups&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;#39;( ... &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)))  &lt;/span&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;;; enable access to docker daemon&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    %base-user-accounts))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(packages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;   ;; add docker command line tools&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(services&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;   ;; enable docker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (service docker-service-type)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When using Guix on a host os, the native &lt;strong&gt;docker&lt;/strong&gt; package should work
fine.&lt;/p&gt;
&lt;h2 id=&quot;connecting-using-smbclient&quot;&gt;Connecting using smbclient&lt;/h2&gt;
&lt;p&gt;Before mounting drives we need to ascertain our credentials are
accepted by the Samba server. It makes no sense proceeding trying to
mount shares if we cannot get past authentication and the overhead of
configuring those shares and the Guix configuration rebuilding really
impacts iteration speed when trying things out.&lt;/p&gt;
&lt;p&gt;The most straightforward way to connect to a CIFS server is with the
&lt;strong&gt;smbclient&lt;/strong&gt; tool which is part of the &lt;strong&gt;samba&lt;/strong&gt; package:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guix shell samba&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;test-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; smbclient -L //localhost -p&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 4445&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -U joe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Password&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; for&lt;/span&gt;&lt;span&gt; [WORKGROUP&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\j&lt;/span&gt;&lt;span&gt;oe]:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    Sharename&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;       Type      Comment&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    ---------&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;       ----      -------&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;    export&lt;/span&gt;&lt;span&gt;          Disk      Test Share&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;    IPC$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;            IPC       IPC Service&lt;/span&gt;&lt;span&gt; (Samba&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; Server&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;SMB1&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; disabled -- no workgroup available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;test-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main&lt;/span&gt;&lt;span&gt; [!] via 🐃  took 4s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; smbclient //localhost/export -p&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 4445&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -U joe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Password&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; for&lt;/span&gt;&lt;span&gt; [WORKGROUP&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\j&lt;/span&gt;&lt;span&gt;oe]:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Try&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;help&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; to get a list of possible commands.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;smb:&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt; \&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                                   D&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;        0&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 03:49:32&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  ..&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                                  D&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;        0&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 05:22:38&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  hello.txt&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                           N&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;       13&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 03:50:27&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;                1912951596&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; blocks of size 1024.&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 998957000&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; blocks available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;smb:&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt; \&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;guix shell samba&lt;/code&gt; creates a profile with the &lt;strong&gt;samba&lt;/strong&gt; package
installed which places `smbclient` on the path.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;smbclient -L //servername&lt;/code&gt; lists the services offered by the server, in
our case &lt;strong&gt;localhost&lt;/strong&gt; to connect to our docker instance. The &lt;code&gt;-p 4445&lt;/code&gt;
option selects the custom port we specified on our docker
container. By default &lt;strong&gt;smbclient&lt;/strong&gt; will use your login as uid, so we need
to override it to the user we created when starting the docker
container with &lt;code&gt;-U joe&lt;/code&gt; .&lt;/p&gt;
&lt;p&gt;The password is configured as &lt;code&gt;schmoe&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We see the &lt;code&gt;export&lt;/code&gt; folder is shared so we connect to it using
`smbclient //localhost/export -p 4445 -U joe` and can list the
contents. And of course we can upload, download and all the other
terminal goodness offered by &lt;strong&gt;smbclient&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In practice it can be very fiddly to get the right username, password,
Workgroup or Domain, port number, SMB protocol, etc dialed in. The
obtuse messages often do not really help. The other methods make
interpreting errors even harder, with the exception of programmatic
access which is sometime surprisingly helpful in getting a connection
going.&lt;/p&gt;
&lt;h3 id=&quot;save-the-credentials&quot;&gt;Save the credentials&lt;/h3&gt;
&lt;p&gt;The samba tools have a convention to save the credentials in a
&lt;strong&gt;authentication file&lt;/strong&gt; which is supported by most tools AFAICT.&lt;/p&gt;
&lt;p&gt;To use this create a file &lt;code&gt;.smbcredentials&lt;/code&gt; in your home folder. Well,
it can be anything but I like that place as I typically only have my
NAS to connect to using samba and it is for my home folder, backup
folder, my Music and Movies folder and the like, i.e. stuff related to
my user account, so I find it in its place in my home folder.&lt;/p&gt;
&lt;p&gt;In it place the &lt;code&gt;username&lt;/code&gt;, &lt;code&gt;password&lt;/code&gt; and &lt;code&gt;domain&lt;/code&gt; which worked with
smbclient so they no longer need to be provided :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;username=joe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;password=schmoe&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;domain=WORKGROUP&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we can use it:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; smbclient //localhost/export -p&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 4445&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; -A ~/.smbcredentials&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;Try&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;help&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; to get a list of possible commands.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;smb:&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt; \&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  .&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                                   D&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;        0&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 03:49:32&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  ..&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                                  D&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;        0&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 12:02:13&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  hello.txt&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;                           N&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;       13&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;  Sat Aug&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 17&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; 03:50:27&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 2024&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;                1912951596&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; blocks of size 1024.&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 998918312&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; blocks available&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;smb:&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt; \&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This save a lot of typing and we can use this file in the next stages
and avoid spreading the credentials all over the disk. I am going to
gloss over encrypting this info any further because I do not keep
nuclear (or any other for that matter) secrets on my nas.&lt;/p&gt;
&lt;h2 id=&quot;mounting-shares-with-mount-dot-cifs&quot;&gt;Mounting Shares with &lt;code&gt;mount.cifs&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Let&#39;s create a mount point in our test folder&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; mkdir mnt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then mount the share with &lt;code&gt;mount.cifs&lt;/code&gt;.  This is part of the &lt;code&gt;cifs-utils&lt;/code&gt; package.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;ttest-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main&lt;/span&gt;&lt;span&gt; [?] via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; guix shell cifs-utils&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;The&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; following derivation will be built:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;  /gnu/store/2x7mmyrsnsf21aing02ass82899gm2yh-profile.drv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;building&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; CA certificate bundle...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;listing&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; Emacs sub-directories...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;building&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; fonts directory...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;building&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; directory of Info manuals...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;building&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; profile with&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; package...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;est-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;❮&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo mount.cifs //localhost/export mnt -o credentials=/home/pti/.smbcredentials,port=&lt;/span&gt;&lt;span style=&quot;color: #B48EAD;&quot;&gt;4445&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;test-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main&lt;/span&gt;&lt;span&gt; [?] via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; ls mnt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;hello.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;test-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main&lt;/span&gt;&lt;span&gt; [?] via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This mounts the share to the folder &lt;code&gt;mnt&lt;/code&gt;. The &lt;code&gt;-o&lt;/code&gt; option is used to
point to the credentials file and the port number of our docker NAS
simulator.&lt;/p&gt;
&lt;p&gt;Checking with the regular &lt;code&gt;mount&lt;/code&gt; command to see if it agrees we mounted
the share:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;❯&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo mount -t cifs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;//localhost/export&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on /home/pti/src/test-smb/mnt type cifs&lt;/span&gt;&lt;span&gt; (rw,relatime,vers=3.1.1,cache=strict,username=joe,domain=WORKGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=0000:0000:0000:0000:0000:0000:0000:0001,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;test-smb&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on  main&lt;/span&gt;&lt;span&gt; [?] via 🐃&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;➜&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; sudo mount&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; cifs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;/etc/auto.cifs&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on /nas type autofs&lt;/span&gt;&lt;span&gt; (rw,relatime,fd=6,pgrp=1732,timeout=600,minproto=5,maxproto=5,indirect,pipe_ino=27049)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;//localhost/export&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt; on /home/pti/src/test-smb/mnt type cifs&lt;/span&gt;&lt;span&gt; (rw,relatime,vers=3.1.1,cache=strict,username=joe,domain=WORKGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=0000:0000:0000:0000:0000:0000:0000:0001,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Calling &lt;code&gt;mount&lt;/code&gt; without arguments lists all mounted filesystems, however
nowadays the output is so overwhelming that I prefer to use &lt;code&gt;grep&lt;/code&gt; to
narrow down the output to the filesystem type I am interested in. The
same thing can be achieved by specifying the filesystem type with the
&lt;code&gt;-t&lt;/code&gt; option.&lt;/p&gt;
&lt;h2 id=&quot;configuring-the-mounts-in-the-operating-system-dot&quot;&gt;Configuring the mounts in the operating system.&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;mount.cifs&lt;/code&gt; command is fine for testing and ad-hoc use but in
practice I mostly (read 99+% of the time) want the same shares of the
NAS mounted in the same place on my system. This is where the &lt;code&gt;fstab&lt;/code&gt;
file comes in. This file is read by the mount command at boot time and
mounts the configured filesystems.&lt;/p&gt;
&lt;p&gt;I do not recommend mounting CIFS shares at boot time, but configuring
the shares in &lt;code&gt;fstab&lt;/code&gt; is a good way to be able to mount them when needed
with a quick &lt;code&gt;mount -a&lt;/code&gt; command.&lt;/p&gt;
&lt;p&gt;On my Tuxedo system I have in the &lt;code&gt;/etc/fstab&lt;/code&gt; file&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;//nas.snamellit.com/home /home/pti/nas   cifs   rw,uid=1000,gid=100,credentials=/home/pti/.smbcredentials   0   0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;//nas.snamellit.com/public /mnt/public   cifs   rw,uid=1000,gid=100,credentials=/home/pti/.smbcredentials   0   0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;//nas.snamellit.com/multimedia /mnt/multimedia   cifs   rw,uid=1000,gid=100,credentials=/home/pti/.smbcredentials   0   0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first column is the reference to the share as we&#39;ve seen
above. Then the mount point. The 3rd column indicates it is a &lt;code&gt;cifs&lt;/code&gt;
share, Then the options we&#39;ve seen with smbmount. Here I have to play
with the &lt;code&gt;uid&lt;/code&gt; and &lt;code&gt;gid&lt;/code&gt; to align my local user and group with the
configuration on the nas. The last 2 columns are whether to include
the mounts when dumping the filesystem and doing a filesystem check
which will probably always be 0 as the CIFS server is responsible for
that.&lt;/p&gt;
&lt;p&gt;In theory this will mount the shares at boot time, and it probably
does, however in my experience it seems they are unmounted on suspend
and not remounted after resume. Or there is some timeout. I never
investigated I must admit. I just do a quick &lt;code&gt;mount -a&lt;/code&gt; before I need
them and this works wonders.&lt;/p&gt;
&lt;p&gt;On Guix-SD the &lt;code&gt;file-systems&lt;/code&gt; are specified in the &lt;code&gt;operating-system&lt;/code&gt;
section of the system configuration :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(operating-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(file-systems&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (cons*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (file-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (device &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;//nas.snamellit.com/public&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (options &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;uid=1000,gid=1000,credentials=/home/pti/.smbcredentials&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount-point &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/mnt/public&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;cifs&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount? #f)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (create-mount-point? #t))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (file-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (device &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;//nas.snamellit.com/multimedia&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (options &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;uid=1000,gid=1000,credentials=/home/pti/.smbcredentials&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount-point &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/mnt/multimedia&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;cifs&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount? #f)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (create-mount-point? #t))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (file-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (device &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;//nas.snamellit.com/home&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (options &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;uid=1000,gid=1000,credentials=/home/pti/.smbcredentials&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount-point &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/home/pti/nas&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;cifs&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (mount? #f)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (create-mount-point? #t))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  %base-file-systems)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which is just a straightforward translation of the &lt;strong&gt;fstab&lt;/strong&gt; columns in
&lt;a rel=&quot;external&quot; href=&quot;https://guix.gnu.org/manual/devel/en/html_node/File-Systems.html&quot;&gt;Guix-ese.&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;automatic-mounting-with-autofs&quot;&gt;Automatic Mounting with AutoFs&lt;/h2&gt;
&lt;p&gt;Of course the inefficiency of having to type &lt;code&gt;mount -a&lt;/code&gt; almost on a
weekly basis is unbearable and this inefficiency has to be addressed
even if this means we cannot expect net positive effect in the coming
millenia.&lt;/p&gt;
&lt;p&gt;Enter &lt;code&gt;autofs&lt;/code&gt; which is an awesome system to dynamically mount and
unmount filesystems on an as needed basis. The kernel will notice when
a mounted folder is accessed and ask the &lt;strong&gt;autofs daemon&lt;/strong&gt; to mount the
configured mount and unmount it after some timeout occurs without any
activity.&lt;/p&gt;
&lt;p&gt;This is transparant for the user other than a slight delay when
accessing the folder the first time when it is unmounted.&lt;/p&gt;
&lt;p&gt;This system is very flexible at it was clearly intended for far more
ambitious use-cases than accessing your personal music library from
your nas, but that does not mean we cannot strip it down and use it
for our purposes.&lt;/p&gt;
&lt;p&gt;What is a bit confusing is the configuration. It uses 3 different
file types to configure the system.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;/etc/autofs.conf&lt;/code&gt; file which configures the daemon operating
options, like the timeouts and the location of the main &lt;strong&gt;master file&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;the master file(s), there is always a main file, but this can
delegate to directory with additional parts of the file which can be
assumed to be imported in the main file. Its main purpose is to map
a parent folder of mount points to a &lt;strong&gt;map file&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;the map files which map a subfolder in the folder from the line in
the &lt;strong&gt;master file&lt;/strong&gt; to a mount specification which will be used when
that folder is accessed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;example-on-the-tuxedo&quot;&gt;Example on the Tuxedo:&lt;/h3&gt;
&lt;p&gt;On my Tuxedo (running Tuxedo OS which is an Ubuntu 22.04 derivate) I have the following configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/autofs.conf&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[ autofs ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# master_map_name - default map name for the master map.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;master_map_name = /etc/auto.master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so the &lt;strong&gt;master map&lt;/strong&gt; is in the file &lt;code&gt;/etc/auto.master&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/auto.master&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/-  /etc/autofs.direct  -ro&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &quot;/-&quot; is a special case which means &quot;any&quot; directory. In this case
the folder name in the &lt;strong&gt;map file&lt;/strong&gt; is assumed to be a fully qualified
directory name instead of a subfolder in the folder mentioned in the
first column.  In this case the &lt;strong&gt;map file&lt;/strong&gt; is &lt;code&gt;/etc/autofs.direct&lt;/code&gt; and the
default options are &lt;code&gt;-ro&lt;/code&gt; .&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/etc/autofs.direct&lt;/code&gt;:&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/home/pti/nas -fstype=cifs,rw,noperm,vers=3.0,credentials=/home/pti/.smbcredentials    ://nas.snamellit.com/home&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;This shows that the mount point &lt;code&gt;/home/pti/nas&lt;/code&gt; will mount the share
&lt;code&gt;//nas.snamellit.com/home&lt;/code&gt; of file system type cifs with the options
(the rest of the 2nd column) as mount options.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;example-on-the-guix-sd-desktop&quot;&gt;Example on the Guix-SD desktop&lt;/h3&gt;
&lt;p&gt;Unfortunately there is not (yet) packaged support for an &lt;strong&gt;autofs&lt;/strong&gt;
service-type, so we have to make it ourselves.&lt;/p&gt;
&lt;p&gt;First we define a configuration record type for our new service:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define-record-type* &amp;lt;autofs-configuration&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  autofs-configuration make-autofs-configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  autofs-configuration?&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (pid-file autofs-configuration-pid-file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (default &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/var/run/autofs.pid&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (autofs-direct autofs-configuration-autofs-direct&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 (default (plain-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;autofs.direct&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/home/pti/autonas -fstype=cifs,rw,noperm,vers=3.0,credentials=/home/pti/.smbcredentials  ://nas.snamellit.com/home&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;))))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I should probably not put my actual configuration in the default, but
it makes my life easier at the moment and I&#39;ll refactor it
later. (Yeah, sure...)&lt;/p&gt;
&lt;p&gt;Since the autofs service needs some boilerplate configuration files I
generate them with an activation function:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define (autofs-activation config)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Return the activation GEXP to create the config files for autofs&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (with-imported-modules &amp;#39;((guix build utils))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         #~(begin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             (use-modules (guix build utils)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                          (ice-9 textual-ports))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             (define (touch file-name)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                               (call-with-output-file file-name (const #t)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;                             ;; &amp;#39;sshd&amp;#39; complains if the authorized-key directory and its parents&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;                             ;; are group-writable, which rules out /gnu/store.  Thus we copy the&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #616E88;&quot;&gt;                             ;; authorized-key directory to /etc.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             (call-with-output-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/etc/autofs.conf&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                               (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;lambda&lt;/span&gt;&lt;span&gt; (f) (put-string f &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;[ autofs ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;master_map_name = /etc/auto.master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;timeout = 300&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             (call-with-output-file &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/etc/auto.master&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                               (&lt;/span&gt;&lt;span style=&quot;color: #81A1C1;&quot;&gt;lambda&lt;/span&gt;&lt;span&gt; (f) (put-string f (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;format&lt;/span&gt;&lt;span&gt; #f &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/-  ~a -ro&lt;/span&gt;&lt;span style=&quot;color: #EBCB8B;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; #$(autofs-configuration-autofs-direct config)))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                             )))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You&#39;ll recognize the absolutely stripped down versions of the files
mentioned above being generated. The &lt;code&gt;/etc/auto.master&lt;/code&gt; file maps the
&lt;strong&gt;directfs&lt;/strong&gt; map file to the file generated in the configuration record.&lt;/p&gt;
&lt;p&gt;This should tie up nicely the links between the 3 files.&lt;/p&gt;
&lt;p&gt;Then I need a &lt;strong&gt;shepherd service&lt;/strong&gt; to start the &lt;strong&gt;autofs&lt;/strong&gt; daemon:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define (autofs-shepherd-service config)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (define pid-file (autofs-configuration-pid-file config))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (shepherd-service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (provision &amp;#39;(autofs))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;documentation&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;AutoFS Service.&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (requirement &amp;#39;(networking))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (start #~(make-forkexec-constructor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               #$(file-append autofs &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/sbin/automount&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;-f&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #616E88;&quot;&gt; ;; run in foreground to give shepherd more control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;-p&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt; #$(autofs-configuration-pid-file config)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;               &amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;/etc/auto.master&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8FBCBB;&quot;&gt;              #&lt;/span&gt;&lt;span&gt;:pid-file #$(autofs-configuration-pid-file config)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (stop #~(make-kill-destructor))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We point it to the generated &lt;strong&gt;auto.master&lt;/strong&gt; file from the activation
function. (I could probably refactor this to use guix instantiated
files but at this stage that extra level of indirection would only
confuse me and make debugging harder. I find jumping through 3 files
already hard enough to follow).&lt;/p&gt;
&lt;p&gt;Then we need to put a bow around it and define an &lt;code&gt;autofs-service-type&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(define autofs-service-type&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (service-type (name &amp;#39;autofs)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (description &lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A3BE8C;&quot;&gt;Run the autofs daemon to automount folders on access.&lt;/span&gt;&lt;span style=&quot;color: #ECEFF4;&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (extensions&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  (service-extension activation-service-type autofs-activation)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  (service-extension shepherd-root-service-type autofs-shepherd-service)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (compose &lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;concatenate&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                (default-value (autofs-configuration)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  )&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This just extends the &lt;code&gt;activation-service-type&lt;/code&gt; and the
&lt;code&gt;shepherd-root-service-type&lt;/code&gt; to run our initialisation code and ensure
the &lt;strong&gt;autofs&lt;/strong&gt; daemon gets started.&lt;/p&gt;
&lt;p&gt;Then we can add this to our system configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;common-lisp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(operating-system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (packages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    autofs)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (services&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;append&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (&lt;/span&gt;&lt;span style=&quot;color: #88C0D0;&quot;&gt;list&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (service autofs-service-type))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   ...)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;i.e. add the &lt;code&gt;autofs&lt;/code&gt; package to install the daemon and support stuff
and enable the service of type &lt;code&gt;autofs-service-type&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I can now use files on my nas transparantly. I was a bit flippant on
my reasons to enable &lt;strong&gt;autofs&lt;/strong&gt;. The real reason was that I want to keep
automatic backup copies of my forge running on an VPS somewhere on my
NAS with a cron job, which means I would not be there to run a &lt;code&gt;mount -a&lt;/code&gt; at the time. (I now realize I could do that as part of the cron
job : 20/20 hindsight). In any case this is a major quality of life
improvement. As a side effect, my music library now gets properly
indexed and is made available on the default music player. Apparently
I still use CIFS more than I care to admit.&lt;/p&gt;
&lt;p&gt;The big problem with SMB/CIFS is getting the initial connection
going. Once that is achieved and the credentials are safely stored
away in &lt;strong&gt;credentials&lt;/strong&gt; file, they can be easily reused with a lot less
surprising things along the way.&lt;/p&gt;
&lt;p&gt;It also pays to test things out in the smallest possible meaningful
scope, in this case &lt;strong&gt;smbclient&lt;/strong&gt; before adding more obfuscation layers on
top of it, as that just adds more complexity, pitfalls and rabbit
holes to get lost in. By going step by step, building on previous
result I often get results faster (or at all) even if I have to do
additional steps which turn out to no longer be needed in the final
solution.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Workflows for Unix Password Store with Emacs and Shell</title>
          <pubDate>Tue, 25 Jun 2024 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/</link>
          <guid>https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/</guid>
          <description xml:base="https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/">&lt;h1 id=&quot;table-of-contents&quot;&gt;Table of Contents&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#orgeea54c9&quot;&gt;Managing Secrets using Pass&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org44c3160&quot;&gt;Installation&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org7920015&quot;&gt;GUIX&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#orgbee77ce&quot;&gt;Debian, Ubuntu et al&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#orgad61fe8&quot;&gt;Emacs Integration&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#orgf739a63&quot;&gt;Enable the Unix Password Store.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org1c798ff&quot;&gt;Helper Function&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org25108ee&quot;&gt;Using in Emacs Configuration&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org849f72f&quot;&gt;Shell integration&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org299dd7c&quot;&gt;DirEnv integration&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org158dbf2&quot;&gt;Tips&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org00fffd0&quot;&gt;Entering passwords on the terminal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/20240624t104859-secrets-management-using-unix-password-store-pass-linux-osx-sysadmin/#org6ab1e11&quot;&gt;Getting fields from multi field secrets&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a id=&quot;orgeea54c9&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;managing-secrets-using-pass&quot;&gt;Managing Secrets using Pass&lt;/h1&gt;
&lt;p&gt;On UNIX there is a well known tool to manage secrets called
&lt;strong&gt;password-store&lt;/strong&gt; or &lt;strong&gt;pass&lt;/strong&gt; for short.&lt;/p&gt;
&lt;p&gt;It is a very minimal tool, more to facilitate workflows that to do
real work, very much in the UNIX philosophy. It stores all secrets in
plain files in a folder structure. It does not care about what is in
the files and encrypts them using a GPG public key so only the owner
of the private key can decrypt them. It does offer special access to
the first line so a password can be quickly fetched and copied to the
clipboard or stdout or wherever some &lt;strong&gt;pass&lt;/strong&gt; aware integration needs it.&lt;/p&gt;
&lt;p&gt;Certain folders can be configured to use a different public keys to
allow pragmatic secret delegation to different systems without
exposing all secrets.&lt;/p&gt;
&lt;p&gt;It leverages the &lt;strong&gt;gpg&lt;/strong&gt; infrastructure for key management, distribution,
unlocking with &lt;strong&gt;pinentry&lt;/strong&gt;, caching with &lt;strong&gt;gpg-agent&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org44c3160&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;installation&quot;&gt;Installation&lt;/h1&gt;
&lt;p&gt;&lt;a id=&quot;org7920015&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;guix&quot;&gt;GUIX&lt;/h2&gt;
&lt;p&gt;Add &lt;strong&gt;password-store&lt;/strong&gt;, &lt;strong&gt;gpg&lt;/strong&gt; and &lt;strong&gt;pinentry&lt;/strong&gt; to your package list.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;pinentry&lt;/strong&gt; program provides a client to securely unlock your keys in
a GUI and terminal environment. There are other options to make it
better fit your environment, but this is fine for me.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;orgbee77ce&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;debian-ubuntu-et-al&quot;&gt;Debian, Ubuntu et al&lt;/h2&gt;
&lt;p&gt;Add &lt;strong&gt;pass&lt;/strong&gt;, &lt;strong&gt;gpg&lt;/strong&gt;, &lt;strong&gt;gpg-agent&lt;/strong&gt; and &lt;strong&gt;pinentry-gnome&lt;/strong&gt; of &lt;strong&gt;pinentry-qt&lt;/strong&gt; using&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ apt-get install pass gpg gpg-agent pinentry-qt&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both the gnome and qt versions at least fall back gracefully if no
graphical environment are available.&lt;/p&gt;
&lt;p&gt;The current selected pinentry program is provided as
&lt;strong&gt;/usr/bin/pinentry&lt;/strong&gt; and this link is managed by the usual alternatives
machinery in debian based distros.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;orgad61fe8&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;emacs-integration&quot;&gt;Emacs Integration&lt;/h1&gt;
&lt;p&gt;Emacs &lt;strong&gt;auth-source&lt;/strong&gt; infrastructure supports &lt;strong&gt;pass&lt;/strong&gt; out of the box.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;orgf739a63&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;enable-the-unix-password-store&quot;&gt;Enable the Unix Password Store.&lt;/h2&gt;
&lt;p&gt;We have to make sure the password-store is added to the
auth-sources. There is a handy function for that:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; enable unix password-store&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(auth-source-pass-enable)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We add that somewhere in the init.el before any secrets are needed.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org1c798ff&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;helper-function&quot;&gt;Helper Function&lt;/h2&gt;
&lt;p&gt;Auth-sources is a flexible system and works like a database, i.e. you
can query, browse through results and have multiple fields per secret.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(defun snam-password (host user)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &amp;quot;Get password from the unix password store.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Searches the password file for a secret in the folder corresponding to&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;the HOST name given, which is the folder with the &amp;#39;/&amp;#39; replaced by a &amp;#39;.&amp;#39;.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The filename in the folder corresponds to the USER argument with a&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;#39;.pgp&amp;#39; extension.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  (auth-info-password&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   (car (auth-source-search&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         :max 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         :host host&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         :user user))))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;`auth-source-search` returns a list of results, so we have to get the
first entry with `car`. The secret is lightly obfuscated, hence the
need to decode it with the `auth-info-password` function.&lt;/p&gt;
&lt;p&gt;Luckily there is a function &lt;a href=&quot;help:auth-source-pass-get&quot;&gt;auth-source-pass-get&lt;/a&gt; to get a password
from the password store which also follows the recommended conventions
for multiple fields in a pass file.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(auth-source-pass-get &amp;#39;secret &amp;quot;snamellit/znc&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The pseudo key `&#39;secret` returns the first line of the password store
entry which contains the password, per &lt;strong&gt;pass&lt;/strong&gt; conventions.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org25108ee&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;using-in-emacs-configuration&quot;&gt;Using in Emacs Configuration&lt;/h2&gt;
&lt;p&gt;For single secrets, like connecting to my &lt;strong&gt;znc&lt;/strong&gt; IRC bouncer:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(erc-tls :id &amp;#39;znc :server &amp;quot;********&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         :port &amp;quot;****&amp;quot; :user &amp;quot;xyz&amp;quot; :nick&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;quot;foobar&amp;quot; :password (auth-source-pass-get &amp;#39;secret &amp;quot;foobar/znc&amp;quot;)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For multifield secrets, like for google authentication, we can
leverage the multiple fields in the password store. Here is my
&lt;strong&gt;org-gcal&lt;/strong&gt; configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(setq org-gcal-client-id (auth-source-pass-get &amp;#39;secret &amp;quot;snamellit/org-gcal-client&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      org-gcal-client-secret (auth-source-pass-get &amp;quot;id&amp;quot; &amp;quot;snamellit/org-gcal-client&amp;quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      org-gcal-fetch-file-alist &amp;#39;((&amp;quot;xyz@foobar.com&amp;quot; .  &amp;quot;~/org/schedule.org&amp;quot;)))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a id=&quot;org849f72f&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;shell-integration&quot;&gt;Shell integration&lt;/h1&gt;
&lt;p&gt;&lt;a id=&quot;org299dd7c&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;direnv-integration&quot;&gt;DirEnv integration&lt;/h2&gt;
&lt;p&gt;When developping 12-factor or similar inspired apps, the configuration
is passed using environment variables. Using &lt;strong&gt;.envrc&lt;/strong&gt; files with
&lt;strong&gt;direnv&lt;/strong&gt; integration in the shell is a very smooth way to work in
multiple projects.&lt;/p&gt;
&lt;p&gt;It is of course less than ideal to have the secrets exposed in the
&lt;strong&gt;.envrc&lt;/strong&gt; files in your project tree even if it is in the &lt;strong&gt;.gitignore&lt;/strong&gt;
file, although that is infinitely better than having secrets end up in
the git repository.&lt;/p&gt;
&lt;p&gt;Secrets in the &lt;strong&gt;.envrc&lt;/strong&gt; files can be easily moved to the password store
by entering the folder. The following snippet prints the current value
to the screen and then inserts it in the password store, and verifies
it actually is entered correctly.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo $FOO_BAR_PASSWORD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ echo $FOO_BAR_PASSWORD | pass add -e foo/bar&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ pass foo/bar&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and then editing the &lt;strong&gt;.envrc&lt;/strong&gt; file from&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOO_BAR_PASSWORD=&amp;lt;some secret&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOO_BAR_PASSWORD=$(pass foo/bar)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After modification you&#39;ll be asked to allow to read the new &lt;strong&gt;.envrc&lt;/strong&gt;
file content and you can check if it still works by comparing the
password with the one printed previously.&lt;/p&gt;
&lt;p&gt;Printing the passwords allows to fix any typos. If this are the only
copies you have of them you might rug-pull yourself. Ideally it should
be possible to quickly recreate secrets if you lose any, but reality
is often far from ideal. Echoing all these passwords is also not
ideal, but preferable over keeping a little black book of secrets. If
these passwords are coming from another password manager it is not
needed of course.&lt;/p&gt;
&lt;p&gt;Do not forget to clear your terminal scroll back history with&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ clear&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To help migration of &lt;strong&gt;.envrc&lt;/strong&gt; files I created a bash script I stored in
&lt;strong&gt;~/.local/bin/envrc-to-pass&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#!/bin/bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if [ &amp;quot;$#&amp;quot; -ne 2 ]; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    echo &amp;quot;Usage: $0 &amp;lt;variable_name&amp;gt; &amp;lt;namespace&amp;gt;&amp;quot; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VAR_NAME=$1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SLUG=$(echo $VAR_NAME | sed &amp;#39;s/_/-/g&amp;#39; | tr &amp;#39;[:upper:]&amp;#39; &amp;#39;[:lower:]&amp;#39;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NAMESPACE=$2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo &amp;quot;Moving variable $VAR_NAME to $NAMESPACE/$SLUG in password store&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SECRET=$(grep &amp;quot;$VAR_NAME=&amp;quot; .envrc | cut -d&amp;#39;=&amp;#39; -f2)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (echo $SECRET | grep &amp;#39;^\$(pass.*)&amp;#39;); then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    echo &amp;quot;secret already migrated&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    echo $SECRET | pass insert -e $NAMESPACE/$SLUG&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sed -i &amp;quot;s#$VAR_NAME=.*#$VAR_NAME=\\\$(pass $NAMESPACE\/$SLUG)#&amp;quot; .envrc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This makes short work of migrating projects to use the password-store.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org158dbf2&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;tips&quot;&gt;Tips&lt;/h1&gt;
&lt;p&gt;&lt;a id=&quot;org00fffd0&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;entering-passwords-on-the-terminal&quot;&gt;Entering passwords on the terminal&lt;/h2&gt;
&lt;p&gt;Usually invoking `pass add foobar/baz` will ask to enter the password
and confirm it in the shell.&lt;/p&gt;
&lt;p&gt;However when piping a secret into the password-store
with&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo FOO_BAR_PASSWORD | pass add foo/bar&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;will silently fail although the man pages tell that `pass add` will
read from &lt;strong&gt;stdin&lt;/strong&gt;. It is not clear IMO that you have to specify the &lt;strong&gt;-e&lt;/strong&gt;
flag like :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;echo FOO_BAR_PASSWORD | pass -e add foo/bar&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to suppress the confirmation and make it work as expected.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org6ab1e11&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;getting-fields-from-multi-field-secrets&quot;&gt;Getting fields from multi field secrets&lt;/h2&gt;
&lt;p&gt;Often secrets come in multiple parts which are nice to be stored in a
single entry in order not to complicate the tree. The &lt;strong&gt;pass&lt;/strong&gt;
documentation suggests:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;password or main secret&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;field1: &amp;lt;some data&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;field2: &amp;lt;more data&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the main secret is just the first line, and can have the same
structure as the other lines, if that makes more sense.&lt;/p&gt;
&lt;p&gt;e.g. for a google integration:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;service-account: 1234567-abcdefghijklm@developer.gserviceadmin.com(some-project)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;email: xyz@foobar.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;private-key: ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case it is useful to &lt;span class=&quot;underline&quot;&gt;document&lt;/span&gt; which kind of secret it is as it
could also be an api-key, or a refresh-token, or whatever part of the
authentication menagerie that Google offers.&lt;/p&gt;
&lt;p&gt;To get these fields individually I use:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GOOGLE_EMAIL=$(pass foo/bar | awk &amp;#39;/^email:/ {print $2}) &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in emacs this syntax is supported directly and the same info can be
fetched with&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(let&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ((google-email (auth-source-pass-get &amp;quot;email&amp;quot; &amp;quot;foo/bar&amp;quot;)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ... )&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</description>
      </item>
      <item>
          <title>KeePassXC from flatpak</title>
          <pubDate>Sun, 12 May 2024 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/keepassxc-and-flatpak/</link>
          <guid>https://www.snamellit.com/posts/keepassxc-and-flatpak/</guid>
          <description xml:base="https://www.snamellit.com/posts/keepassxc-and-flatpak/">&lt;h1 id=&quot;table-of-contents&quot;&gt;Table of Contents&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#orgd08a78a&quot;&gt;KeePassXC from flatpak&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#orgfed6df2&quot;&gt;Allow access to the socket file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#org95da879&quot;&gt;keepassxc-proxy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#orgacf3b27&quot;&gt;Configure Chrome&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#org93487a3&quot;&gt;Configure Brave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#org3956323&quot;&gt;Configure Firefox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.snamellit.com/posts/keepassxc-and-flatpak/#org2844960&quot;&gt;references&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a id=&quot;orgd08a78a&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;keepassxc-from-flatpak&quot;&gt;KeePassXC from flatpak&lt;/h1&gt;
&lt;p&gt;More and more browsers are coming packaged in containers like flatpak or snaps. Especially the ones of the chromium variety.&lt;/p&gt;
&lt;p&gt;Since browsers are at the best of times scary things with arbitrary code being executed in every webpage runnning them in a sandbox makes a lot of sense.&lt;/p&gt;
&lt;p&gt;However the sandbox also impacts communication with helpers like the password manager KeepassXC.&lt;/p&gt;
&lt;p&gt;In order to keep things reproducible on many machines, if we&#39;re going to fight with flatpak we might as well run keepassxc as a flatpak.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ flatpak install org.keepassxc.KeePassXC&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a id=&quot;orgfed6df2&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;allow-access-to-the-socket-file&quot;&gt;Allow access to the socket file&lt;/h1&gt;
&lt;p&gt;Allow read-only access to the keepassxc socket at
$XDG&lt;sub&gt;RUNTIME&lt;/sub&gt;&lt;sub&gt;DIR&lt;/sub&gt;/org.keepassxc.KeePassXC.BrowserServer:ro :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ flatpak override --user \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  --filesystem=xdg-run/app/org.keepassxc.KeePassXC:ro \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  com.google.Chrome&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;this needs to be done for each flatpak application needing access to keepassxc.&lt;/p&gt;
&lt;p&gt;&lt;a id=&quot;org95da879&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;keepassxc-proxy&quot;&gt;keepassxc-proxy&lt;/h1&gt;
&lt;p&gt;There is  a statically compiled rust based socket proxy.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/varjolintu/keepassxc-proxy-rust&quot;&gt;rust based keepassxc proxy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It can be compiled with MUSL for a fully static executable.&lt;/p&gt;
&lt;p&gt;Place it together with the configuration file&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a id=&quot;orgacf3b27&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;configure-chrome&quot;&gt;Configure Chrome&lt;/h1&gt;
&lt;p&gt;The Chrome flatpak can be configured in the folder
*~/.var/app/com.google.Chrome :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ ls .var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keepassxc-proxy  org.keepassxc.keepassxc_browser.json&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the native messaging config file needs to be configured for the local
user:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;allowed_origins&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;chrome-extension://pdffhmdngciaglkoonimfcmckehcpafo/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;chrome-extension://oboonakemofpalcgghocfoadofidjkkk/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;description&amp;quot;: &amp;quot;KeePassXC integration with native messaging support&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;name&amp;quot;: &amp;quot;org.keepassxc.keepassxc_browser&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;path&amp;quot;: &amp;quot;/home/pti/.var/app/com.google.Chrome/config/google-chrome/NativeMessagingHosts/keepassxc-proxy&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;stdio&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and do not forget to give access to the socket&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ flatpak override --user --filesystem=xdg-run/app/org.keepassxc.KeePassXC:ro com.google.Chrome&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notes;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;strong&gt;path&lt;/strong&gt; field needs to contain the full path including the username
AFAICT.&lt;/li&gt;
&lt;li&gt;The extension id can be stolen from the URL box when going into the
settings pane of the extension. It has changed in the past.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a id=&quot;org93487a3&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;configure-brave&quot;&gt;Configure Brave&lt;/h1&gt;
&lt;p&gt;we need again an &lt;strong&gt;org.keepassxc.keepassxc&lt;sub&gt;browser.json&lt;/sub&gt;&lt;/strong&gt; file in
&lt;strong&gt;~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/NativeMessagingHosts/&lt;/strong&gt;
folder together with an executable version of the proxy compiled above.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;allowed_origins&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;chrome-extension://pdffhmdngciaglkoonimfcmckehcpafo/&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;chrome-extension://oboonakemofpalcgghocfoadofidjkkk/&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;description&amp;quot;: &amp;quot;KeePassXC integration with native messaging support&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;name&amp;quot;: &amp;quot;org.keepassxc.keepassxc_browser&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;path&amp;quot;: &amp;quot;/home/pti/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/NativeMessagingHosts/keepassxc-proxy&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;stdio&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can copy it from the Google Chrome config but do not forget to
update the path to the proxy.&lt;/p&gt;
&lt;p&gt;Now we still need to give access to brave to the keepassxc socket:&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ flatpak override --user --filesystem=xdg-run/app/org.keepassxc.KeePassXC:ro com.brave.Browser&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a id=&quot;org3956323&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;configure-firefox&quot;&gt;Configure Firefox&lt;/h1&gt;
&lt;p&gt;I have firefox running native on my laptop so these shenanigans are
not needed. However the example I based most of was for firefox so I
assume it works similar. Note that the native messaging file is
different for firefox.&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;allowed_extensions&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;keepassxc-browser@keepassxc.org&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;description&amp;quot;: &amp;quot;KeePassXC integration with native messaging support, workaround for flatpaked Firefox, see https://is.gd/flatpakFirefoxKPXC&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;name&amp;quot;: &amp;quot;org.keepassxc.keepassxc_browser&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;path&amp;quot;: &amp;quot;/home/pti/.var/app/org.mozilla.firefox/.mozilla/native-messaging-hosts/keepassxc-proxy&amp;quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;type&amp;quot;: &amp;quot;stdio&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it uses &lt;strong&gt;allowed&lt;sub&gt;extensions&lt;/sub&gt;&lt;/strong&gt; iso &lt;strong&gt;allowed&lt;sub&gt;origin&lt;/sub&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;And give access to the socker file to firefox&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ flatpak override --user --filesystem=xdg-run/app/org.keepassxc.KeePassXC:ro org.mozilla.firefox&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a id=&quot;org2844960&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&quot;references&quot;&gt;references&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://discourse.flathub.org/t/how-to-run-firefox-and-keepassxc-in-a-flatpak-and-get-the-keepassxc-browser-add-on-to-work/437&quot;&gt;post on discourse flathub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/varjolintu/keepassxc-proxy-rust&quot;&gt;rust based keepassxc proxy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://developer.chrome.com/docs/extensions/develop/concepts/native-messaging&quot;&gt;Google Chrome documentation for Native Messaging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/keepassxreboot/keepassxc-browser/issues/1631&quot;&gt;Github Issue on keepassxc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https://github.com/keepassxreboot/keepassxc-browser/issues/1267&quot;&gt;issue 1267 on keepassxc&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      </item>
      <item>
          <title>Intercepting Bluetooth Keyboard Events</title>
          <pubDate>Thu, 14 Dec 2023 00:00:00 +0000</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20231214-intercepting-bluetooth-keyboard-events/</link>
          <guid>https://www.snamellit.com/posts/20231214-intercepting-bluetooth-keyboard-events/</guid>
          <description xml:base="https://www.snamellit.com/posts/20231214-intercepting-bluetooth-keyboard-events/">&lt;h1 id=&quot;intercepting-bluetooth-keyboard-events&quot;&gt;Intercepting Bluetooth Keyboard Events&lt;/h1&gt;
&lt;p&gt;I like keyboards and I like custom keyboards. However many do not allow sufficient configuration to let
a key be Ctrl on hold and Esc on top. Notably the HHKB.&lt;/p&gt;
&lt;p&gt;USB devices are nicely listed in &lt;em&gt;/dev/input/by-id/&lt;/em&gt; folder but on my system the event device is anonymously placed in &lt;em&gt;/dev/input/&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;figuring-out-the-name&quot;&gt;Figuring out the name&lt;/h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;❯ for dev in /dev/input/*; do udevadm info --attribute-walk $dev; done | grep -A10 -B10 Keyboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unknown device &amp;quot;/dev/input/by-id&amp;quot;: No such device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Unknown device &amp;quot;/dev/input/by-path&amp;quot;: No such device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{capabilities/led}==&amp;quot;1f&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{capabilities/msc}==&amp;quot;10&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{capabilities/rel}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{capabilities/snd}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{capabilities/sw}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{id/bustype}==&amp;quot;0005&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{id/product}==&amp;quot;0021&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{id/vendor}==&amp;quot;04fe&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{id/version}==&amp;quot;0001&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{inhibited}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{name}==&amp;quot;HHKB-Hybrid_1 Keyboard&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{phys}==&amp;quot;04:33:c2:f4:e9:70&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{power/control}==&amp;quot;auto&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{power/runtime_active_time}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{power/runtime_status}==&amp;quot;unsupported&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{power/runtime_suspended_time}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{properties}==&amp;quot;0&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ATTRS{uniq}==&amp;quot;cb:7a:7c:03:2d:f2&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;for other keyboards a bit of finagling for searching with grep might be needed or pipe into &lt;em&gt;less&lt;/em&gt; and scroll till you find it.&lt;/p&gt;
&lt;p&gt;Now I can add it to my */etc/interception/udevmon.d/ctrl_tap_esc.yaml :&lt;/p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color: #D8DEE9; background-color: #2E3440;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- JOB: &amp;quot;intercept -g $DEVNODE | dual-function-keys -c /etc/interception/dual-function-keys.yaml | uinput -d $DEVNODE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DEVICE:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    NAME: &amp;quot;PFU Limited HHKB-Hybrid&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EVENTS: &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      EV_KEY: [KEY_LEFTCTRL]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- JOB: &amp;quot;intercept -g $DEVNODE | dual-function-keys -c /etc/interception/dual-function-keys.yaml | uinput -d $DEVNODE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DEVICE:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    NAME: &amp;quot;PFU Limited HHKB-Hybrid Keyboard&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EVENTS: &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      EV_KEY: [KEY_LEFTCTRL]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- JOB: &amp;quot;intercept -g $DEVNODE | dual-function-keys -c /etc/interception/dual-function-keys.yaml | uinput -d $DEVNODE&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  DEVICE:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    NAME: &amp;quot;HHKB-Hybrid_1 Keyboard&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    EVENTS: &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      EV_KEY: [KEY_LEFTCTRL]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first 2 are for USB but that is still a work in progress&lt;/p&gt;
</description>
      </item>
    </channel>
</rss>
