<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nix on Jan Kremer</title>
    <link>https://jankremer.eu/tags/nix/</link>
    <description>Recent content in Nix on Jan Kremer</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>de</language>
    <lastBuildDate>2024-03-14 00:00</lastBuildDate><atom:link href="https://jankremer.eu/tags/nix/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Nix on macOS</title>
      <link>https://jankremer.eu/blog/nix/</link>
      <pubDate>2024-03-14 00:00</pubDate>
      
      <guid>https://jankremer.eu/blog/nix/</guid>
      <description>&lt;p&gt;For about a year, I&amp;rsquo;ve been fascinated by &lt;a href=&#34;https://nixos.org&#34;&gt;Nix and NixOS&lt;/a&gt;. I don&amp;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.&lt;/p&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;p&gt;To be honest this is not my first time installing Nix on my machine. I tried the official Nix installer and the &amp;ldquo;old&amp;rdquo; way to use Nix which is basically the same as any other package manager. I didn&amp;rsquo;t see the point of having two package managers so I uninstalled Nix quickly after.&lt;/p&gt;
&lt;p&gt;Then, a few weeks ago, I came across &lt;a href=&#34;https://nixcademy.com/2024/01/15/nix-on-macos/&#34;&gt;this guide&lt;/a&gt; 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 &lt;em&gt;flake&lt;/em&gt;. The guide uses the &lt;a href=&#34;https://github.com/DeterminateSystems/nix-installer&#34;&gt;Determinate systems installer&lt;/a&gt; which sets up flakes by default. It also explains how to install Nix Darwin.&lt;/p&gt;
&lt;h2 id=&#34;nix-darwin&#34;&gt;Nix Darwin&lt;/h2&gt;
&lt;p&gt;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 &lt;a href=&#34;#home-manager&#34;&gt;Home Manager&lt;/a&gt; instead, because it supports even more programs.&lt;/p&gt;
&lt;p&gt;What I do use extensively is the &lt;a href=&#34;https://brew.sh/&#34;&gt;Homebrew&lt;/a&gt; module to install not only GUI (graphical user interface) apps from Homebrew, but also from the App Store.&lt;/p&gt;
&lt;h2 id=&#34;home-manager&#34;&gt;Home Manager&lt;/h2&gt;
&lt;p&gt;For everything else, from terminal based programs to their configuration, I use &lt;a href=&#34;https://github.com/nix-community/home-manager?tab=readme-ov-file&#34;&gt;Home Manager&lt;/a&gt;. 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 &amp;ldquo;traditional way&amp;rdquo;, meaning in the original configuration language. But still, I much prefer this over my cluttered &lt;code&gt;.config&lt;/code&gt; directory.&lt;/p&gt;
&lt;h2 id=&#34;nixvim&#34;&gt;Nixvim&lt;/h2&gt;
&lt;p&gt;In the process of writing my Nix configuration, I became unsatisfied with my Neovim setup. I used to use &lt;a href=&#34;https://www.lazyvim.org&#34;&gt;LazyVim&lt;/a&gt; but it felt more and more bloated and slow on my 9 year old machine. For some time I used &lt;a href=&#34;https://helix-editor.com/&#34;&gt;Helix&lt;/a&gt; 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 &lt;a href=&#34;https://typst.app/&#34;&gt;Typst&lt;/a&gt; which is already added to the &lt;code&gt;master&lt;/code&gt; branch. It also lacks a plugin system, but given such great defaults, there isn&amp;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.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s when I saw a video by &lt;em&gt;ThePrimeagen&lt;/em&gt; in which he recommended &lt;a href=&#34;https://github.com/nvim-lua/kickstart.nvim/tree/master&#34;&gt;Kickstart&lt;/a&gt;, a minimal Neovim starter configuration mainly written by &lt;em&gt;TJ DeVries&lt;/em&gt;. It almost everything you need to get started and has insanely great documentation.&lt;/p&gt;
&lt;p&gt;The only thing that bothered me was the use of &lt;a href=&#34;https://github.com/williamboman/mason.nvim&#34;&gt;Mason&lt;/a&gt; as a LSP package manager. For some people this might be the best way to install LSPs, but I don&amp;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 &lt;code&gt;$PATH&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Luckily, others already had the same issues and decided to write &lt;a href=&#34;https://github.com/nix-community/nixvim&#34;&gt;Nixvim&lt;/a&gt;. 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.&lt;/p&gt;
&lt;p&gt;I basically recreated Kickstart using Nixvim with some minor tweaks. It feels just as snappy as Helix and I love it.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;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&amp;rsquo;m really happy and excited about this &amp;ldquo;new&amp;rdquo; way to manage my computer.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
