mirror of
https://github.com/SqrtMinusOne/sqrtminusone.github.io.git
synced 2025-12-11 16:13:03 +03:00
755 lines
58 KiB
HTML
755 lines
58 KiB
HTML
<!DOCTYPE html>
|
|
<html lang=""><head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
|
|
<title>Guix</title>
|
|
<meta name="description" content="Freedom is a state of mind">
|
|
<meta name="author" content='SqrtMinusOne'>
|
|
|
|
<link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous">
|
|
|
|
|
|
<link rel="stylesheet" href="/sass/researcher.min.css">
|
|
|
|
|
|
<link rel="icon" type="image/ico" href="https://sqrtminusone.xyz/favicon.ico">
|
|
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body><div class="container mt-5">
|
|
<nav class="navbar navbar-expand-sm flex-column flex-sm-row text-nowrap p-0">
|
|
<a class="navbar-brand mx-0 mr-sm-auto" href="https://sqrtminusone.xyz/" title="SqrtMinusOne">
|
|
|
|
SqrtMinusOne
|
|
</a>
|
|
<div class="navbar-nav flex-row flex-wrap justify-content-center">
|
|
|
|
|
|
|
|
<a class="nav-item nav-link" href="/" title="Index">
|
|
Index
|
|
</a>
|
|
|
|
<span class="nav-item navbar-text mx-1">/</span>
|
|
|
|
|
|
<a class="nav-item nav-link" href="/posts/" title="Posts">
|
|
Posts
|
|
</a>
|
|
|
|
<span class="nav-item navbar-text mx-1">/</span>
|
|
|
|
|
|
<a class="nav-item nav-link" href="/configs/readme" title="Configs">
|
|
Configs
|
|
</a>
|
|
|
|
|
|
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
<hr>
|
|
<div id="content">
|
|
<div class="container">
|
|
<p><a href="https://guix.gnu.org/">GNU Guix</a> is (1) a transactional package manager and (2) a GNU/Linux distribution.</p>
|
|
<p>My personal selling points are declarative package configuration and transactional upgrades.</p>
|
|
<p>References:</p>
|
|
<ul>
|
|
<li><a href="https://guix.gnu.org/en/help/">Official help</a></li>
|
|
<li><a href="https://wiki.systemcrafters.cc/guix">System Crafters wiki</a></li>
|
|
<li><a href="https://gitlab.com/pjotrp/guix-notes">Pjotr Prins' Guix notes</a></li>
|
|
<li><a href="https://www.youtube.com/watch?v=iBaqOK75cho&list=PLEoMzSkcN8oNxnj7jm5V2ZcGc52002pQU">Davil Wilson’s YouTube series</a></li>
|
|
</ul>
|
|
<div class="ox-hugo-toc toc">
|
|
<div></div>
|
|
<div class="heading">Table of Contents</div>
|
|
<ul>
|
|
<li><a href="#contents">Contents</a></li>
|
|
<li><a href="#profiles">Profiles</a>
|
|
<ul>
|
|
<li><a href="#activate-profiles">Activate profiles</a></li>
|
|
<li><a href="#update-profiles">Update profiles</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#channels">Channels</a></li>
|
|
<li><a href="#systems">Systems</a>
|
|
<ul>
|
|
<li><a href="#base-configuration">Base configuration</a></li>
|
|
<li><a href="#indigo">indigo</a></li>
|
|
<li><a href="#eminence">eminence</a></li>
|
|
<li><a href="#azure">azure</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#system-installation">System installation</a>
|
|
<ul>
|
|
<li><a href="#preparation">Preparation</a></li>
|
|
<li><a href="#installation">Installation</a></li>
|
|
<li><a href="#after-installation">After installation</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#misc-software-and-notes">Misc software & notes</a>
|
|
<ul>
|
|
<li><a href="#vpn">VPN</a>
|
|
<ul>
|
|
<li><a href="#vpn-start">vpn-start</a></li>
|
|
<li><a href="#vpn-stop">vpn-stop</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#flatpak">flatpak</a></li>
|
|
<li><a href="#conda">conda</a></li>
|
|
<li><a href="#slack">Slack</a></li>
|
|
<li><a href="#virt-manager">virt-manager</a></li>
|
|
<li><a href="#wakatime-cli">wakatime-cli</a></li>
|
|
<li><a href="#manifest">Manifest</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<!--endtoc-->
|
|
<h2 id="contents">Contents</h2>
|
|
<ul>
|
|
<li><a href="#contents">Contents</a></li>
|
|
<li><a href="#profiles">Profiles</a>
|
|
<ul>
|
|
<li><a href="#activate-profiles">Activate profiles</a></li>
|
|
<li><a href="#update-profiles">Update profiles</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#channels">Channels</a></li>
|
|
<li><a href="#systems">Systems</a>
|
|
<ul>
|
|
<li><a href="#base-configuration">Base configuration</a></li>
|
|
<li><a href="#indigo">indigo</a></li>
|
|
<li><a href="#eminence">eminence</a></li>
|
|
<li><a href="#azure">azure</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#system-installation">System installation</a>
|
|
<ul>
|
|
<li><a href="#preparation">Preparation</a></li>
|
|
<li><a href="#installation">Installation</a></li>
|
|
<li><a href="#after-installation">After installation</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#misc-software-and-notes">Misc software & notes</a>
|
|
<ul>
|
|
<li><a href="#vpn">VPN</a>
|
|
<ul>
|
|
<li><a href="#vpn-start">vpn-start</a></li>
|
|
<li><a href="#vpn-stop">vpn-stop</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#flatpak">flatpak</a></li>
|
|
<li><a href="#conda">conda</a></li>
|
|
<li><a href="#slack">Slack</a></li>
|
|
<li><a href="#virt-manager">virt-manager</a></li>
|
|
<li><a href="#wakatime-cli">wakatime-cli</a></li>
|
|
<li><a href="#manifest">Manifest</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2 id="profiles">Profiles</h2>
|
|
<p>A profile is a way to group Guix packages. Amongst its advantages, profiles can be defined by manifests, which in turn can be stored in VCS.</p>
|
|
<p>References:</p>
|
|
<ul>
|
|
<li><a href="https://guix.gnu.org/en/cookbook/en/html%5Fnode/Guix-Profiles-in-Practice.html">Guix Profiles in Practice</a></li>
|
|
</ul>
|
|
<h3 id="activate-profiles">Activate profiles</h3>
|
|
<p>A script to activate guix profiles. Usage:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">activate-profiles [profile1] [profile2] ...
|
|
</code></pre></div><p>Source: <a href="https://github.com/daviwil/dotfiles/blob/master/Systems.org#activating-profiles">David Wilson’s config</a></p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">GREEN<span style="color:#f92672">=</span><span style="color:#e6db74">'\033[1;32m'</span>
|
|
RED<span style="color:#f92672">=</span><span style="color:#e6db74">'\033[1;30m'</span>
|
|
NC<span style="color:#f92672">=</span><span style="color:#e6db74">'\033[0m'</span>
|
|
GUIX_EXTRA_PROFILES<span style="color:#f92672">=</span>$HOME/.guix-extra-profiles
|
|
|
|
profiles<span style="color:#f92672">=</span>$*
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[[</span> $# -eq <span style="color:#ae81ff">0</span> <span style="color:#f92672">]]</span>; <span style="color:#66d9ef">then</span>
|
|
profiles<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$HOME<span style="color:#e6db74">/.config/guix/manifests/*.scm"</span>;
|
|
<span style="color:#66d9ef">fi</span>
|
|
|
|
<span style="color:#66d9ef">for</span> profile in $profiles; <span style="color:#66d9ef">do</span>
|
|
<span style="color:#75715e"># Remove the path and file extension, if any</span>
|
|
profileName<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>basename $profile<span style="color:#66d9ef">)</span>
|
|
profileName<span style="color:#f92672">=</span><span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>profileName%.*<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>
|
|
profilePath<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$GUIX_EXTRA_PROFILES<span style="color:#e6db74">/</span>$profileName<span style="color:#e6db74">"</span>
|
|
manifestPath<span style="color:#f92672">=</span>$HOME/.config/guix/manifests/$profileName.scm
|
|
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -f $manifestPath <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
|
|
echo
|
|
echo -e <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>GREEN<span style="color:#e6db74">}</span><span style="color:#e6db74">Activating profile:"</span> $manifestPath <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>NC<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>
|
|
echo
|
|
|
|
mkdir -p $profilePath
|
|
guix package --manifest<span style="color:#f92672">=</span>$manifestPath --profile<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$profilePath<span style="color:#e6db74">/</span>$profileName<span style="color:#e6db74">"</span>
|
|
|
|
<span style="color:#75715e"># Source the new profile</span>
|
|
GUIX_PROFILE<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$profilePath<span style="color:#e6db74">/</span>$profileName<span style="color:#e6db74">"</span>
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -f $GUIX_PROFILE/etc/profile <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
|
|
. <span style="color:#e6db74">"</span>$GUIX_PROFILE<span style="color:#e6db74">"</span>/etc/profile
|
|
<span style="color:#66d9ef">else</span>
|
|
echo -e <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>RED<span style="color:#e6db74">}</span><span style="color:#e6db74">Couldn't find profile:"</span> $GUIX_PROFILE/etc/profile <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>NC<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>
|
|
<span style="color:#66d9ef">fi</span>
|
|
<span style="color:#66d9ef">else</span>
|
|
echo <span style="color:#e6db74">"No profile found at path"</span> $profilePath
|
|
<span style="color:#66d9ef">fi</span>
|
|
<span style="color:#66d9ef">done</span>
|
|
</code></pre></div><h3 id="update-profiles">Update profiles</h3>
|
|
<p>A script to update Guix profiles. Usage:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">update-profiles [profile1] [profile2] ...
|
|
</code></pre></div><p>Source: once again, <a href="https://github.com/daviwil/dotfiles/blob/master/Systems.org#updating-profiles">David Wilson’s config</a>.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">GREEN<span style="color:#f92672">=</span><span style="color:#e6db74">'\033[1;32m'</span>
|
|
NC<span style="color:#f92672">=</span><span style="color:#e6db74">'\033[0m'</span>
|
|
GUIX_EXTRA_PROFILES<span style="color:#f92672">=</span>$HOME/.guix-extra-profiles
|
|
|
|
profiles<span style="color:#f92672">=</span>$*
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[[</span> $# -eq <span style="color:#ae81ff">0</span> <span style="color:#f92672">]]</span>; <span style="color:#66d9ef">then</span>
|
|
profiles<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$GUIX_EXTRA_PROFILES<span style="color:#e6db74">/*"</span>;
|
|
<span style="color:#66d9ef">fi</span>
|
|
|
|
<span style="color:#66d9ef">for</span> profile in $profiles; <span style="color:#66d9ef">do</span>
|
|
profileName<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>basename $profile<span style="color:#66d9ef">)</span>
|
|
profilePath<span style="color:#f92672">=</span>$GUIX_EXTRA_PROFILES/$profileName
|
|
|
|
echo
|
|
echo -e <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>GREEN<span style="color:#e6db74">}</span><span style="color:#e6db74">Updating profile:"</span> $profilePath <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>NC<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>
|
|
echo
|
|
|
|
guix package --profile<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$profilePath<span style="color:#e6db74">/</span>$profileName<span style="color:#e6db74">"</span> --manifest<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$HOME<span style="color:#e6db74">/.config/guix/manifests/</span>$profileName<span style="color:#e6db74">.scm"</span>
|
|
<span style="color:#66d9ef">done</span>
|
|
</code></pre></div><h2 id="channels">Channels</h2>
|
|
<p>Specifying additional channels.</p>
|
|
<p><a href="https://github.com/SqrtMinusOne/channel-q">channel-q</a> is my Guix channel. Don’t use it at home.</p>
|
|
<p>References:</p>
|
|
<ul>
|
|
<li><a href="https://gitlab.com/nonguix/nonguix">nonguix channel repo</a></li>
|
|
<li><a href="https://guix.gnu.org/manual/en/html%5Fnode/Channels.html">Guix channels reference</a></li>
|
|
</ul>
|
|
<!--listend-->
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">cons*</span>
|
|
(<span style="color:#a6e22e">channel</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">'channel-q</span>)
|
|
(<span style="color:#a6e22e">url</span> <span style="color:#e6db74">"file:///home/pavel/Code/channel-q"</span>))
|
|
(<span style="color:#a6e22e">channel</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">'flat</span>)
|
|
(<span style="color:#a6e22e">url</span> <span style="color:#e6db74">"https://github.com/flatwhatson/guix-channel.git"</span>)
|
|
(<span style="color:#a6e22e">introduction</span>
|
|
(<span style="color:#a6e22e">make-channel-introduction</span>
|
|
<span style="color:#e6db74">"33f86a4b48205c0dc19d7c036c85393f0766f806"</span>
|
|
(<span style="color:#a6e22e">openpgp-fingerprint</span>
|
|
<span style="color:#e6db74">"736A C00E 1254 378B A982 7AF6 9DBE 8265 81B6 4490"</span>))))
|
|
(<span style="color:#a6e22e">channel</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">'nonguix</span>)
|
|
(<span style="color:#a6e22e">url</span> <span style="color:#e6db74">"https://gitlab.com/nonguix/nonguix"</span>)
|
|
<span style="color:#75715e">;; (commit "d54973e47b89fe5772a5b6e2d0c0b86acb089e27")</span>
|
|
(<span style="color:#a6e22e">introduction</span>
|
|
(<span style="color:#a6e22e">make-channel-introduction</span>
|
|
<span style="color:#e6db74">"897c1a470da759236cc11798f4e0a5f7d4d59fbc"</span>
|
|
(<span style="color:#a6e22e">openpgp-fingerprint</span>
|
|
<span style="color:#e6db74">"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5"</span>))))
|
|
%default-channels)
|
|
</code></pre></div><h2 id="systems">Systems</h2>
|
|
<p>Configuring systems with Guix.</p>
|
|
<p>Yes, all my machines are named after colors I like.</p>
|
|
<h3 id="base-configuration">Base configuration</h3>
|
|
<p>The base configuration is shared between all the machines.</p>
|
|
<p>While it’s possible to make a single <code>.scm</code> file with base configuration and load it, I noticed that it produces more cryptic error messages whenever there is an error in the base file, so I opt-in for noweb.</p>
|
|
<p><code>guix system</code> invocation is as follows:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">sudo -E guix system reconfigure ~/.config/guix/systems/[system].scm
|
|
</code></pre></div><p>Common modules:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span>))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> system nss))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages bash))
|
|
(<span style="color:#a6e22e">use-modules</span> ((<span style="color:#a6e22e">gnu</span> packages base) <span style="color:#f92672">#</span>:select (<span style="color:#a6e22e">coreutils</span> glibc)))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages certs))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages version-control))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages vim))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages gnome))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages xorg))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages wm))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> packages openbox))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> services docker))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> services cups))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">gnu</span> services virtualization))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">srfi</span> srfi-1))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">guix</span> channels))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">guix</span> inferior))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">nongnu</span> packages linux))
|
|
(<span style="color:#a6e22e">use-modules</span> (<span style="color:#a6e22e">nongnu</span> system linux-initrd))
|
|
|
|
(<span style="color:#a6e22e">use-service-modules</span> desktop networking ssh xorg nix)
|
|
(<span style="color:#a6e22e">use-package-modules</span> ssh)
|
|
</code></pre></div><p>In principle, we could define a variable called <code>base-operating-system</code> and extend it in ancestors. However, then we would have to define mandatory fields like <code>host-name</code>, <code>bootloader</code> with dummy values. Since I’m already using noweb, there is little point.</p>
|
|
<p>The following code will be inserted at the top of the <code>operating-system</code> definition.</p>
|
|
<p>Use the full Linux kernel. I hope I’ll be able to use Libre kernel somewhere later.</p>
|
|
<p>Inferior in the kernel is used to avoid recompilation. It looks like I can pin these to different commits than in my <code>channels.scm</code></p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">kernel</span>
|
|
(<span style="color:#a6e22e">let*</span>
|
|
((<span style="color:#a6e22e">channels</span>
|
|
(list (<span style="color:#a6e22e">channel</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">'nonguix</span>)
|
|
(<span style="color:#a6e22e">url</span> <span style="color:#e6db74">"https://gitlab.com/nonguix/nonguix"</span>)
|
|
(<span style="color:#a6e22e">commit</span> <span style="color:#e6db74">"d3c5eea0cbfe3e5bfbcf1fe15bc916fefacc624f"</span>))
|
|
(<span style="color:#a6e22e">channel</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">'guix</span>)
|
|
(<span style="color:#a6e22e">url</span> <span style="color:#e6db74">"https://git.savannah.gnu.org/git/guix.git"</span>)
|
|
(<span style="color:#a6e22e">commit</span> <span style="color:#e6db74">"cf88c967afbf15c58efb0ba37d6638f1be9a0481"</span>))))
|
|
(<span style="color:#a6e22e">inferior</span>
|
|
(<span style="color:#a6e22e">inferior-for-channels</span> channels)))
|
|
(<span style="color:#a6e22e">first</span> (<span style="color:#a6e22e">lookup-inferior-packages</span> inferior <span style="color:#e6db74">"linux"</span> <span style="color:#e6db74">"5.12.9"</span>))))
|
|
<span style="color:#75715e">;; (kernel linux)</span>
|
|
(<span style="color:#a6e22e">initrd</span> microcode-initrd)
|
|
(<span style="color:#a6e22e">firmware</span> (list linux-firmware))
|
|
(<span style="color:#a6e22e">locale</span> <span style="color:#e6db74">"en_US.utf8"</span>)
|
|
(<span style="color:#a6e22e">timezone</span> <span style="color:#e6db74">"Europe/Moscow"</span>)
|
|
</code></pre></div><p>US/RU keyboard layout, switch with Alt+Shift.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">keyboard-layout</span> (<span style="color:#a6e22e">keyboard-layout</span> <span style="color:#e6db74">"us,ru"</span> <span style="color:#f92672">#</span>:options <span style="color:#f92672">'</span>(<span style="color:#e6db74">"grp:alt_shift_toggle"</span>)))
|
|
</code></pre></div><p>User accounts.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">users</span> (<span style="color:#a6e22e">cons*</span> (<span style="color:#a6e22e">user-account</span>
|
|
(<span style="color:#a6e22e">name</span> <span style="color:#e6db74">"pavel"</span>)
|
|
(<span style="color:#a6e22e">comment</span> <span style="color:#e6db74">"Pavel"</span>)
|
|
(<span style="color:#a6e22e">group</span> <span style="color:#e6db74">"users"</span>)
|
|
(<span style="color:#a6e22e">home-directory</span> <span style="color:#e6db74">"/home/pavel"</span>)
|
|
(<span style="color:#a6e22e">supplementary-groups</span>
|
|
<span style="color:#f92672">'</span>(<span style="color:#e6db74">"wheel"</span> <span style="color:#75715e">;; sudo</span>
|
|
<span style="color:#e6db74">"netdev"</span> <span style="color:#75715e">;; network devices</span>
|
|
<span style="color:#e6db74">"audio"</span>
|
|
<span style="color:#e6db74">"video"</span>
|
|
<span style="color:#e6db74">"input"</span>
|
|
<span style="color:#e6db74">"tty"</span>
|
|
<span style="color:#e6db74">"docker"</span>
|
|
<span style="color:#e6db74">"scanner"</span>
|
|
<span style="color:#e6db74">"libvirt"</span>
|
|
<span style="color:#e6db74">"lp"</span>)))
|
|
%base-user-accounts))
|
|
|
|
</code></pre></div><p>Base packages, necessary right after the installation.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">packages</span>
|
|
(<span style="color:#a6e22e">append</span>
|
|
(list nss-certs
|
|
git
|
|
i3-gaps
|
|
i3lock
|
|
openbox
|
|
xterm
|
|
vim)
|
|
%base-packages))
|
|
</code></pre></div><p>Default services for each machine:</p>
|
|
<ul>
|
|
<li>override the default <code>%desktop-services</code> to add OpenVPN support</li>
|
|
<li>add nix service</li>
|
|
<li>add docker service</li>
|
|
<li>add CUPS service</li>
|
|
<li>add libvirt service</li>
|
|
<li>add a symlink to ELF interpreter to where most Linux binaries expect it</li>
|
|
</ul>
|
|
<!--listend-->
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#66d9ef">define </span>%my-base-services
|
|
(<span style="color:#a6e22e">cons*</span>
|
|
(<span style="color:#a6e22e">service</span> openssh-service-type)
|
|
(<span style="color:#a6e22e">screen-locker-service</span> i3lock <span style="color:#e6db74">"i3lock"</span>)
|
|
(<span style="color:#a6e22e">extra-special-file</span> <span style="color:#e6db74">"/lib64/ld-linux-x86-64.so.2"</span> (<span style="color:#a6e22e">file-append</span> glibc <span style="color:#e6db74">"/lib/ld-linux-x86-64.so.2"</span>))
|
|
(<span style="color:#a6e22e">service</span> nix-service-type)
|
|
(<span style="color:#a6e22e">service</span> cups-service-type
|
|
(<span style="color:#a6e22e">cups-configuration</span>
|
|
(<span style="color:#a6e22e">web-interface?</span> <span style="color:#66d9ef">#t</span>)))
|
|
(<span style="color:#a6e22e">service</span> docker-service-type)
|
|
(<span style="color:#a6e22e">service</span> libvirt-service-type
|
|
(<span style="color:#a6e22e">libvirt-configuration</span>
|
|
(<span style="color:#a6e22e">unix-sock-group</span> <span style="color:#e6db74">"libvirt"</span>)
|
|
(<span style="color:#a6e22e">tls-port</span> <span style="color:#e6db74">"16555"</span>)))
|
|
(<span style="color:#a6e22e">service</span> virtlog-service-type)
|
|
(<span style="color:#a6e22e">modify-services</span> %desktop-services
|
|
(<span style="color:#a6e22e">network-manager-service-type</span>
|
|
config =>
|
|
(<span style="color:#a6e22e">network-manager-configuration</span>
|
|
(<span style="color:#a6e22e">inherit</span> config)
|
|
(<span style="color:#a6e22e">vpn-plugins</span> (list network-manager-openvpn)))))))
|
|
|
|
</code></pre></div><h3 id="indigo">indigo</h3>
|
|
<p><code>indigo</code> is my desktop PC.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme"><<system-common>>
|
|
|
|
(<span style="color:#a6e22e">operating-system</span>
|
|
<<system-base>>
|
|
|
|
(<span style="color:#a6e22e">host-name</span> <span style="color:#e6db74">"indigo"</span>)
|
|
(<span style="color:#a6e22e">services</span> (<span style="color:#a6e22e">cons*</span>
|
|
(<span style="color:#a6e22e">set-xorg-configuration</span>
|
|
(<span style="color:#a6e22e">xorg-configuration</span>
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
%my-base-services))
|
|
|
|
(<span style="color:#a6e22e">bootloader</span>
|
|
(<span style="color:#a6e22e">bootloader-configuration</span>
|
|
(<span style="color:#a6e22e">bootloader</span> grub-efi-bootloader)
|
|
(<span style="color:#a6e22e">target</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
|
|
(<span style="color:#a6e22e">swap-devices</span>
|
|
(list (<span style="color:#a6e22e">uuid</span> <span style="color:#e6db74">"059a2c26-8f70-4986-adf0-1a2e7b511404"</span>)))
|
|
|
|
(<span style="color:#a6e22e">file-systems</span>
|
|
(<span style="color:#a6e22e">cons*</span> (<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/"</span>)
|
|
(<span style="color:#a6e22e">device</span> (<span style="color:#a6e22e">file-system-label</span> <span style="color:#e6db74">"my-root"</span>))
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"ext4"</span>))
|
|
(<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">device</span> <span style="color:#e6db74">"/dev/sda1"</span>)
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"vfat"</span>))
|
|
%base-file-systems)))
|
|
</code></pre></div><h3 id="eminence">eminence</h3>
|
|
<p><code>eminence</code> is a HP 15s laptop.</p>
|
|
<p><code>%backlight-udev-rule</code> should enable members of <code>video</code> group change the display backlight. See the relevant page at <a href="https://wiki.archlinux.org/title/Backlight">Arch Wiki</a>.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme"><<system-common>>
|
|
|
|
(<span style="color:#66d9ef">define </span>%backlight-udev-rule
|
|
(<span style="color:#a6e22e">udev-rule</span>
|
|
<span style="color:#e6db74">"90-backlight.rules"</span>
|
|
(string-append <span style="color:#e6db74">"ACTION==\"add\", SUBSYSTEM==\"backlight\", "</span>
|
|
<span style="color:#e6db74">"RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\""</span>
|
|
<span style="color:#e6db74">"\n"</span>
|
|
<span style="color:#e6db74">"ACTION==\"add\", SUBSYSTEM==\"backlight\", "</span>
|
|
<span style="color:#e6db74">"RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\""</span>)))
|
|
|
|
(<span style="color:#a6e22e">operating-system</span>
|
|
<<system-base>>
|
|
|
|
(<span style="color:#a6e22e">host-name</span> <span style="color:#e6db74">"eminence"</span>)
|
|
(<span style="color:#a6e22e">services</span> (<span style="color:#a6e22e">cons*</span>
|
|
(<span style="color:#a6e22e">set-xorg-configuration</span>
|
|
(<span style="color:#a6e22e">xorg-configuration</span>
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
(<span style="color:#a6e22e">modify-services</span> %my-base-services
|
|
(<span style="color:#a6e22e">elogind-service-type</span>
|
|
config =>
|
|
(<span style="color:#a6e22e">elogind-configuration</span>
|
|
(<span style="color:#a6e22e">inherit</span> config)
|
|
(<span style="color:#a6e22e">handle-lid-switch-external-power</span> <span style="color:#e6db74">'suspend</span>)))
|
|
(<span style="color:#a6e22e">udev-service-type</span>
|
|
config =>
|
|
(<span style="color:#a6e22e">udev-configuration</span>
|
|
(<span style="color:#a6e22e">inherit</span> config)
|
|
(<span style="color:#a6e22e">rules</span> (cons %backlight-udev-rule
|
|
(<span style="color:#a6e22e">udev-configuration-rules</span> config))))))))
|
|
|
|
(<span style="color:#a6e22e">bootloader</span>
|
|
(<span style="color:#a6e22e">bootloader-configuration</span>
|
|
(<span style="color:#a6e22e">bootloader</span> grub-efi-bootloader)
|
|
(<span style="color:#a6e22e">target</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
|
|
(<span style="color:#a6e22e">swap-devices</span>
|
|
(list (<span style="color:#a6e22e">uuid</span> <span style="color:#e6db74">"f93cf3f6-7ee7-42ec-8ee2-f3d896fdf9b5"</span>)))
|
|
|
|
(<span style="color:#a6e22e">file-systems</span>
|
|
(<span style="color:#a6e22e">cons*</span> (<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/"</span>)
|
|
(<span style="color:#a6e22e">device</span>
|
|
(<span style="color:#a6e22e">uuid</span> <span style="color:#e6db74">"1d937704-bbeb-43b5-bc63-453886c426af"</span>
|
|
<span style="color:#e6db74">'ext4</span>))
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"ext4"</span>))
|
|
(<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">device</span> (<span style="color:#a6e22e">uuid</span> <span style="color:#e6db74">"0031-3784"</span> <span style="color:#e6db74">'fat32</span>))
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"vfat"</span>))
|
|
%base-file-systems)))
|
|
</code></pre></div><h3 id="azure">azure</h3>
|
|
<p><code>azure</code> is a Lenovo Ideapad 330 laptop.</p>
|
|
<p><code>%backlight-udev-rule</code> should enable members of <code>video</code> group change the display backlight. See the relevant page at <a href="https://wiki.archlinux.org/title/Backlight">Arch Wiki</a>.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme"><<system-common>>
|
|
|
|
(<span style="color:#66d9ef">define </span>%backlight-udev-rule
|
|
(<span style="color:#a6e22e">udev-rule</span>
|
|
<span style="color:#e6db74">"90-backlight.rules"</span>
|
|
(string-append <span style="color:#e6db74">"ACTION==\"add\", SUBSYSTEM==\"backlight\", "</span>
|
|
<span style="color:#e6db74">"RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\""</span>
|
|
<span style="color:#e6db74">"\n"</span>
|
|
<span style="color:#e6db74">"ACTION==\"add\", SUBSYSTEM==\"backlight\", "</span>
|
|
<span style="color:#e6db74">"RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\""</span>)))
|
|
|
|
(<span style="color:#a6e22e">operating-system</span>
|
|
<<system-base>>
|
|
|
|
(<span style="color:#a6e22e">host-name</span> <span style="color:#e6db74">"azure"</span>)
|
|
(<span style="color:#a6e22e">services</span> (<span style="color:#a6e22e">cons*</span>
|
|
(<span style="color:#a6e22e">set-xorg-configuration</span>
|
|
(<span style="color:#a6e22e">xorg-configuration</span>
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
(<span style="color:#a6e22e">modify-services</span> %my-base-services
|
|
(<span style="color:#a6e22e">elogind-service-type</span> config =>
|
|
(<span style="color:#a6e22e">elogind-configuration</span> (<span style="color:#a6e22e">inherit</span> config)
|
|
(<span style="color:#a6e22e">handle-lid-switch-external-power</span> <span style="color:#e6db74">'suspend</span>)))
|
|
(<span style="color:#a6e22e">udev-service-type</span> config =>
|
|
(<span style="color:#a6e22e">udev-configuration</span> (<span style="color:#a6e22e">inherit</span> config)
|
|
(<span style="color:#a6e22e">rules</span> (cons %backlight-udev-rule
|
|
(<span style="color:#a6e22e">udev-configuration-rules</span> config))))))))
|
|
|
|
(<span style="color:#a6e22e">bootloader</span>
|
|
(<span style="color:#a6e22e">bootloader-configuration</span>
|
|
(<span style="color:#a6e22e">bootloader</span> grub-efi-bootloader)
|
|
(<span style="color:#a6e22e">target</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">keyboard-layout</span> keyboard-layout)))
|
|
|
|
(<span style="color:#a6e22e">swap-devices</span>
|
|
(list (<span style="color:#a6e22e">uuid</span> <span style="color:#e6db74">"4b2dedb3-b111-4e69-8c05-6daa2b072c76"</span>)))
|
|
|
|
(<span style="color:#a6e22e">file-systems</span>
|
|
(<span style="color:#a6e22e">cons*</span> (<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/"</span>)
|
|
(<span style="color:#a6e22e">device</span> (<span style="color:#a6e22e">file-system-label</span> <span style="color:#e6db74">"my-root"</span>))
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"ext4"</span>))
|
|
(<span style="color:#a6e22e">file-system</span>
|
|
(<span style="color:#a6e22e">mount-point</span> <span style="color:#e6db74">"/boot/efi"</span>)
|
|
(<span style="color:#a6e22e">device</span> <span style="color:#e6db74">"/dev/sda1"</span>)
|
|
(<span style="color:#a6e22e">type</span> <span style="color:#e6db74">"vfat"</span>))
|
|
%base-file-systems)))
|
|
</code></pre></div><h2 id="system-installation">System installation</h2>
|
|
<h3 id="preparation">Preparation</h3>
|
|
<p>In my case, the provided ISO doesn’t work because of the Libre kernel.</p>
|
|
<p>Fortunately, David Wilson has made <a href="https://github.com/SystemCrafters/guix-installer">a repository</a> with a toolchain to make an ISO with the full kernel. In case it won’t be an option, the <a href="https://gitlab.com/nonguix/nonguix">nonguix repo</a> also has instructions on how to do that.</p>
|
|
<p>When an ISO is there, we have to write it on a USB stick. Run <code>sudo fdisk -l</code> to get a list of disks.</p>
|
|
<p>The approach in the official instruction is to create a bootable USB with <code>dd</code>:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">sudo dd of=/dev/sdxX if=<path-to-iso> status=progress && sync
|
|
</code></pre></div><p>However, I couldn’t make it work for some strange reason. Fortunately, <code>gnome-disk-utility</code> was able to produce a bootable USB.</p>
|
|
<h3 id="installation">Installation</h3>
|
|
<p>Going further, the official instructions for installation & SystemCrafters wiki entry are pretty good, so it’s not necessary to repeat them here.</p>
|
|
<h3 id="after-installation">After installation</h3>
|
|
<p>After the installation, the strategy is as follows.</p>
|
|
<p>Set a password for the main user (pavel). Login with openbox to get a tolerable interface because the i3 default config is horrible.</p>
|
|
<p><a href="https://guix.gnu.org/en/manual/en/html%5Fnode/Keyboard-Layout-and-Networking-and-Partitioning.html#Keyboard-Layout-and-Networking-and-Partitioning">Connect to the internet</a>.</p>
|
|
<p>Clone the dotfiles repo:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">mkdir Code
|
|
cd Code
|
|
git clone https://github.com/SqrtMinusOne/dotfiles.git
|
|
</code></pre></div><p>Copy the channels file and run guix pull:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">cp ~/Code/dotfiles/.config/guix/channels.scm ~/.config/guix
|
|
guix pull
|
|
</code></pre></div><p>The first pull usually takes a while. After that install yadm and pull dotfiles:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">guix install yadm
|
|
guix clone https://github.com/SqrtMinusOne/dotfiles.git
|
|
</code></pre></div><p>And activate the required profiles. Again, downloading & building Emacs, Starship and stuff will take a while.</p>
|
|
<p>Don’t forget to install <code>JetBrainsMono Nerd Font</code>.</p>
|
|
<h2 id="misc-software-and-notes">Misc software & notes</h2>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Category</th>
|
|
<th>Guix dependency</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>system</td>
|
|
<td>patchelf</td>
|
|
<td>A program to modify existsing ELF executables</td>
|
|
</tr>
|
|
<tr>
|
|
<td>system</td>
|
|
<td>glibc</td>
|
|
<td>A lot of stuff, including ELF interpeter and <code>ldd</code></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="vpn">VPN</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Category</th>
|
|
<th>Guix dependency</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>system</td>
|
|
<td>openvpn</td>
|
|
</tr>
|
|
<tr>
|
|
<td>system</td>
|
|
<td>openvpn-update-resolve-conf</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>I’m not sure how to properly spin up VPN on Guix, so here is what I’m doing now, after some trial and error.</p>
|
|
<p>I’m currently using CyberGhost VPN. <code>~/.vpn</code> folder stores its OpenVPN config (<code>openvpn.ovpn</code>), modified as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>paths to <code>ca</code>, <code>cert</code> and <code>key</code> are made absolute</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-vim" data-lang="vim"><span style="color:#a6e22e">ca</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.vpn/</span><span style="color:#a6e22e">ca</span>.<span style="color:#a6e22e">crt</span><span style="color:#960050;background-color:#1e0010">
|
|
</span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#a6e22e">cert</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.vpn/</span><span style="color:#a6e22e">client</span>.<span style="color:#a6e22e">crt</span><span style="color:#960050;background-color:#1e0010">
|
|
</span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#a6e22e">key</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.vpn/</span><span style="color:#a6e22e">client</span>.<span style="color:#a6e22e">key</span><span style="color:#960050;background-color:#1e0010">
|
|
</span></code></pre></div></li>
|
|
<li>
|
|
<p>added <code>auth-user-pass</code> with a link to login info</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-vim" data-lang="vim"><span style="color:#a6e22e">auth</span>-<span style="color:#a6e22e">user</span>-<span style="color:#a6e22e">pass</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.vpn/</span><span style="color:#a6e22e">auth</span>.<span style="color:#a6e22e">conf</span><span style="color:#960050;background-color:#1e0010">
|
|
</span></code></pre></div><p><code>auth.conf</code> looks like this:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">login
|
|
password
|
|
</code></pre></div></li>
|
|
<li>
|
|
<p>run <a href="https://github.com/alfredopalhares/openvpn-update-resolv-conf">openvpn-update-resolv-conf</a> script to fix DNS. <code>openvpn-update-resolve-conf</code> originates in my <a href="https://github.com/SqrtMinusOne/channel-q">channel-q</a>.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-vim" data-lang="vim"><span style="color:#a6e22e">setenv</span> <span style="color:#a6e22e">PATH</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.guix-extra-profiles/</span><span style="color:#a6e22e">system</span><span style="color:#e6db74">/system/</span><span style="color:#a6e22e">bin</span>:<span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.guix-extra-profiles/</span><span style="color:#a6e22e">system</span><span style="color:#e6db74">/system/</span><span style="color:#a6e22e">sbin</span>:<span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.guix-extra-profiles/</span><span style="color:#a6e22e">console</span><span style="color:#e6db74">/console/</span><span style="color:#a6e22e">bin</span>:<span style="color:#e6db74">/run/</span><span style="color:#a6e22e">current</span>-<span style="color:#a6e22e">system</span><span style="color:#e6db74">/profile/</span><span style="color:#a6e22e">bin</span>:<span style="color:#e6db74">/run/</span><span style="color:#a6e22e">current</span>-<span style="color:#a6e22e">system</span><span style="color:#e6db74">/profile/</span><span style="color:#a6e22e">sbin</span><span style="color:#960050;background-color:#1e0010">
|
|
</span><span style="color:#960050;background-color:#1e0010">
|
|
</span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#a6e22e">up</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.guix-extra-profiles/</span><span style="color:#a6e22e">system</span><span style="color:#e6db74">/system/</span><span style="color:#a6e22e">bin</span>/<span style="color:#a6e22e">update</span>-<span style="color:#a6e22e">resolv</span>-<span style="color:#a6e22e">conf</span>.<span style="color:#a6e22e">sh</span><span style="color:#960050;background-color:#1e0010">
|
|
</span><span style="color:#960050;background-color:#1e0010"></span><span style="color:#a6e22e">down</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/.guix-extra-profiles/</span><span style="color:#a6e22e">system</span><span style="color:#e6db74">/system/</span><span style="color:#a6e22e">bin</span>/<span style="color:#a6e22e">update</span>-<span style="color:#a6e22e">resolv</span>-<span style="color:#a6e22e">conf</span>.<span style="color:#a6e22e">sh</span><span style="color:#960050;background-color:#1e0010">
|
|
</span></code></pre></div><p><code>setenv PATH</code> is necessary because both <code>resolvconf</code> (openresolve) and <code>update-resolv-conf.sh</code> are shell scripts which need GNU coreutils and stuff, and OpenVPN clears PATH by default.</p>
|
|
</li>
|
|
<li>
|
|
<p>run a script to fix Docker routes</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-vim" data-lang="vim"><span style="color:#a6e22e">route</span>-<span style="color:#a6e22e">up</span> <span style="color:#e6db74">/home/</span><span style="color:#a6e22e">pavel</span><span style="color:#e6db74">/bin/</span><span style="color:#a6e22e">scripts</span>/<span style="color:#a6e22e">vpn</span>-<span style="color:#a6e22e">fix</span>-<span style="color:#a6e22e">routes</span><span style="color:#960050;background-color:#1e0010">
|
|
</span></code></pre></div><p>References:</p>
|
|
<ul>
|
|
<li><a href="https://github.com/moby/libnetwork/issues/779">Github issue</a></li>
|
|
</ul>
|
|
<p>The script itself:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh">echo <span style="color:#e6db74">"Adding default route to </span>$route_vpn_gateway<span style="color:#e6db74"> with /0 mask..."</span>
|
|
|
|
IP<span style="color:#f92672">=</span>/run/current-system/profile/sbin/ip
|
|
|
|
$IP route add default via $route_vpn_gateway
|
|
|
|
echo <span style="color:#e6db74">"Removing /1 routes..."</span>
|
|
$IP route del 0.0.0.0/1 via $route_vpn_gateway
|
|
$IP route del 128.0.0.0/1 via $route_vpn_gateway
|
|
</code></pre></div></li>
|
|
</ul>
|
|
<h4 id="vpn-start">vpn-start</h4>
|
|
<p>As of now, CyberGhost doesn’t provide ipv6, so we have to disable it.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">export DISPLAY<span style="color:#f92672">=</span>:0
|
|
CONN<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>nmcli -f NAME con show --active | grep -Ev <span style="color:#e6db74">"(.*docker.*|NAME|br-.*|veth.*|tun.*|vnet.*|virbr.*)"</span> | sed <span style="color:#e6db74">'s/ *$//g'</span><span style="color:#66d9ef">)</span>
|
|
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -z <span style="color:#e6db74">"</span>$CONN<span style="color:#e6db74">"</span> <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
|
|
echo <span style="color:#e6db74">"No connection!"</span>
|
|
notify-send <span style="color:#e6db74">"VPN"</span> <span style="color:#e6db74">"No connection for VPN to run"</span>
|
|
exit
|
|
<span style="color:#66d9ef">fi</span>
|
|
|
|
echo <span style="color:#e6db74">"Connection: </span>$CONN<span style="color:#e6db74">"</span>
|
|
notify-send <span style="color:#e6db74">"VPN"</span> <span style="color:#e6db74">"Initializing for connection: </span>$CONN<span style="color:#e6db74">"</span>
|
|
|
|
pkexec nmcli con modify <span style="color:#e6db74">"</span>$CONN<span style="color:#e6db74">"</span> ipv6.method ignore
|
|
nmcli connection up <span style="color:#e6db74">"</span>$CONN<span style="color:#e6db74">"</span>
|
|
pkexec openvpn --config ~/.vpn/openvpn.ovpn
|
|
</code></pre></div><h4 id="vpn-stop">vpn-stop</h4>
|
|
<p>Also a script to reverse the changes.</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">CONN<span style="color:#f92672">=</span><span style="color:#66d9ef">$(</span>nmcli -f NAME con show --active | grep -Ev <span style="color:#e6db74">"(.*docker.*|NAME|br-.*|veth.*|tun.*)"</span> | sed <span style="color:#e6db74">'s/ *$//g'</span><span style="color:#66d9ef">)</span>
|
|
echo <span style="color:#e6db74">"Connection: </span>$CONN<span style="color:#e6db74">"</span>
|
|
|
|
pkexec nmcli con modify <span style="color:#e6db74">"</span>$CONN<span style="color:#e6db74">"</span> ipv6.method auto
|
|
nmcli connection up <span style="color:#e6db74">"</span>$CONN<span style="color:#e6db74">"</span>
|
|
</code></pre></div><h3 id="flatpak">flatpak</h3>
|
|
<p>As for now, the easiest way to install most of proprietary software is via flatpak. See the relevant section in <a href="/configs/desktop/">Desktop.org</a>.</p>
|
|
<h3 id="conda">conda</h3>
|
|
<p><a href="https://docs.conda.io/en/latest/">conda</a> is a package manager, which I use for managing various versions of Python & Node.js.</p>
|
|
<p>It is packaged for GNU Guix, although the definition has its fair share of workarounds. It is almost surprising to see it work with all the C libraries and stuff. But there are still some problems.</p>
|
|
<p>First, it’s impossible to perform <code>conda init</code> to patch files like <code>.bashrc</code>, because the command is hell-bent on modifying <code>/gnu/store/</code>. So I do this manually, look for the <code>init_conda</code> procedures in <a href="/configs/console/">Console.org</a>.</p>
|
|
<p>Second, base environment root is <code>/gnu/store</code>, so don’t install anything there.</p>
|
|
<p>Third, by default it tries to create envronments in <code>/gnu/store</code>. I think it’s enough to create one environment like this to fix it:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh">mkdir -p ~/.conda/envs
|
|
conda create -p ~/.conda/envs/test
|
|
</code></pre></div><p>Finally, I also want to have an ability to use global npm. Some settings for that are located in <a href="Console">Console.org</a>. Here we want to unset <code>NPM_CONFIG_USERCONFIG</code> if there is npm available in the environment.</p>
|
|
<p>So here is a script to set up conda hooks:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#75715e"># Get writable conda envs with npm & without</span>
|
|
readarray -t CONDA_ENVS_ALL <span style="color:#f92672"><<<</span> <span style="color:#66d9ef">$(</span>conda env list --json | jq <span style="color:#e6db74">'.envs[]'</span><span style="color:#66d9ef">)</span>
|
|
CONDA_ENVS_NPM<span style="color:#f92672">=()</span>
|
|
CONDA_ENVS_NO_NPM<span style="color:#f92672">=()</span>
|
|
<span style="color:#66d9ef">for</span> env in <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>CONDA_ENVS_ALL[@]<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>; <span style="color:#66d9ef">do</span>
|
|
env<span style="color:#f92672">=</span><span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>env:1:<span style="color:#e6db74">${#</span>env<span style="color:#e6db74">}</span>-2<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -w <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">"</span> <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
|
|
<span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -f <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/bin/npm"</span> <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
|
|
CONDA_ENVS_NPM<span style="color:#f92672">+=(</span>$env<span style="color:#f92672">)</span>
|
|
<span style="color:#66d9ef">else</span>
|
|
CONDA_ENVS_NO_NPM<span style="color:#f92672">+=(</span>$env<span style="color:#f92672">)</span>
|
|
<span style="color:#66d9ef">fi</span>
|
|
<span style="color:#66d9ef">fi</span>
|
|
<span style="color:#66d9ef">done</span>
|
|
|
|
<span style="color:#66d9ef">for</span> env in <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>CONDA_ENVS_NPM[@]<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>; <span style="color:#66d9ef">do</span>
|
|
echo <span style="color:#e6db74">"Found npm in </span>$env<span style="color:#e6db74">"</span>
|
|
mkdir -p <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/activate.d"</span>
|
|
mkdir -p <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/deactivate.d"</span>
|
|
|
|
echo <span style="color:#e6db74">"unset NPM_CONFIG_USERCONFIG"</span> > <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/activate.d/conda.sh"</span>
|
|
echo <span style="color:#e6db74">"set -e NPM_CONFIG_USERCONFIG"</span> > <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/activate.d/conda.fish"</span>
|
|
echo <span style="color:#e6db74">"export NPM_CONFIG_USERCONFIG=</span>$HOME<span style="color:#e6db74">/._npmrc"</span> > <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/deactivate.d/conda.sh"</span>
|
|
echo <span style="color:#e6db74">"export NPM_CONFIG_USERCONFIG=</span>$HOME<span style="color:#e6db74">/._npmrc"</span> > <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/deactivate.d/conda.fish"</span>
|
|
<span style="color:#66d9ef">done</span>
|
|
|
|
<span style="color:#66d9ef">for</span> env in <span style="color:#e6db74">"</span><span style="color:#e6db74">${</span>CONDA_ENVS_NO_NPM<span style="color:#e6db74">}</span><span style="color:#e6db74">"</span>; <span style="color:#66d9ef">do</span>
|
|
echo <span style="color:#e6db74">"Did not found npm in </span>$env<span style="color:#e6db74">"</span>
|
|
rm -rf <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/activate.d/conda.sh"</span> <span style="color:#f92672">||</span> true
|
|
rm -rf <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/activate.d/conda.fish"</span> <span style="color:#f92672">||</span> true
|
|
rm -rf <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/deactivate.d/conda.sh"</span> <span style="color:#f92672">||</span> true
|
|
rm -rf <span style="color:#e6db74">"</span>$env<span style="color:#e6db74">/etc/conda/deactivate.d/conda.fish"</span> <span style="color:#f92672">||</span> true
|
|
<span style="color:#66d9ef">done</span>
|
|
</code></pre></div><h3 id="slack">Slack</h3>
|
|
<p>What a nonsense of a program.</p>
|
|
<p>I was able to launch the nix version with the following wrapper script:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">export PATH<span style="color:#f92672">=</span><span style="color:#e6db74">"</span>$HOME<span style="color:#e6db74">/bin/dummies:</span>$PATH<span style="color:#e6db74">"</span>
|
|
mkdir -p ~/.cache/slack
|
|
slack -r ~/.cache/slack
|
|
</code></pre></div><p>Also, it requires a <code>lsb_release</code> in the PATH, so here is one:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">echo <span style="color:#e6db74">"LSB Version: Hey. I spent an hour figuring out why Slack doesn't launch."</span>
|
|
echo <span style="color:#e6db74">"Distributor ID: It seems like it requires an lsb_release."</span>
|
|
echo <span style="color:#e6db74">"Description: But GNU Guix doesn't have one."</span>
|
|
echo <span style="color:#e6db74">"Release: 42.2"</span>
|
|
echo <span style="color:#e6db74">"Codename: n/a"</span>
|
|
</code></pre></div><h3 id="virt-manager">virt-manager</h3>
|
|
<p>Run the following to fix the network:</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-sh" data-lang="sh">sudo virsh net-define /run/current-system/profile/etc/libvirt/qemu/networks/default.xml
|
|
sudo virsh net-start default
|
|
sudo herd restart libvirtd
|
|
</code></pre></div><h3 id="wakatime-cli">wakatime-cli</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Note</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>TODO</td>
|
|
<td>Package this for Guix</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Before I figure out how to package this for Guix:</p>
|
|
<ul>
|
|
<li>Clone <a href="https://github.com/wakatime/wakatime-cli">the repo</a></li>
|
|
<li>Run <code>go build</code></li>
|
|
<li>Copy the binary to the <code>~/bin</code> folder</li>
|
|
</ul>
|
|
<h3 id="manifest">Manifest</h3>
|
|
<p><a id="code-snippet--packages"></a></p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-emacs-lisp" data-lang="emacs-lisp">(my/format-guix-dependencies category)
|
|
</code></pre></div><p>System</p>
|
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-scheme" data-lang="scheme">(<span style="color:#a6e22e">specifications->manifest</span>
|
|
<span style="color:#f92672">'</span>(
|
|
<<packages(<span style="color:#e6db74">"system"</span>)>>))
|
|
</code></pre></div>
|
|
</div>
|
|
|
|
</div><div id="footer" class="mb-5">
|
|
<hr>
|
|
<div class="container text-center">
|
|
|
|
</div>
|
|
|
|
<div class="container text-center">
|
|
<a href="https://sqrtminusone.xyz/" title="Pavel Korytov, 2021"><small>Pavel Korytov, 2021</small></a>
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|