agentleFS
elodin-syselodin-sys/elodin/.cursor/skills/elodin-nix/SKILL.md

elodin-nix

Skill553 starsChanged 5 months agoApache-2.0View on GitHub

Work with the Nix development environment and NixOS configurations in Elodin. Use when troubleshooting nix develop, modifying flake.nix, adding Nix packages, setting up OrbStack VMs for Linux builds on macOS, or developing Aleph NixOS modules.

  • Pipes a download into a shell
  • Reads credentials

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No need to switch shells for different tasks — everything is in one environment.

    line 21
  2. Distinctive:

    Use the Determinate Systems installer (recommended):

    line 35
  3. Distinctive:

    Add your username to trusted users for binary cache access:

    line 43
  4. Very specific:

    Create a NixOS VM named nixos

    line 100
  5. Distinctive:

    Check binary cache connectivity

    line 158
  6. Very specific:

    Ensure trusted-users is configured

    line 159
  7. Very specific:

    Run nix flake update to refresh the lock file

    line 166

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Elodin Nix Development

Elodin uses Nix flakes for reproducible builds, CI dependencies, Docker images, and the Aleph NixOS flight computer configuration.

Development Shell

The unified dev shell includes all tools for Rust, Python, C/C++, cloud operations, documentation, and git-lfs:

nix develop                              # Enter interactive shell (bash or zsh)
ELODIN_SHELL=zsh nix develop             # Force zsh + p10k
ELODIN_SHELL=bash nix develop            # Force bash
nix develop --command "cargo build"      # One-off command

No need to switch shells for different tasks — everything is in one environment.

Shell isolation

Each nix develop is self-contained so parallel worktrees and agent shells do not overwrite each other:

  • VIRTUAL_ENV is set to <worktree>/target/shells/$ELODIN_SHELL_ID/venv and prepended to PATH on entry. A bare venv is created on first entry if missing; do not source .venv/bin/activate. just install py installs into that venv.
  • ELODIN_SHELL_ID can be set to a path-safe persistent name before entering the shell. Otherwise it defaults to the terminal session id on Linux (ps -o sid= -p $$) and $$ elsewhere. Reuse a named ID across nix develop calls when a workflow must preserve its venv and bin directory.
  • ELODIN_SHELL_BIN is <worktree>/target/shells/$ELODIN_SHELL_ID/bin. Automatically named numeric shells contain a garbage-collectable marker and are pruned after their process dies. Explicitly named shells are retained.
  • just install builds elodin / elodin-db into $ELODIN_SHELL_BIN (this shell only).
  • ELODIN_SHELL defaults to auto, which walks parent processes for zsh or bash (nix develop overwrites $SHELL with bash). If none is found, bash is used. ELODIN_SHELL=zsh / ELODIN_SHELL=bash override. zsh sets SHELL to nix zsh and writes a wrapper ZDOTDIR .zshrc that sources ~/.zshrc then re-prepends the nix PATH; bash stays in the hook environment (no exec). Both define zar='gtar --zstd --sparse'.

Nix Installation

Use the Determinate Systems installer (recommended):

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

Trusted Users

Add your username to trusted users for binary cache access:

Determinate Nix — edit /etc/nix/nix.custom.conf:

trusted-users = root <your_username>

Upstream Nix — edit /etc/nix/nix.conf:

experimental-features = nix-command flakes
trusted-users = root <your_username>

Restart the daemon:

# macOS
sudo launchctl kickstart -k system/systems.determinate.nix-daemon
# Linux
sudo systemctl restart nix-daemon.service

Binary Cache

Elodin maintains a binary cache to avoid rebuilding common dependencies:

elodin-nix-cache.s3.us-west-2.amazonaws.com

This is configured in flake.nix and used automatically by nix develop and nix build.

Flake Structure

Root flake.nix

Provides:

  • Dev shell: nix develop — unified development environment
  • Run shell: nix develop .#run — packaged CLI/DB/Python plus GStreamer + elodinsink
  • Packages: elodin-py, elodin-cli, elodin-db, elodinsink
  • Overlay: elodinOverlay with all Elodin packages
  • NixOS configs: NixOS 25.11 based

Key inputs: nixpkgs, rust-overlay (for toolchain from rust-toolchain.toml), crane (Rust builds).

aleph/flake.nix

NixOS configuration for the Aleph flight computer. Composes modules from aleph/modules/ into a complete system. See the elodin-aleph skill for details.

aleph/template/flake.nix

Template for users to create their own Aleph configurations. Imports Elodin's NixOS modules and configures services.

macOS Linux Builds (OrbStack VM)

Build Linux binaries on macOS using an OrbStack NixOS VM for remote builds:

  1. Install OrbStack
  2. Create a NixOS VM named nixos
  3. Configure SSH — add to /var/root/.ssh/config:
    Host orb
      Hostname 127.0.0.1
      Port 32222
  4. Register as build machine — add to /etc/nix/machines:
    ssh://user@orb x86_64-linux,aarch64-linux /Users/user/.orbstack/ssh/id_ed25519 20 20 nixos-test,benchmark,big-parallel,kvm - -
  5. Inside the VM, add to /etc/nixos/configuration.nix:
    nix.settings.trusted-users = ["root" "@wheel"];
  6. Rebuild: sudo nixos-rebuild switch
  7. Test: nix build --impure --expr '(with import <nixpkgs> { system = "x86_64-linux"; }; runCommand "foo" {} "uname > $out")'

OrbStack Disk Exhaustion

Qt builds can overflow /build tmpfs. Fix by using disk-backed build directory:

# In /etc/nixos/configuration.nix on the VM
nix.settings.build-dir = "/var/cache/nix-build";
systemd.tmpfiles.rules = [ "d /var/cache/nix-build 1777 root root -" ];

Then:

sudo install -d -m 1777 /var/cache/nix-build
sudo nixos-rebuild switch

Adding Packages to the Dev Shell

Edit the devShells section in the root flake.nix. The shell is built from a single unified definition that includes:

  • Rust toolchain (from rust-toolchain.toml)
  • Python 3.13 + uv + maturin
  • C/C++ compilers and system libraries
  • GStreamer (for video streaming)
  • git-lfs
  • Cloud operation tools

Nix Formatting

All .nix files are formatted with Alejandra (no configuration):

alejandra

This is enforced by CI.

Troubleshooting

nix develop hangs or is slow

  • First run downloads and builds many dependencies — this is normal
  • Check binary cache connectivity
  • Ensure trusted-users is configured

Build failures referencing missing system libraries

  • These are provided by the Nix shell; make sure you're inside nix develop
  • For macOS-specific issues, check that Xcode Command Line Tools are installed

Hash mismatch errors

  • Run nix flake update to refresh the lock file
  • Or pin specific inputs in flake.lock

Key References

  • Internal Nix docs: docs/internal/nix.md
  • Root flake: flake.nix
  • Aleph flake: aleph/flake.nix
  • Nix overlay: defined in root flake.nix as elodinOverlay

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.