<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Nixpkgs on paradigmatic.systems</title>
    <link>https://paradigmatic.systems/tags/nixpkgs/</link>
    <description>Recent content in Nixpkgs on paradigmatic.systems</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 13 Aug 2025 04:30:00 +0000</lastBuildDate><atom:link href="https://paradigmatic.systems/tags/nixpkgs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Nix: the Language, the Tool, the Package Repo, the OS</title>
      <link>https://paradigmatic.systems/posts/nix-nixpkgs-nixos/</link>
      <pubDate>Wed, 13 Aug 2025 04:30:00 +0000</pubDate>
      
      <guid>https://paradigmatic.systems/posts/nix-nixpkgs-nixos/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s a lot going on in the Nix ecosystem. If you haven&amp;rsquo;t slogged through &lt;a href=&#34;https://edolstra.github.io/pubs/phd-thesis.pdf&#34;&gt;the thesis&lt;/a&gt; then it might seem downright opaque. This is my attempt at an easy explainer for newcomers.&lt;/p&gt;
&lt;h2 id=&#34;the-tool-and-the-language&#34;&gt;The Tool and the Language&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s bootstrap ourselves with some circular facts.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Nix is a &lt;em&gt;tool&lt;/em&gt; for building (or &amp;ldquo;packaging&amp;rdquo;) &lt;em&gt;software components&lt;/em&gt; using instructions expressed in the Nix &lt;em&gt;language&lt;/em&gt;.
The Nix language is even able to &lt;a href=&#34;https://github.com/NixOS/nix/blob/master/flake.nix&#34;&gt;package&lt;/a&gt; the Nix tool (which is mostly written in C++), thus closing the epistemological loop.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>There&rsquo;s a lot going on in the Nix ecosystem. If you haven&rsquo;t slogged through <a href="https://edolstra.github.io/pubs/phd-thesis.pdf">the thesis</a> then it might seem downright opaque. This is my attempt at an easy explainer for newcomers.</p>
<h2 id="the-tool-and-the-language">The Tool and the Language</h2>
<p>Let&rsquo;s bootstrap ourselves with some circular facts.</p>
<blockquote>
<p>Nix is a <em>tool</em> for building (or &ldquo;packaging&rdquo;) <em>software components</em> using instructions expressed in the Nix <em>language</em>.
The Nix language is even able to <a href="https://github.com/NixOS/nix/blob/master/flake.nix">package</a> the Nix tool (which is mostly written in C++), thus closing the epistemological loop.</p></blockquote>
<p>The language features first-class treatment of filesystem paths and URLs (to source code and tarballs, for example).
Nix <em>expressions</em> are evaluated in a hermetic environment with no path variables and no files. All outside references get copied into content-addressed folders in the <em>store</em>, and marked as build-time <em>dependencies</em> in any <em>derivation</em> that gets defined. Retained <em>runtime</em> dependencies are calculated by scanning the actual binary for store paths.</p>
<h2 id="the-build">The Build</h2>
<p>The component is the result of <em>realizing</em> the derivation. That means grabbing all the store path contents and combining them in the prescribed way. Imagine you have 3 components that are build-time dependencies:</p>
<ol>
<li>A compiler</li>
<li>Source code</li>
<li>A bash script that uses the compiler to build the source</li>
</ol>
<p>The derivation describes where to find these, and the (obvious) way that they fit together. The result is content-addressed with a hash based on all its dependencies, and placed in the store.</p>
<h2 id="nixpkgs">nixpkgs</h2>
<p>It turns out this scheme is highly flexible and repeatable.
<a href="https://github.com/NixOS/nixpkgs">nixpkgs</a> is a repo full of Nix expressions for over 120,000 packages. You can pull any one of them into an ephemeral shell to try it out, or install it system-wide if you&rsquo;re using:</p>
<h2 id="nixos">NixOS</h2>
<p>Finally, notice that &ldquo;<em>software components</em>&rdquo; could have a very broad definition. So broad, in fact, to include an entire OS with all of the installed programs and services. That&rsquo;s what NixOS is: A Linux distro defined entirely in Nix and built around the <code>/nix/store</code> path model instead of the more usual <a href="https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard">FHS</a>.  I&rsquo;ve written <a href="/posts/first-principles-infrastructure">a bit</a> about how the Nix <em>module</em> system helps encapsulate complex system recipes into simple one-liners.</p>
<p>All my homies use NixOS. To paraphrase from <a href="https://joshblais.com/blog/nixos-is-the-endgame-of-distrohopping/">NixOS is the endgame of distrohopping </a>:</p>
<h3 id="no-more-configuration-drift---solved-">No more configuration drift - solved ✅</h3>
<h3 id="works-on-my-machine---solved-">“Works on my machine!” - solved ✅</h3>
<h3 id="dependency-hell---solved-">Dependency Hell - solved ✅</h3>
<h3 id="virtual-and-development-environments---solved-">Virtual and development environments - solved ✅</h3>
<h3 id="package-management---solved-">package management - solved ✅</h3>
<h2 id="ready-to-go-deeper">Ready to go deeper?</h2>
<p>To get started I highly recommend working through the <a href="https://nix.dev/tutorials/">tutorials at nix.dev</a>!</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
