diff --git a/content/posts/cellular-automata-toys/index.md b/content/posts/cellular-automata-toys/index.md index 9c392b5..d155e49 100644 --- a/content/posts/cellular-automata-toys/index.md +++ b/content/posts/cellular-automata-toys/index.md @@ -6,13 +6,9 @@ description = "a short announcement post for a few interactive cellular automata tags = ["cellular-automata", "lua", "löve2d"] [extra] hero = true +heroPrompt = "The oracle reading the future from Conway's Game of Life, technomancer aesthetic, digital illustration, 8k uhd" +++ -
-The oracle reading the future from Conway's Game of Life, technomancer aesthetic, digital illustration, 8k uhd - generated using Stable Diffusion -

The oracle reading the future from Conway's Game of Life, technomancer aesthetic, digital illustration, 8k uhd - generated using Stable Diffusion

-
- after reading [Andrew Healey's blog post about Langton's Ant](https://healeycodes.com/virtual-ants), i found myself inspired to reimplement some of his work. i've read numerous rave reviews of löve2d for writing simple toys, so i decided to give that a shot here as well. Langton's Ant went well enough that i also implemented Life and Wireworld. [check the toys out here; there are instructions for running with löve2d directly or using nix](https://git.mat.services/mat/love-cellular-automata). the code is hosted on a personal instance of gitea, so if you want to collaborate or share feedback, you'll have to request an account or shoot me an email. diff --git a/content/posts/command-line-flake-arguments/index.md b/content/posts/command-line-flake-arguments/index.md index fc3bb0c..f78e45a 100644 --- a/content/posts/command-line-flake-arguments/index.md +++ b/content/posts/command-line-flake-arguments/index.md @@ -1,19 +1,14 @@ +++ title = "passing command line arguments to nix flakes" -date = "2022-10-09" +date = "2022-10-10" description = "a tutorial on 'breaking' the hermeticity of nix flakes by adding convenient command line flags" -draft = true [taxonomies] tags = ["nix"] [extra] hero = true +heroPrompt = "A rogue program hacking through the firewall, in the style of Tron Legacy, cyberpunk vibe, digital render, 8k uhd, unreal engine - generated using Stable Diffusion" +++ -
-A rogue program hacking through the firewall, in the style of Tron Legacy, cyberpunk vibe, digital render, 8k uhd, unreal engine - generated using Stable Diffusion -

A rogue program hacking through the firewall, in the style of Tron Legacy, cyberpunk vibe, digital render, 8k uhd, unreal engine - generated using Stable Diffusion

-
- [Nix flakes](https://serokell.io/blog/practical-nix-flakes) are very useful, but the feature of a [fully hermetic build](https://bazel.build/basics/hermeticity) also means that they carry with them a certain degree of inflexibility. [Users have asked for a mechanism to parameterize flakes](https://github.com/NixOS/nix/issues/2861#issuecomment-891521971), but there seems to be no interest from the Nix maintainers in adding such a feature. > While many readers will be very familiar with the concept of a function and the idea of parameterizing some piece of code or data, others might appreciate a bit of background. [Take a look at the appendix for a tangential explainer of some fundamental ideas referenced throughout this post.](#appendix) @@ -22,7 +17,7 @@ hero = true From outside of a flake's Nix expression, the flake is a black box, a mapping from its input sources to the artifacts that it outputs. There is no built-in way to pass an arbitrary value, a boolean flag or string, from the command line in order to override a deeply nested configuration embedded in your flake. In most cases, this is fine, and you can work around many apparent needs for a one off override by building separate outputs for different purposes. Your flakes will probably come out better designed if you can use them strictly as intended. -A real-life use case where a command line override would come in handy comes from my own [nix-darwin](https://daiderd.com/nix-darwin/) configuration, where I have my [homebrew](https://brew.sh/) formulas and casks specified. I like to let Nix manage installing and upgrading these packages, but unfortunately the process to check for updates eats up a bit of time. When I'm testing a new change to some other part of my nix-darwin setup, I don't like to waste time repeatedly checking for homebrew updates. I could manually disable homebrew updates, but then I have to remember to flip it back on. Wouldn't it be nice to have two commands? Something like: +A real-life use case where a command line override would come in handy comes from my own [nix-darwin](https://daiderd.com/nix-darwin/) configuration, where I have my [homebrew](https://brew.sh/) formulas and casks specified. I like to let Nix manage installing and upgrading these packages, but unfortunately the process to check for updates eats up a bit of time. When I'm testing a new change to some other part of my nix-darwin setup, I don't like to waste time repeatedly checking for homebrew updates. I could manually disable homebrew updates, but then I'd have to remember to flip it back on. Wouldn't it be nice to have two commands? Something like: ```bash # rebuild the full system flake, when we want to perform homebrew updates darwin-rebuild switch --flake @@ -61,7 +56,7 @@ nix eval --override-input my-flag github:boolean-option/false --raw '.#message' So far, every flake-oriented Nix command I have tried supports the `override-input` flag, so this is a pretty reliable mechanism for passing in overrides where needed. -[Take a look](https://git.mat.services/mat/dotfiles.nix/src/branch/main/flake.nix#L16-L17) [at how I use this](https://git.mat.services/mat/dotfiles.nix/src/branch/main/flake.nix#L16-L17) [in my own system flake](https://git.mat.services/mat/dotfiles.nix/src/branch/main/darwin/homebrew.nix#L31). +[Take a look](https://git.mat.services/mat/dotfiles.nix/src/branch/main/flake.nix#L16-L17) [at how I use this](https://git.mat.services/mat/dotfiles.nix/src/branch/main/flake.nix#L256) [in my own system flake](https://git.mat.services/mat/dotfiles.nix/src/branch/main/darwin/homebrew.nix#L31). ## Appendix [Go back to the article](#jumpback) diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 24d0016..83aebaa 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -75,6 +75,15 @@ {% endif %} + {% if page.extra.hero %} +
+ {{ page.extra.heroPrompt }} - generated using Stable Diffusion +
+

{{ page.extra.heroPrompt }} - generated using Stable Diffusion

+
+
+ {% endif %} + {% if page.extra.tldr %}
tl;dr: @@ -83,7 +92,7 @@ {% endif %} {# Optional table of contents #} - {% if config.extra.toc | default(value=false) %} + {% if page.extra.toc | default(value=false) %} {% if page.toc %}

Table of Contents