tvl-depot/utils/default.nix
William Carroll 6b224a9e31 Drop support for lorri
Lorri does not cleanly integrate with my corporate device, which cannot run
NixOS. To expose dependencies to Emacs buffers, I will use nix-buffer.el, which
reads its values from dir-locals.nix. To easily expose dependencies from my
existing shell.nix files into dir-locals.nix, I wrote a Nix utility function.
2020-03-27 10:59:50 +00:00

20 lines
665 B
Nix

{ pkgs, ... }:
# Using this as a library to define some common utility functions that I often
# reach for.
{
# A unary function that returns its argument.
identity = x: x;
# Create a derivation that creates an executable shell script named `as` that
# calls the program located at `path`, forwarding all of the arguments.
wrapNonNixProgram = { path, as }: pkgs.writeShellScriptBin as ''
exec ${path} "$@"
'';
# Expose the buildInputs from a Nix shell to an Emacs buffer. Intended to be
# called from dir-locals.nix files.
nixBufferFromShell = path: let
shell = import path;
in pkgs.nixBufferBuilders.withPackages shell.buildInputs;
}