Init: neue Webseite

This commit is contained in:
Jan Kremer 2024-03-26 15:40:28 +01:00
commit 3470b542d5
Signed by: jan
GPG key ID: A7DA689CB3B078EC
188 changed files with 7271 additions and 0 deletions

View file

@ -0,0 +1,95 @@
<!DOCTYPE html>
<html lang="de"
dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Nix on macOS | Jan Kremer</title>
<link rel="stylesheet" href="/css/main.min.44d337144c40b1101874ef25bbc4d48bb4bb38e7cdd285c9396c8dfa51b92d03.css" integrity="sha256-RNM3FExAsRAYdO8lu8TUi7S7OOfN0oXJOWyN&#43;lG5LQM=" crossorigin="anonymous">
<script data-goatcounter="https://jankremer.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
</head>
<body>
<header>
<h1 class="title"><a href="/">Jan Kremer</a></h1>
<nav>
<ul>
<li>
<a href="/">Home</a>
</li>
<li>
<a aria-current="true" class="ancestor" href="/blog/">Blog</a>
</li>
<li>
<a href="/micro/">Microblog</a>
</li>
<li>
<a href="/photos/">Fotos</a>
</li>
<li>
<a href="/about/">Über mich</a>
</li>
</ul>
</nav>
</header>
<main>
<article>
<time datetime="2024-03-14T00:00:00&#43;00:00">2024-03-14</time>
<br>
<h1>Nix on macOS</h1>
<p class="lead">Moving from Homebrew to Nix. Mostly.</p>
<p>For about a year, I&rsquo;ve been fascinated by <a href="https://nixos.org">Nix and NixOS</a>. I don&rsquo;t remember exactly what fascinated me at first, probably the possibility to setup and configure my system using a single file. A few weeks ago, I decided to give it a serious try.</p>
<h2 id="installation">Installation</h2>
<p>To be honest this is not my first time installing Nix on my machine. I tried the official Nix installer and the &ldquo;old&rdquo; way to use Nix which is basically the same as any other package manager. I didn&rsquo;t see the point of having two package managers so I uninstalled Nix quickly after.</p>
<p>Then, a few weeks ago, I came across <a href="https://nixcademy.com/2024/01/15/nix-on-macos/">this guide</a> and it instantly clicked with me. Having a single file in which I declare my complete system and then have it set up in a few minutes without rebooting is just infinitely cool. In Nix, this feature is called <em>flake</em>. The guide uses the <a href="https://github.com/DeterminateSystems/nix-installer">Determinate systems installer</a> which sets up flakes by default. It also explains how to install Nix Darwin.</p>
<h2 id="nix-darwin">Nix Darwin</h2>
<p>Nix Darwin is a set of Nix modules that brings declarative configuration to macOS. It includes a bunch of options such as for the dock, Finder or the keyboard for example. It also gives the user basic configuration options for various programs. However I prefer to set up terminal based programs using <a href="#home-manager">Home Manager</a> instead, because it supports even more programs.</p>
<p>What I do use extensively is the <a href="https://brew.sh/">Homebrew</a> module to install not only GUI (graphical user interface) apps from Homebrew, but also from the App Store.</p>
<h2 id="home-manager">Home Manager</h2>
<p>For everything else, from terminal based programs to their configuration, I use <a href="https://github.com/nix-community/home-manager?tab=readme-ov-file">Home Manager</a>. It includes a huge set of modules and allows me to setup every non-GUI program in a declarative way. Still, sometimes you have to configure the &ldquo;traditional way&rdquo;, meaning in the original configuration language. But still, I much prefer this over my cluttered <code>.config</code> directory.</p>
<h2 id="nixvim">Nixvim</h2>
<p>In the process of writing my Nix configuration, I became unsatisfied with my Neovim setup. I used to use <a href="https://www.lazyvim.org">LazyVim</a> but it felt more and more bloated and slow on my 9 year old machine. For some time I used <a href="https://helix-editor.com/">Helix</a> which has great defaults, such as language server protocol (LSP) and fuzzy finder integration. I really think Neovim should go in this direction. Unfortunately it lacks some features to make it my main editor, mostly support for <a href="https://typst.app/">Typst</a> which is already added to the <code>master</code> branch. It also lacks a plugin system, but given such great defaults, there isn&rsquo;t that big of a need for it. Helix also features its own set of motions, and although I think they are not bad, maybe even better than Vim motions, the latter are so ubiquitously implemented that I would essentially use both all the time.</p>
<p>That&rsquo;s when I saw a video by <em>ThePrimeagen</em> in which he recommended <a href="https://github.com/nvim-lua/kickstart.nvim/tree/master">Kickstart</a>, a minimal Neovim starter configuration mainly written by <em>TJ DeVries</em>. It almost everything you need to get started and has insanely great documentation.</p>
<p>The only thing that bothered me was the use of <a href="https://github.com/williamboman/mason.nvim">Mason</a> as a LSP package manager. For some people this might be the best way to install LSPs, but I don&rsquo;t understand why I would use a second package manager when I can just use Nix for everything. Helix has a list of supported LSPs and all you have to do is make sure they are in your <code>$PATH</code>.</p>
<p>Luckily, others already had the same issues and decided to write <a href="https://github.com/nix-community/nixvim">Nixvim</a>. Nixvim is a NixOS / Nix Darwin / Home manager module that lets you configure Neovim (almost) entirely using Nix. It uses Nix as the plugin manager and has great defaults and documentation.</p>
<p>I basically recreated Kickstart using Nixvim with some minor tweaks. It feels just as snappy as Helix and I love it.</p>
<h2 id="conclusion">Conclusion</h2>
<p>This is just the tip of the tip of the iceberg of what is possible with Nix. Next, I want to learn to write my own flakes to set up development environments. I should probably learn a bit of Nix language too. But to sum it up so far, I&rsquo;m really happy and excited about this &ldquo;new&rdquo; way to manage my computer.</p>
</article>
<hr>
<div class="tags">
<ul>
<li><a href="/tags/nix/">Nix</a></li>
</ul>
</div>
</main>
<footer>
<p><a href="https://creativecommons.org/licenses/by-sa/4.0/">BY-SA 4.0</a> &emsp;&emsp; Jan Kremer &emsp;
&emsp; 20212024</p>
</footer>
</body>
</html>