Skip to content

Instantly share code, notes, and snippets.

@schickling
Last active January 20, 2026 17:07
Show Gist options
  • Select an option

  • Save schickling/3ffc86a8631befda15826948604e2ce5 to your computer and use it in GitHub Desktop.

Select an option

Save schickling/3ffc86a8631befda15826948604e2ce5 to your computer and use it in GitHub Desktop.

Devenv + flake path input interop (.devenv.flake.nix)

Problem (short)

When a repo is used as a path flake input inside another repo’s devenv, devenv expects <input>/.devenv.flake.nix to exist. If that file is untracked, it is not included in the flake snapshot, so devenv shell fails with:

error: '/nix/store/<...>/effect-utils/.devenv.flake.nix' does not exist

This happens even if the input is a valid flake and the .devenv.flake.nix is generated locally (but not committed).

Minimal repro (conceptual)

Repo layout:

repo-a/
  devenv.yaml
  devenv.nix
  flake.nix
shared-lib/
  flake.nix
  # note: .devenv.flake.nix is missing (untracked)

Setup:

  • repo-a/ (flake) uses devenv and has input:
    • shared-lib.url = "path:../shared-lib"
  • shared-lib/ is a flake input. It does not commit .devenv.flake.nix.
  • Run: devenv shell in repo-a.
  • Failure: .../.devenv.flake.nix does not exist.

Constraints

  • Must stay pure (no --impure).
  • Must work for path inputs (local workspace checkouts).
  • Should avoid per-repo hacks / heavy boilerplate.

Possible solutions (looking for best practice)

1) Commit a minimal .devenv.flake.nix in the input repo (simple)

Pros: works with path inputs, no extra logic. Cons: adds a file to every repo; feels like a workaround.

Minimal file:

{
  inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
  outputs = { self, nixpkgs, ... }: { };
}

2) Generate .devenv.flake.nix into a local workspace copy

(e.g. rsync-based workspace sync) Pros: keeps source repo clean. Cons: still breaks if someone uses a path input directly to the repo, not the copy.

3) Use flake = false + direct import in devenv.nix

Pros: no .devenv.flake.nix required. Cons: might require builtins.path to avoid purity errors and bypasses flake outputs.

4) Devenv setting to skip .devenv.flake.nix

Ideal if supported, but unclear if there is a supported switch.

Question

What is the recommended, idiomatic way to make devenv robust when it consumes path-based flake inputs that may not include .devenv.flake.nix?

We’re leaning toward option 1 if it’s the standard expectation, but want guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment