mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-14 12:20:19 +00:00
deploy: a89ce9ad6a7470e87090025d2d92de7128db5d2b
This commit is contained in:
@@ -151,81 +151,81 @@ As of right now, the latest AUR is <code>4.2.2-1</code>.</p>
|
||||
<p>These steps highlight how to get it working with <code>Python3.8</code> by making a 1 line modification to AppGate source code.</p>
|
||||
<h1 id=packaging>Packaging</h1>
|
||||
<p>We already know the community package is currently out of date, so let’s clone 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-shell data-lang=shell>git clone https://aur.archlinux.org/appgate-sdp.git
|
||||
cd appgate-sdp
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>git clone https://aur.archlinux.org/appgate-sdp.git
|
||||
<span style=color:#366>cd</span> appgate-sdp
|
||||
</code></pre></div><p>You’ll likely notice that the version is not what we want, so let’s modify the <code>PKGBUILD</code> to the following:</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-shell data-lang=shell><span style=color:#75715e># Maintainer: Pawel Mosakowski <pawel at mosakowski dot net></span>
|
||||
pkgname<span style=color:#f92672>=</span>appgate-sdp
|
||||
conflicts<span style=color:#f92672>=(</span><span style=color:#e6db74>'appgate-sdp-headless'</span><span style=color:#f92672>)</span>
|
||||
pkgver<span style=color:#f92672>=</span>4.3.2
|
||||
_download_pkgver<span style=color:#f92672>=</span>4.3
|
||||
pkgrel<span style=color:#f92672>=</span><span style=color:#ae81ff>1</span>
|
||||
epoch<span style=color:#f92672>=</span>
|
||||
pkgdesc<span style=color:#f92672>=</span><span style=color:#e6db74>"Software Defined Perimeter - GUI client"</span>
|
||||
arch<span style=color:#f92672>=(</span><span style=color:#e6db74>'x86_64'</span><span style=color:#f92672>)</span>
|
||||
url<span style=color:#f92672>=</span><span style=color:#e6db74>"https://www.cyxtera.com/essential-defense/appgate-sdp/support"</span>
|
||||
license<span style=color:#f92672>=(</span><span style=color:#e6db74>'custom'</span><span style=color:#f92672>)</span>
|
||||
<span style=color:#75715e># dependecies calculated by namcap</span>
|
||||
depends<span style=color:#f92672>=(</span><span style=color:#e6db74>'gconf'</span> <span style=color:#e6db74>'libsecret'</span> <span style=color:#e6db74>'gtk3'</span> <span style=color:#e6db74>'python'</span> <span style=color:#e6db74>'nss'</span> <span style=color:#e6db74>'libxss'</span> <span style=color:#e6db74>'nodejs'</span> <span style=color:#e6db74>'dnsmasq'</span><span style=color:#f92672>)</span>
|
||||
source<span style=color:#f92672>=(</span><span style=color:#e6db74>"https://sdpdownloads.cyxtera.com/AppGate-SDP-</span><span style=color:#e6db74>${</span>_download_pkgver<span style=color:#e6db74>}</span><span style=color:#e6db74>/clients/</span><span style=color:#e6db74>${</span>pkgname<span style=color:#e6db74>}</span><span style=color:#e6db74>_</span><span style=color:#e6db74>${</span>pkgver<span style=color:#e6db74>}</span><span style=color:#e6db74>_amd64.deb"</span>
|
||||
<span style=color:#e6db74>"appgatedriver.service"</span><span style=color:#f92672>)</span>
|
||||
options<span style=color:#f92672>=(</span>staticlibs<span style=color:#f92672>)</span>
|
||||
prepare<span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=color:#09f;font-style:italic># Maintainer: Pawel Mosakowski <pawel at mosakowski dot net></span>
|
||||
<span style=color:#033>pkgname</span><span style=color:#555>=</span>appgate-sdp
|
||||
<span style=color:#033>conflicts</span><span style=color:#555>=(</span><span style=color:#c30>'appgate-sdp-headless'</span><span style=color:#555>)</span>
|
||||
<span style=color:#033>pkgver</span><span style=color:#555>=</span>4.3.2
|
||||
<span style=color:#033>_download_pkgver</span><span style=color:#555>=</span>4.3
|
||||
<span style=color:#033>pkgrel</span><span style=color:#555>=</span><span style=color:#f60>1</span>
|
||||
<span style=color:#033>epoch</span><span style=color:#555>=</span>
|
||||
<span style=color:#033>pkgdesc</span><span style=color:#555>=</span><span style=color:#c30>"Software Defined Perimeter - GUI client"</span>
|
||||
<span style=color:#033>arch</span><span style=color:#555>=(</span><span style=color:#c30>'x86_64'</span><span style=color:#555>)</span>
|
||||
<span style=color:#033>url</span><span style=color:#555>=</span><span style=color:#c30>"https://www.cyxtera.com/essential-defense/appgate-sdp/support"</span>
|
||||
<span style=color:#033>license</span><span style=color:#555>=(</span><span style=color:#c30>'custom'</span><span style=color:#555>)</span>
|
||||
<span style=color:#09f;font-style:italic># dependecies calculated by namcap</span>
|
||||
<span style=color:#033>depends</span><span style=color:#555>=(</span><span style=color:#c30>'gconf'</span> <span style=color:#c30>'libsecret'</span> <span style=color:#c30>'gtk3'</span> <span style=color:#c30>'python'</span> <span style=color:#c30>'nss'</span> <span style=color:#c30>'libxss'</span> <span style=color:#c30>'nodejs'</span> <span style=color:#c30>'dnsmasq'</span><span style=color:#555>)</span>
|
||||
<span style=color:#033>source</span><span style=color:#555>=(</span><span style=color:#c30>"https://sdpdownloads.cyxtera.com/AppGate-SDP-</span><span style=color:#a00>${</span><span style=color:#033>_download_pkgver</span><span style=color:#a00>}</span><span style=color:#c30>/clients/</span><span style=color:#a00>${</span><span style=color:#033>pkgname</span><span style=color:#a00>}</span><span style=color:#c30>_</span><span style=color:#a00>${</span><span style=color:#033>pkgver</span><span style=color:#a00>}</span><span style=color:#c30>_amd64.deb"</span>
|
||||
<span style=color:#c30>"appgatedriver.service"</span><span style=color:#555>)</span>
|
||||
<span style=color:#033>options</span><span style=color:#555>=(</span>staticlibs<span style=color:#555>)</span>
|
||||
prepare<span style=color:#555>()</span> <span style=color:#555>{</span>
|
||||
tar -xf data.tar.xz
|
||||
<span style=color:#f92672>}</span>
|
||||
package<span style=color:#f92672>()</span> <span style=color:#f92672>{</span>
|
||||
cp -dpr <span style=color:#e6db74>"</span><span style=color:#e6db74>${</span>srcdir<span style=color:#e6db74>}</span><span style=color:#e6db74>"</span>/<span style=color:#f92672>{</span>etc,lib,opt,usr<span style=color:#f92672>}</span> <span style=color:#e6db74>"</span><span style=color:#e6db74>${</span>pkgdir<span style=color:#e6db74>}</span><span style=color:#e6db74>"</span>
|
||||
mv -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/lib/systemd/system"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/lib/systemd/"</span>
|
||||
rm -vrf <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/lib"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$srcdir<span style=color:#e6db74>/appgatedriver.service"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/lib/systemd/system/appgatedriver.service"</span>
|
||||
mkdir -vp <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/copyright"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/LICENSE.github"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/doc/appgate/LICENSES.chromium.html.bz2"</span> <span style=color:#e6db74>"</span>$pkgdir<span style=color:#e6db74>/usr/share/licenses/appgate-sdp"</span>
|
||||
<span style=color:#f92672>}</span>
|
||||
md5sums<span style=color:#f92672>=(</span><span style=color:#e6db74>'17101aac7623c06d5fbb95f50cf3dbdc'</span>
|
||||
<span style=color:#e6db74>'002644116e20b2d79fdb36b7677ab4cf'</span><span style=color:#f92672>)</span>
|
||||
<span style=color:#555>}</span>
|
||||
package<span style=color:#555>()</span> <span style=color:#555>{</span>
|
||||
cp -dpr <span style=color:#c30>"</span><span style=color:#a00>${</span><span style=color:#033>srcdir</span><span style=color:#a00>}</span><span style=color:#c30>"</span>/<span style=color:#555>{</span>etc,lib,opt,usr<span style=color:#555>}</span> <span style=color:#c30>"</span><span style=color:#a00>${</span><span style=color:#033>pkgdir</span><span style=color:#a00>}</span><span style=color:#c30>"</span>
|
||||
mv -v <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/lib/systemd/system"</span> <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/lib/systemd/"</span>
|
||||
rm -vrf <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/lib"</span>
|
||||
cp -v <span style=color:#c30>"</span><span style=color:#033>$srcdir</span><span style=color:#c30>/appgatedriver.service"</span> <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/lib/systemd/system/appgatedriver.service"</span>
|
||||
mkdir -vp <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/doc/appgate/copyright"</span> <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/doc/appgate/LICENSE.github"</span> <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/licenses/appgate-sdp"</span>
|
||||
cp -v <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/doc/appgate/LICENSES.chromium.html.bz2"</span> <span style=color:#c30>"</span><span style=color:#033>$pkgdir</span><span style=color:#c30>/usr/share/licenses/appgate-sdp"</span>
|
||||
<span style=color:#555>}</span>
|
||||
<span style=color:#033>md5sums</span><span style=color:#555>=(</span><span style=color:#c30>'17101aac7623c06d5fbb95f50cf3dbdc'</span>
|
||||
<span style=color:#c30>'002644116e20b2d79fdb36b7677ab4cf'</span><span style=color:#555>)</span>
|
||||
|
||||
</code></pre></div><p>Let’s first make sure we have some dependencies. If you do not have <a href=https://github.com/Jguer/yay>yay</a>, check it out.</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-shell data-lang=shell>yay -S dnsmasq gconf
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>yay -S dnsmasq gconf
|
||||
</code></pre></div><p>Now, let’s install 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-shell data-lang=shell>makepkg -si
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>makepkg -si
|
||||
</code></pre></div><h1 id=running-the-client>Running the client</h1>
|
||||
<p>Ok, let’s run the client by executing <code>appgate</code>.</p>
|
||||
<p>It complains about not being able to connect.</p>
|
||||
<p>Easy fix:</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-shell data-lang=shell>sudo systemctl start appgatedriver.service
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>sudo systemctl start appgatedriver.service
|
||||
</code></pre></div><p>Now we should be connected… but DNS is not working?</p>
|
||||
<h1 id=fixing-the-dns>Fixing the DNS</h1>
|
||||
<p>Running <code>resolvectl</code> should display that something is not right.</p>
|
||||
<p>Why is the DNS not being set by appgate?</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-shell data-lang=shell>$ head -3 /opt/appgate/linux/set_dns
|
||||
<span style=color:#75715e>#!/usr/bin/env python3</span>
|
||||
<span style=color:#e6db74>''</span><span style=color:#960050;background-color:#1e0010>'</span>
|
||||
This is used to set and unset the DNS.
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ head -3 /opt/appgate/linux/set_dns
|
||||
<span style=color:#09f;font-style:italic>#!/usr/bin/env python3</span>
|
||||
<span style=color:#c30>''</span><span style=color:#a00;background-color:#faa>'</span>
|
||||
This is used to <span style=color:#366>set</span> and <span style=color:#366>unset</span> the DNS.
|
||||
</code></pre></div><p>It seems like python3 is required for the DNS setting to happen.
|
||||
Let’s try to run 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-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#e6db74>"is"</span> with a literal. Did you mean <span style=color:#e6db74>"=="</span>?
|
||||
servers <span style=color:#f92672>=</span> <span style=color:#f92672>[(</span> socket.AF_INET <span style=color:#66d9ef>if</span> x.version is <span style=color:#ae81ff>4</span> <span style=color:#66d9ef>else</span> socket.AF_INET6, map<span style=color:#f92672>(</span>int, x.packed<span style=color:#f92672>))</span> <span style=color:#66d9ef>for</span> x in servers<span style=color:#f92672>]</span>
|
||||
Traceback <span style=color:#f92672>(</span>most recent call last<span style=color:#f92672>)</span>:
|
||||
File <span style=color:#e6db74>"/opt/appgate/linux/set_dns"</span>, line 30, in <module>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#c30>"is"</span> with a literal. Did you mean <span style=color:#c30>"=="</span>?
|
||||
<span style=color:#033>servers</span> <span style=color:#555>=</span> <span style=color:#555>[(</span> socket.AF_INET <span style=color:#069;font-weight:700>if</span> x.version is <span style=color:#f60>4</span> <span style=color:#069;font-weight:700>else</span> socket.AF_INET6, map<span style=color:#555>(</span>int, x.packed<span style=color:#555>))</span> <span style=color:#069;font-weight:700>for</span> x in servers<span style=color:#555>]</span>
|
||||
Traceback <span style=color:#555>(</span>most recent call last<span style=color:#555>)</span>:
|
||||
File <span style=color:#c30>"/opt/appgate/linux/set_dns"</span>, line 30, in <module>
|
||||
import dbus
|
||||
ModuleNotFoundError: No module named <span style=color:#e6db74>'dbus'</span>
|
||||
ModuleNotFoundError: No module named <span style=color:#c30>'dbus'</span>
|
||||
</code></pre></div><p>Ok, let’s install 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-shell data-lang=shell>$ sudo python3.8 -m pip install dbus-python
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo python3.8 -m pip install dbus-python
|
||||
</code></pre></div><p>Will it work now? Not yet. There’s another issue:</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-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#e6db74>"is"</span> with a literal. Did you mean <span style=color:#e6db74>"=="</span>?
|
||||
servers <span style=color:#f92672>=</span> <span style=color:#f92672>[(</span> socket.AF_INET <span style=color:#66d9ef>if</span> x.version is <span style=color:#ae81ff>4</span> <span style=color:#66d9ef>else</span> socket.AF_INET6, map<span style=color:#f92672>(</span>int, x.packed<span style=color:#f92672>))</span> <span style=color:#66d9ef>for</span> x in servers<span style=color:#f92672>]</span>
|
||||
module <span style=color:#e6db74>'platform'</span> has no attribute <span style=color:#e6db74>'linux_distribution'</span>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo /opt/appgate/linux/set_dns
|
||||
/opt/appgate/linux/set_dns:88: SyntaxWarning: <span style=color:#c30>"is"</span> with a literal. Did you mean <span style=color:#c30>"=="</span>?
|
||||
<span style=color:#033>servers</span> <span style=color:#555>=</span> <span style=color:#555>[(</span> socket.AF_INET <span style=color:#069;font-weight:700>if</span> x.version is <span style=color:#f60>4</span> <span style=color:#069;font-weight:700>else</span> socket.AF_INET6, map<span style=color:#555>(</span>int, x.packed<span style=color:#555>))</span> <span style=color:#069;font-weight:700>for</span> x in servers<span style=color:#555>]</span>
|
||||
module <span style=color:#c30>'platform'</span> has no attribute <span style=color:#c30>'linux_distribution'</span>
|
||||
</code></pre></div><p>This is a breaking change in Python3.8.</p>
|
||||
<p>So what is calling <code>platform.linux_distribution</code>?</p>
|
||||
<p>Let’s search for 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-shell data-lang=shell>$ sudo grep -r <span style=color:#e6db74>'linux_distribution'</span> /opt/appgate/linux/
|
||||
/opt/appgate/linux/nm.py: <span style=color:#66d9ef>if</span> platform.linux_distribution<span style=color:#f92672>()[</span>0<span style=color:#f92672>]</span> !<span style=color:#f92672>=</span> <span style=color:#e6db74>'Fedora'</span>:
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>$ sudo grep -r <span style=color:#c30>'linux_distribution'</span> /opt/appgate/linux/
|
||||
/opt/appgate/linux/nm.py: <span style=color:#069;font-weight:700>if</span> platform.linux_distribution<span style=color:#555>()[</span>0<span style=color:#555>]</span> !<span style=color:#555>=</span> <span style=color:#c30>'Fedora'</span>:
|
||||
</code></pre></div><p>Aha! So this is in the local AppGate source code. This should be an easy fix. Let’s just replace this line with:</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-python data-lang=python><span style=color:#66d9ef>if</span> <span style=color:#66d9ef>True</span>: <span style=color:#75715e># Since we are not using Fedora :)</span>
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=color:#069;font-weight:700>if</span> <span style=color:#069;font-weight:700>True</span>: <span style=color:#09f;font-style:italic># Since we are not using Fedora :)</span>
|
||||
</code></pre></div><h1 id=wrapping-up>Wrapping up</h1>
|
||||
<p>It turns out there are <a href=https://docs.python.org/3.7/library/platform.html#platform.linux_distribution>breaking changes</a> in Python3.8.</p>
|
||||
<p>The docs say <code>Deprecated since version 3.5, will be removed in version 3.8: See alternative like the distro package.</code></p>
|
||||
|
@@ -159,25 +159,25 @@ lrwxr-xr-x 73 root 31 Dec 1969 /run/current-system/sw/bin/dig -> /nix/store/
|
||||
<p>⚠️ If you run this on your main machine, make sure you backup your configuration files first. home-manager is pretty good about not overwriting existing configuration, but it is better to have a backup! Alternatively, you could test this out on a VM or cloud instance.</p>
|
||||
</blockquote>
|
||||
<p>The first thing you should do is <a href=https://nixos.org/guides/install-nix.html>install nix</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-shell data-lang=shell>curl -L https://nixos.org/nix/install | sh
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>curl -L https://nixos.org/nix/install | sh
|
||||
</code></pre></div><p>It’s not a good idea to curl and execute files from the internet (without verifying integrity), so you might want to download the install script first and take a peak before executing it!</p>
|
||||
<p>Open up a new shell in your terminal and running <code>nix</code> <em>should</em> work. If not, run <code>. ~/.nix-profile/etc/profile.d/nix.sh</code></p>
|
||||
<p>Now, <a href=https://github.com/nix-community/home-manager#installation>install home-manager</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-shell data-lang=shell>nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell>nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||
nix-channel --update
|
||||
nix-shell <span style=color:#e6db74>'<home-manager>'</span> -A install
|
||||
nix-shell <span style=color:#c30>'<home-manager>'</span> -A install
|
||||
</code></pre></div><p>You should see a wave of <code>/nix/store/*</code> paths being displayed on your screen.</p>
|
||||
<p>Now, to start off with a basic configuration, open up <code>~/.config/nixpkgs/home.nix</code> in the editor of your choice and paste this in (you will want to change <code>userName</code> and <code>homeDirectory</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-nix data-lang=nix>{ config<span style=color:#f92672>,</span> pkgs<span style=color:#f92672>,</span> <span style=color:#f92672>...</span> }:
|
||||
<div class=highlight><pre tabindex=0 style=background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-nix data-lang=nix>{ config<span style=color:#555>,</span> pkgs<span style=color:#555>,</span> <span style=color:#555>...</span> }:
|
||||
|
||||
{
|
||||
programs<span style=color:#f92672>.</span>home-manager<span style=color:#f92672>.</span>enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
programs<span style=color:#555>.</span>home-manager<span style=color:#555>.</span>enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
|
||||
home <span style=color:#f92672>=</span> {
|
||||
username <span style=color:#f92672>=</span> <span style=color:#e6db74>"dave"</span>;
|
||||
homeDirectory <span style=color:#f92672>=</span> <span style=color:#e6db74>"/home/dave"</span>;
|
||||
stateVersion <span style=color:#f92672>=</span> <span style=color:#e6db74>"21.11"</span>;
|
||||
packages <span style=color:#f92672>=</span> <span style=color:#66d9ef>with</span> pkgs; [
|
||||
home <span style=color:#555>=</span> {
|
||||
username <span style=color:#555>=</span> <span style=color:#c30>"dave"</span>;
|
||||
homeDirectory <span style=color:#555>=</span> <span style=color:#c30>"/home/dave"</span>;
|
||||
stateVersion <span style=color:#555>=</span> <span style=color:#c30>"21.11"</span>;
|
||||
packages <span style=color:#555>=</span> <span style=color:#069;font-weight:700>with</span> pkgs; [
|
||||
bind
|
||||
exa
|
||||
fd
|
||||
@@ -185,83 +185,83 @@ nix-shell <span style=color:#e6db74>'<home-manager>'</span> -A ins
|
||||
];
|
||||
};
|
||||
|
||||
programs <span style=color:#f92672>=</span> {
|
||||
programs <span style=color:#555>=</span> {
|
||||
|
||||
git <span style=color:#f92672>=</span> {
|
||||
enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
aliases <span style=color:#f92672>=</span> {
|
||||
aa <span style=color:#f92672>=</span> <span style=color:#e6db74>"add -A ."</span>;
|
||||
br <span style=color:#f92672>=</span> <span style=color:#e6db74>"branch"</span>;
|
||||
c <span style=color:#f92672>=</span> <span style=color:#e6db74>"commit -S"</span>;
|
||||
ca <span style=color:#f92672>=</span> <span style=color:#e6db74>"commit -S --amend"</span>;
|
||||
cb <span style=color:#f92672>=</span> <span style=color:#e6db74>"checkout -b"</span>;
|
||||
co <span style=color:#f92672>=</span> <span style=color:#e6db74>"checkout"</span>;
|
||||
d <span style=color:#f92672>=</span> <span style=color:#e6db74>"diff"</span>;
|
||||
l <span style=color:#f92672>=</span>
|
||||
<span style=color:#e6db74>"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"</span>;
|
||||
git <span style=color:#555>=</span> {
|
||||
enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
aliases <span style=color:#555>=</span> {
|
||||
aa <span style=color:#555>=</span> <span style=color:#c30>"add -A ."</span>;
|
||||
br <span style=color:#555>=</span> <span style=color:#c30>"branch"</span>;
|
||||
c <span style=color:#555>=</span> <span style=color:#c30>"commit -S"</span>;
|
||||
ca <span style=color:#555>=</span> <span style=color:#c30>"commit -S --amend"</span>;
|
||||
cb <span style=color:#555>=</span> <span style=color:#c30>"checkout -b"</span>;
|
||||
co <span style=color:#555>=</span> <span style=color:#c30>"checkout"</span>;
|
||||
d <span style=color:#555>=</span> <span style=color:#c30>"diff"</span>;
|
||||
l <span style=color:#555>=</span>
|
||||
<span style=color:#c30>"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"</span>;
|
||||
};
|
||||
|
||||
delta <span style=color:#f92672>=</span> {
|
||||
enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
delta <span style=color:#555>=</span> {
|
||||
enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
|
||||
options <span style=color:#f92672>=</span> {
|
||||
features <span style=color:#f92672>=</span> <span style=color:#e6db74>"line-numbers decorations"</span>;
|
||||
whitespace-error-style <span style=color:#f92672>=</span> <span style=color:#e6db74>"22 reverse"</span>;
|
||||
plus-style <span style=color:#f92672>=</span> <span style=color:#e6db74>"green bold ul '#198214'"</span>;
|
||||
decorations <span style=color:#f92672>=</span> {
|
||||
commit-decoration-style <span style=color:#f92672>=</span> <span style=color:#e6db74>"bold yellow box ul"</span>;
|
||||
file-style <span style=color:#f92672>=</span> <span style=color:#e6db74>"bold yellow ul"</span>;
|
||||
file-decoration-style <span style=color:#f92672>=</span> <span style=color:#e6db74>"none"</span>;
|
||||
options <span style=color:#555>=</span> {
|
||||
features <span style=color:#555>=</span> <span style=color:#c30>"line-numbers decorations"</span>;
|
||||
whitespace-error-style <span style=color:#555>=</span> <span style=color:#c30>"22 reverse"</span>;
|
||||
plus-style <span style=color:#555>=</span> <span style=color:#c30>"green bold ul '#198214'"</span>;
|
||||
decorations <span style=color:#555>=</span> {
|
||||
commit-decoration-style <span style=color:#555>=</span> <span style=color:#c30>"bold yellow box ul"</span>;
|
||||
file-style <span style=color:#555>=</span> <span style=color:#c30>"bold yellow ul"</span>;
|
||||
file-decoration-style <span style=color:#555>=</span> <span style=color:#c30>"none"</span>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig <span style=color:#f92672>=</span> {
|
||||
push <span style=color:#f92672>=</span> { default <span style=color:#f92672>=</span> <span style=color:#e6db74>"current"</span>; };
|
||||
pull <span style=color:#f92672>=</span> { rebase <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>; };
|
||||
extraConfig <span style=color:#555>=</span> {
|
||||
push <span style=color:#555>=</span> { default <span style=color:#555>=</span> <span style=color:#c30>"current"</span>; };
|
||||
pull <span style=color:#555>=</span> { rebase <span style=color:#555>=</span> <span style=color:#360>true</span>; };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
starship <span style=color:#f92672>=</span> {
|
||||
enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
enableZshIntegration <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
starship <span style=color:#555>=</span> {
|
||||
enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
enableZshIntegration <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
|
||||
settings <span style=color:#f92672>=</span> {
|
||||
add_newline <span style=color:#f92672>=</span> <span style=color:#66d9ef>false</span>;
|
||||
scan_timeout <span style=color:#f92672>=</span> <span style=color:#ae81ff>10</span>;
|
||||
settings <span style=color:#555>=</span> {
|
||||
add_newline <span style=color:#555>=</span> <span style=color:#360>false</span>;
|
||||
scan_timeout <span style=color:#555>=</span> <span style=color:#f60>10</span>;
|
||||
};
|
||||
};
|
||||
|
||||
zsh <span style=color:#f92672>=</span> {
|
||||
enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
enableAutosuggestions <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
enableSyntaxHighlighting <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
history<span style=color:#f92672>.</span>size <span style=color:#f92672>=</span> <span style=color:#ae81ff>1000000</span>;
|
||||
zsh <span style=color:#555>=</span> {
|
||||
enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
enableAutosuggestions <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
enableSyntaxHighlighting <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
history<span style=color:#555>.</span>size <span style=color:#555>=</span> <span style=color:#f60>1000000</span>;
|
||||
|
||||
localVariables <span style=color:#f92672>=</span> {
|
||||
CASE_SENSITIVE <span style=color:#f92672>=</span> <span style=color:#e6db74>"true"</span>;
|
||||
DISABLE_UNTRACKED_FILES_DIRTY <span style=color:#f92672>=</span> <span style=color:#e6db74>"true"</span>;
|
||||
RPROMPT <span style=color:#f92672>=</span> <span style=color:#e6db74>""</span>; <span style=color:#75715e># override because macOS defaults to filepath</span>
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE <span style=color:#f92672>=</span> <span style=color:#e6db74>"fg=#838383,underline"</span>;
|
||||
ZSH_DISABLE_COMPFIX <span style=color:#f92672>=</span> <span style=color:#e6db74>"true"</span>;
|
||||
localVariables <span style=color:#555>=</span> {
|
||||
CASE_SENSITIVE <span style=color:#555>=</span> <span style=color:#c30>"true"</span>;
|
||||
DISABLE_UNTRACKED_FILES_DIRTY <span style=color:#555>=</span> <span style=color:#c30>"true"</span>;
|
||||
RPROMPT <span style=color:#555>=</span> <span style=color:#c30>""</span>; <span style=color:#09f;font-style:italic># override because macOS defaults to filepath</span>
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE <span style=color:#555>=</span> <span style=color:#c30>"fg=#838383,underline"</span>;
|
||||
ZSH_DISABLE_COMPFIX <span style=color:#555>=</span> <span style=color:#c30>"true"</span>;
|
||||
};
|
||||
|
||||
initExtra <span style=color:#f92672>=</span> <span style=color:#e6db74>''
|
||||
</span><span style=color:#e6db74> export PAGER=less
|
||||
</span><span style=color:#e6db74> ''</span>;
|
||||
initExtra <span style=color:#555>=</span> <span style=color:#c30>''
|
||||
</span><span style=color:#c30> export PAGER=less
|
||||
</span><span style=color:#c30> ''</span>;
|
||||
|
||||
shellAliases <span style=color:#f92672>=</span> {
|
||||
<span style=color:#e6db74>".."</span> <span style=color:#f92672>=</span> <span style=color:#e6db74>"cd .."</span>;
|
||||
grep <span style=color:#f92672>=</span> <span style=color:#e6db74>"rg --smart-case"</span>;
|
||||
ls <span style=color:#f92672>=</span> <span style=color:#e6db74>"exa -la --git"</span>;
|
||||
shellAliases <span style=color:#555>=</span> {
|
||||
<span style=color:#c30>".."</span> <span style=color:#555>=</span> <span style=color:#c30>"cd .."</span>;
|
||||
grep <span style=color:#555>=</span> <span style=color:#c30>"rg --smart-case"</span>;
|
||||
ls <span style=color:#555>=</span> <span style=color:#c30>"exa -la --git"</span>;
|
||||
};
|
||||
|
||||
<span style=color:#e6db74>"oh-my-zsh"</span> <span style=color:#f92672>=</span> {
|
||||
enable <span style=color:#f92672>=</span> <span style=color:#66d9ef>true</span>;
|
||||
plugins <span style=color:#f92672>=</span> [
|
||||
<span style=color:#e6db74>"gitfast"</span>
|
||||
<span style=color:#e6db74>"last-working-dir"</span>
|
||||
<span style=color:#c30>"oh-my-zsh"</span> <span style=color:#555>=</span> {
|
||||
enable <span style=color:#555>=</span> <span style=color:#360>true</span>;
|
||||
plugins <span style=color:#555>=</span> [
|
||||
<span style=color:#c30>"gitfast"</span>
|
||||
<span style=color:#c30>"last-working-dir"</span>
|
||||
];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user