<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x" -->

---
title: A build graph that rolls dice | daily.dev
description: An exploration of Nix's dynamic derivations feature and how it fundamentally changes Nix's build model from 'applicative' (entire build graph known upfront) to...
canonical: https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A build graph that rolls dice | daily.dev
og:description: An exploration of Nix's dynamic derivations feature and how it fundamentally changes Nix's build model from 'applicative' (entire build graph known upfront) to...
og:url: https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x
og:image: https://api.daily.dev/og/posts/iX491TA2X.png
og:image:alt: A build graph that rolls dice
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# A build graph that rolls dice

**[Farid Zakaria’s Blog](https://daily.dev/sources/fzakaria)** · 9 min read · 0 upvotes · 0 comments

## Summary

An exploration of Nix's dynamic derivations feature and how it fundamentally changes Nix's build model from 'applicative' (entire build graph known upfront) to 'monadic' (graph defined as the build progresses). The piece draws on the Build Systems à la Carte paper to explain the applicative/monadic distinction using type signatures and a shopping-list analogy, then argues that Nix's import-from-derivation has always been a monadic bind in the evaluator, while dynamic derivations move that bind into the scheduler, enabling parallelism, remote builds, and caching. A worked example, a Nix expression that recursively rolls a die and builds a chain of derivations whose length is only known after execution, demonstrates that tools like --dry-run and nix-store -q --tree cannot introspect graphs that don't exist yet. The post closes by speculating on uses beyond lang2nix-style build graph generation: emulating games until a stopping condition, state-space search, and web crawling as derivation graphs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://fzakaria.com/2026/09/20/a-build-graph-that-rolls-dice>

## Questions this post answers

### What is the difference between an applicative and a monadic build system in Nix?

An applicative build system knows its entire build graph up front, like writing a shopping list before leaving the house, while a monadic build system defines the graph as the build progresses, like a recipe step that says taste it and decide what to buy next. Nix was traditionally applicative; dynamic derivations add monadic behavior by letting the scheduler bind on values that only exist after a build runs.

_Explore how dynamic derivations reshape Nix build graphs and tooling on daily.dev._

### Can nix build --dry-run show the full build graph when using dynamic derivations?

No, dry-run and nix-store -q --tree cannot show the graph produced by dynamic derivations because that graph does not exist until after the build runs. Running nix build --dry-run against a dynamic derivation chain produces a warning like 'Ignoring dynamic derivation ...^out while querying missing paths; not yet implemented', since the ecosystem has no way to introspect a graph that is only known post-build.

_Track tooling gaps like this before betting a Nix pipeline on dynamic derivations._

### Why does nixpkgs ban import from derivation (IFD)?

Import from derivation is banned in nixpkgs because it forces the evaluator to stop and run a builder just to keep evaluating, which is slow and can cause instantiation to take many seconds longer than normal (one measured case took ten seconds). It is a monadic bind performed in the evaluator rather than the scheduler, so it cannot be parallelized, shipped to remote machines, or substituted from a cache the way scheduler-level dynamic derivations can.

_Compare IFD's footguns against dynamic derivations before choosing a Nix build strategy._

## Similar posts on daily.dev

- [nix-build in under 100 lines](https://daily.dev/posts/nix-build-in-under-100-lines-i1prrs0qp) · Lobsters · 1 upvotes · 0 comments
- [Relocatable Derivations](https://daily.dev/posts/relocatable-derivations-vtnnukaxa) · Farid Zakaria’s Blog · 0 upvotes · 0 comments
- [Nix and Determinate are a better foundation for keeping your systems secure](https://daily.dev/posts/nix-and-determinate-are-a-better-foundation-for-keeping-your-systems-secure-fphnvfpxe) · Determinate Systems · 0 upvotes · 0 comments
- [figsoda/drowse: Nix dynamic derivations made easy](https://daily.dev/posts/figsoda-drowse-nix-dynamic-derivations-made-easy-zfmqws9tz) · Lobsters · 0 upvotes · 0 comments
- [The Guix Nix Abomination: Leveraging Guix derivations in Nix](https://daily.dev/posts/the-guix-nix-abomination-leveraging-guix-derivations-in-nix-msosqe7hy) · Farid Zakaria’s Blog · 0 upvotes · 0 comments

---

Tags: [#functional-programming](https://daily.dev/tags/functional-programming), [#build-systems](https://daily.dev/tags/build-systems)

[View this post on daily.dev](https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"A build graph that rolls dice","url":"https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x"},"datePublished":"2026-09-21T01:24:20.326Z","dateModified":"2026-09-21T01:24:44.121Z","description":"An exploration of Nix's dynamic derivations feature and how it fundamentally changes Nix's build model from 'applicative' (entire build graph known upfront) to...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"Farid Zakaria’s Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Farid Zakaria’s Blog","logo":"https://media.daily.dev/image/upload/s--YqqvRt90--/f_auto/v1723789280/logos/fzakaria","url":"https://daily.dev/sources/fzakaria"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"functional-programming,build-systems","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Farid Zakaria’s Blog","item":"https://daily.dev/sources/fzakaria"},{"@type":"ListItem","position":3,"name":"A build graph that rolls dice"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/a-build-graph-that-rolls-dice-ix491ta2x#faq","mainEntity":[{"@type":"Question","name":"What is the difference between an applicative and a monadic build system in Nix?","acceptedAnswer":{"@type":"Answer","text":"An applicative build system knows its entire build graph up front, like writing a shopping list before leaving the house, while a monadic build system defines the graph as the build progresses, like a recipe step that says taste it and decide what to buy next. Nix was traditionally applicative; dynamic derivations add monadic behavior by letting the scheduler bind on values that only exist after a build runs. Explore how dynamic derivations reshape Nix build graphs and tooling on daily.dev."}},{"@type":"Question","name":"Can nix build --dry-run show the full build graph when using dynamic derivations?","acceptedAnswer":{"@type":"Answer","text":"No, dry-run and nix-store -q --tree cannot show the graph produced by dynamic derivations because that graph does not exist until after the build runs. Running nix build --dry-run against a dynamic derivation chain produces a warning like 'Ignoring dynamic derivation ...^out while querying missing paths; not yet implemented', since the ecosystem has no way to introspect a graph that is only known post-build. Track tooling gaps like this before betting a Nix pipeline on dynamic derivations."}},{"@type":"Question","name":"Why does nixpkgs ban import from derivation (IFD)?","acceptedAnswer":{"@type":"Answer","text":"Import from derivation is banned in nixpkgs because it forces the evaluator to stop and run a builder just to keep evaluating, which is slow and can cause instantiation to take many seconds longer than normal (one measured case took ten seconds). It is a monadic bind performed in the evaluator rather than the scheduler, so it cannot be parallelized, shipped to remote machines, or substituted from a cache the way scheduler-level dynamic derivations can. Compare IFD's footguns against dynamic derivations before choosing a Nix build strategy."}}]}
```

