Skip to content

Instantly share code, notes, and snippets.

View edolstra's full-sized avatar

Eelco Dolstra edolstra

View GitHub Profile
@edolstra
edolstra / sparse-lockfiles.md
Last active July 29, 2026 17:31
Sparse lock files

Sparse lock files

Problems

GitHub issue: NixOS/nix#7730

Lock file size

Nix flake lock files can become very big: they include locks not only for the immediate inputs of a flake, but also for all transitive inputs. It makes update semantics weird: transitive locks can get out of sync with what's in the lock files of the inputs.

@edolstra
edolstra / foo.cc
Last active December 3, 2019 13:03
FS accessors
struct FSAccessor {
virtual Stat stat(const Path & path) = 0;
virtual StringSet readDirectory(const Path & path) = 0;
virtual std::string readFile(const Path & path) = 0;
virtual std::string readLink(const Path & path) = 0;
};
// Accessor to the actual filesystem.
struct RealFSAccessor { ... };
@edolstra
edolstra / mes-test.nix
Created December 12, 2018 16:40
TinyCC bootstrap
with import <nixpkgs> { system = "i686-linux"; };
rec {
mesBoot0 = import <nix/fetchurl.nix> {
url = http://alpha.gnu.org/gnu/guix/bootstrap/i686-linux/20181020/mes-minimal-stripped-0.18-0.08f04f5-i686-linux.tar.xz;
sha256 = "0qwpby91hp6afmg5ibdrrk3fw85zxdazfk7rhrdsihsfzqwmfhfx";
};
mesccToolsBoot = import <nix/fetchurl.nix> {

Nix Flake MVP

Goals

  • To provide Nix repositories with an easy and standard way to reference other Nix repositories.

  • To allow such references to be queried and updated automatically.

  • To provide a replacement for nix-channel, NIX_PATH and Hydra

@edolstra
edolstra / nix-lang.md
Last active April 1, 2026 14:31
Nix language changes

This document contains some ideas for additions to the Nix language.

Motivation

The Nix package manager, Nixpkgs and NixOS currently have several problems:

  • Poor discoverability of package options. Package functions have function arguments like enableFoo, but there is no way for the Nix UI to discover them, let alone to provide programmatic ways to
@edolstra
edolstra / nix-ui.md
Last active August 16, 2025 00:03
Nix UI

General notes

  • nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.

  • By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.

    @vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.

TBD: How to deal with search path clashes.