aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/nixOS/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/posts/nixOS/index.html')
-rw-r--r--docs/posts/nixOS/index.html90
1 files changed, 90 insertions, 0 deletions
diff --git a/docs/posts/nixOS/index.html b/docs/posts/nixOS/index.html
new file mode 100644
index 0000000..de6da96
--- /dev/null
+++ b/docs/posts/nixOS/index.html
@@ -0,0 +1,90 @@
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <link rel="stylesheet" href="/style.css">
5 <link rel="stylesheet" href="/syntax.css">
6 <meta charset="UTF-8">
7 <meta name="viewport" content="initial-scale=1">
8 <meta content="#ffffff" name="theme-color">
9 <meta name="HandheldFriendly" content="true">
10 <meta property="og:title" content="NixOS">
11 <meta property="og:type" content="website">
12 <meta property="og:description" content="a static site {for, by, about} me ">
13 <meta property="og:url" content="https://peppe.rs">
14 <link rel="icon" type="image/x-icon" href="/favicon.png">
15 <title>NixOS · peppe.rs</title>
16 <body>
17 <div class="posts">
18 <div class="post">
19 <a href="/" class="post-end-link">⟵ Back</a>
20 <a class="stats post-end-link" href="https://raw.githubusercontent.com/nerdypepper/site/master/posts/nixOS.md
21">View Raw</a>
22 <div class="separator"></div>
23 <div class="date">
24 01/09 — 2020
25 <div class="stats">
26 <span class="stats-number">
27 37.56
28 </span>
29 <span class="stats-unit">cm</span>
30 &nbsp
31 <span class="stats-number">
32 3.3
33 </span>
34 <span class="stats-unit">min</span>
35 </div>
36 </div>
37 <h1>
38 NixOS
39 </h1>
40 <div class="post-text">
41 <p>I have been eyeing operating systems with functional package managers for a while now, aka, NixOS or Guix. Reproducible builds, declarative and rollback-able system configuration, system consistency, all sound pretty cool. I have been using NixOS for about a month now.</p>
42<h3 id="installation">Installation</h3>
43<p>I went with their minimal installation ISO. The installation was pretty smooth from start to end, no hitches there. The entire <a href="https://nixos.org/manual/nixos/stable/">manual</a> is available offline, and is accessible during the installation. Very handy.</p>
44<h3 id="setup">Setup</h3>
45<p>The entire system is configured via <code>/etc/nixos/configuration.nix</code>. Wifi, <code>libinput</code> gestures, audio, locale settings, there are options for literally everything. You can declaratively write down the packages you want installed too. With fresh installs of most distros, I usually fumble with getting things like screen backlight and media keys to work. If I do manage to fix it, I can’t carry it forward to future installations trivially. Getting all my hardware to work on NixOS is as easy as:</p>
46<pre><code>{
47 server.xserver.libinput.enable = true; # touchpad
48 programs.light.enable = true; # backlight
49 hardware.pulseaudio.enable = true; # audio
50 networking.wireless.enable = true; # wifi
51}</code></pre>
52<h3 id="developing-with-nix">Developing with Nix</h3>
53<p>Nix makes it easy to enter environments that aren’t affected by your system configuration using <code>nix-shell</code>.</p>
54<p>Builds may be generated by specifying a <code>default.nix</code> file, and running <code>nix-build</code>. Conventional package managers require you to specify a dependency list, but there is no guarantee that this list is complete. The package will build on your machine even if you forget a dependency. However, with Nix, packages are installed to <code>/nix/store</code>, and not global paths such as <code>/usr/bin/...</code>, if your project builds, it means you have included every last one.</p>
55<p>Issues on most my projects have been “unable to build because <code>libxcb</code> is missing”, or “this version of <code>openssl</code> is too old”. Tools like <code>cargo</code> and <code>pip</code> are poor package managers. While they <em>can</em> guarantee that Rust or Python dependencies are met, they make assumptions about the target system.</p>
56<p>For example, <a href="https://github.com/nerdypepper/site">this website</a> is now built using Nix, anyone using Nix may simply, clone the repository and run <code>./generate.sh</code>, and it would <em>just work</em>, while keeping your global namespace clean™:</p>
57<div class="sourceCode" id="cb2"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1"></a><span class="co">#! /usr/bin/env nix-shell</span></span>
58<span id="cb2-2"><a href="#cb2-2"></a><span class="co">#! nix-shell -i bash -p eva pandoc esh</span></span>
59<span id="cb2-3"><a href="#cb2-3"></a></span>
60<span id="cb2-4"><a href="#cb2-4"></a><span class="co"># some bash magic ;)</span></span></code></pre></div>
61<p>Dependencies are included with the <code>-p</code> flag, the shell script is executed with an interpreter, specified with the <code>-i</code> flag.</p>
62<h3 id="impressions">Impressions</h3>
63<p>NixOS is by no means, simple. As a newcomer, using Nix was not easy, heck, I had to learn a purely functional, lazy language to just build programs. There is a lot to be desired on the tooling front as well. A well fleshed out LSP plugin would be nice (<a href="https://github.com/nix-community/rnix-lsp">rnix-lsp looks promising</a>).</p>
64<p>Being able to rollback changes at a system level is cool. Package broke something? Just <code>nixos-rebuild switch --rollback</code>! Deleted <code>nix</code> by mistake? Find the binary in <code>/nix/store</code> and rollback! You aren’t punished for not thinking twice.</p>
65<p>I don’t see myself switching to anything else in the near future, NixOS does a lot of things right. If I ever need to reinstall NixOS, I can generate an <a href="https://github.com/nix-community/nixos-generators">image of my current system</a>.</p>
66<p><a href="https://u.peppe.rs/6m.png"><img src="https://u.peppe.rs/6m.png" /></a></p>
67
68 </div>
69
70 <div class=intro>
71 Hi.
72 <div class=hot-links>
73 <a href=https://peppe.rs/index.xml class=feed-button>Subscribe</a>
74 <a href=https://liberapay.com/nerdypepper/donate class=donate-button>Donate</a>
75 </div>
76 <p>I'm Akshay, I go by nerd or nerdypepper on the internet.</p>
77 <p>
78 I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer.
79 I write open-source stuff to pass time. I also design fonts: scientifica, curie.
80 </p>
81 <p>Send me a mail at [email protected] or a message at [email protected].</p>
82 </div>
83
84 <a href="/" class="post-end-link">⟵ Back</a>
85 <a class="stats post-end-link" href="https://raw.githubusercontent.com/nerdypepper/site/master/posts/nixOS.md
86">View Raw</a>
87 </div>
88 </div>
89 </body>
90</html>