Skip to content

Run a program sandboxed in an ephemeral jj workspace using a Nix devshell

License

Notifications You must be signed in to change notification settings

anglesideangle/jjinn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jjinn

Jjinn is a script for nix projects that runs a program (such as opencode) sandboxed inside in an ephemeral jj workspace. It uses the contents of your project's devShells to construct the sandbox environment using bwrap.

Workflow

jjinn integrates nicely into a regular jj workflow. You simply run jjinn <revset> and it will make sure every change made in the ephemeral workspace is synced to a new revset before terminating. You can then jj describe, jj squash, jj merge, jj edit, etc to deal with the resulting revision.

Edit from the current revision in the current repo:

jjinn

Edit from the previous commit in ./project using the my-package devshell output:

jjinn @- --repo ./project --devshell "my-package"

Installation

This project can be used as a flake from github:anglesideangle/jjinn. For example, nix profile add github:anglesideangle/jjinn#jjinn-opencode.

The default jjinn configuration uses opencode. However, it is not tightly coupled to opencode, and you can create your own package using this flake's lib.makeJjinn wrapper.

Here is example configuration for claude code:

jjinn.lib.makeJjinn pkgs {
  executable = lib.getExe pkgs.claude-code;
  sandboxInputs = with pkgs; [
    claude-code
    nix
    coreutils
    curl
    which
    findutils
    diffutils
    gnupatch
    gnugrep
    ...etc
  ];
  homeBinds = [ ".claude" ];
}

About

Run a program sandboxed in an ephemeral jj workspace using a Nix devshell

Resources

License

Stars

Watchers

Forks