Skip to content

v0.5.2 - `mkShell` wrappers

Latest
Compare
Choose a tag to compare
@mibmo mibmo released this 10 Oct 13:51

A small but hugely powerful change - having the option of swapping out the mkShell function!

This is mainly useful for tools like crane, which has a mkShell-compatible wrapper that adds Cargo and relevant tools, but anything is possible: there's nothing stopping you from creating your own wrapper and customising the inputs before passing to pkgs.mkShell.

Changing values

{
  inputs.conch.url = "github:mibmo/conch";
  outputs = { conch, ... }:
    crane.load [ ... ]
      ({ pkgs, ... }: {
        # unset `packages`
        mkShell = options: pkgs.mkShell (options // { packages = [ ]; });
        # `packages` now has no effect
        packages = with pkgs; [ ... ];
      });
}

Usage with crane

{
  inputs = {
    conch.url = "github:mibmo/conch";
    crane.url = "github:ipetkov/crane";
  };
  outputs = { conch, crane, ... }:
    crane.load [ ... ]
      ({ pkgs, ... }: {
        # use crane's mkShell wrapper
        mkShell = (crane.mkLib pkgs).devShell;
        # still works as normal!
        packages = with pkgs; [ ... ];
      });
}

This might lead into the next generation of Rust integration for Conch, but we'll see; that's for a future release :)