summaryrefslogtreecommitdiffstats
path: root/templates/blog
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-10-22 18:49:51 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-10-22 18:49:51 -0700
commit43a4ee6234d3a38d6f9853b53c3d03cc67cd3287 (patch)
treeb47e3463dc8e6e15a419213a198c2d76da782606 /templates/blog
parent43bcdbcb3f3956d5760a56324e30253e95ac02ed (diff)
downloadroseh.moe-43a4ee6234d3a38d6f9853b53c3d03cc67cd3287.tar.zst
Write a blog post.
Diffstat (limited to 'templates/blog')
-rw-r--r--templates/blog/post.html.template4
-rw-r--r--templates/blog/posts/2024-10-22_nix_flakes.html.template82
2 files changed, 86 insertions, 0 deletions
diff --git a/templates/blog/post.html.template b/templates/blog/post.html.template
new file mode 100644
index 0000000..ba5e81f
--- /dev/null
+++ b/templates/blog/post.html.template
@@ -0,0 +1,4 @@
+<article>
+ <a href="/">⬅️Home</a>
+{{template "post"}}
+</article>
diff --git a/templates/blog/posts/2024-10-22_nix_flakes.html.template b/templates/blog/posts/2024-10-22_nix_flakes.html.template
new file mode 100644
index 0000000..b9b2ca0
--- /dev/null
+++ b/templates/blog/posts/2024-10-22_nix_flakes.html.template
@@ -0,0 +1,82 @@
+<h1>nix flakes for busy people</h1>
+
+<h2>TL;DR</h2>
+
+<h4>To enable flakes on a NixOS system</h4>
+
+<p>Just put</p>
+
+<pre>
+ nix.settings.experimental-features = [
+ "nix-command"
+ "flakes"
+ ];
+</pre>
+
+<p>in your <code>configuration.nix</code>. IMO it's a shame that flakes
+have been locked behind experimental for so long, it's a large part of
+why they have a bad reputation. It's absolutely worth enabling them
+since they're so useful.</p>
+
+<h4>To use a flake from github</h4>
+
+<pre>
+nix shell github:ggerganov/llama.cpp
+</pre>
+
+<p>or to install a specific flake output:</p>
+
+<pre>
+nix shell github:ggerganov/llama.cpp#rocm
+</pre>
+
+<p>To list the outputs for a specific flake, you can usually type
+<code>nix shell github:ggerganov/llama.cpp#&lt;tab&gt;</code> and your
+shell may or may not list the outputs. If anyone has a better way to do this,
+please let me know.</p>
+
+<p>To install a flake in your system profile, use</p>
+
+<pre>
+nix profile install github:ggerganov/llama.cpp
+</pre>
+
+<p>Here is the greatest power of nix flakes: the ability to install and
+use them as first-class packages just like anything from nixpkgs. It
+feels a lot better integrated than something like the AUR.</p>
+
+<h4>To create a nix flake for your own project</h4>
+
+<pre>
+nix flake init -t templates#go-hello
+</pre>
+
+<p>Replace go-hello with whatever template you want that most closely
+matches your project configuration. Unfortunately many of these templates
+have the questionable behavior of also overwriting source files in the
+current directory, so I recommend only running nix flake init in an
+empty directory, and copying the flake.nix file over to your
+existing project.</p>
+
+<h2>A philosophical intro to nix flakes</h2>
+
+<p>Flakes are a way to replace the centralized nixpkgs repository with
+decentralized packages controlled directly by upstream. In many ways
+Linux packaging has been moving more and more towards upstream with
+things like appimages or flatpak, and being able to remove many of the
+distro-specific hacks needed to make things run on various systems. Nix
+flakes address this same issue, by allowing upstream to control their own
+flake.nix, and pull in the specific versions of any dependencies they
+might need. They also give an easy way to install any programs that
+might not be packaged yet for nixpkgs, as long as anyone has written a
+flake and published it online.</p>
+
+<h2>The bad parts</h2>
+
+<p>Nix flakes are still rough around the edges, and the worst part for
+a new Nix user is the lack of documentation. This is a large part of why
+I'm writing yet another nix flakes tutorial!
+<a href="https://xeiaso.net/blog/nix-flakes-1-2022-02-21/">https://xeiaso.net/blog/nix-flakes-1-2022-02-21</a>
+is really good, but reading this as a new user, I only wanted to know
+how to install an app packaged with flakes, and I didn't care so much
+about how to package my own stuff yet.</p>