Skip to content

direnv shim, part II#10

Open
faukah wants to merge 1 commit into
mainfrom
faukah/push-urlnlvwonlqm
Open

direnv shim, part II#10
faukah wants to merge 1 commit into
mainfrom
faukah/push-urlnlvwonlqm

Conversation

@faukah
Copy link
Copy Markdown
Member

@faukah faukah commented May 31, 2026

successor of #7.

This PR implements cade-backed direnv compatibility:

  • Add cade export json, producing a direnv-compatible JSON env delta.
  • Add a packaged direnv shim:
    • direnv export json -> cade export json
    • shell exports/hooks/allow/deny/status mapped to cade equivalents
  • Add Nix flake/package/module wiring:
    • .#direnv-compat
    • .#direnv-compat-bash
    • programs.cade.direnvCompat = true
  • Rework Nix shell loading to use nix develop --command ... env -0 instead of nix print-dev-env --json, so shellHook mutations like PATH changes are captured.
  • Add src/env_delta.rs to centralize env diff rendering for shell output and JSON export.
  • Split shell rendering into EnvOutput vs ShellOutput, and emits Nushell PATH as a list.
  • Split tests into focused files for direnv shim, envrc integration, JSON export, and shared test helpers.
  • Keep main’s newer slow-loader progress output while merging in the Nix env capture logic.

@faukah faukah requested a review from atagen May 31, 2026 09:35
@faukah faukah force-pushed the faukah/push-urlnlvwonlqm branch 2 times, most recently from 1a7d16a to 454fd49 Compare May 31, 2026 11:53
@faukah faukah force-pushed the faukah/push-urlnlvwonlqm branch 4 times, most recently from 5260a29 to 45dabcd Compare May 31, 2026 14:12
@faukah faukah force-pushed the faukah/push-urlnlvwonlqm branch from 45dabcd to b54dccc Compare May 31, 2026 15:19
Comment thread src/core/activation.rs
all_watch_files.extend(watch_files.clone());

let token = compute_layer_key(&watch_files);
let dir = path.to_string_lossy();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably be more careful w path handling

Comment thread nix/direnv-compat.nix
cadeExe = lib.getExe cade;
in
writeScriptBin "direnv" (
builtins.replaceStrings [ "@bash@" "@cade@" ] [ "${bash}" cadeExe ] (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can just be an inline block with ${} substitution

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants