depot/third_party/tvl/nix/writeElispBin/default.nix
Default email a291c8690a Project import generated by Copybara.
GitOrigin-RevId: e6e19f3d81a982a62e1bba08f0b4f7fdc21b4ea0
2022-05-19 16:39:52 +02:00

20 lines
442 B
Nix

{ depot, pkgs, ... }:
{ name, src, deps ? (_: [ ]), emacs ? pkgs.emacs28-nox }:
let
inherit (pkgs) emacsPackages emacsPackagesFor;
inherit (builtins) isString toFile;
finalEmacs = (emacsPackagesFor emacs).emacsWithPackages deps;
srcFile =
if isString src
then toFile "${name}.el" src
else src;
in
depot.nix.writeScriptBin name ''
#!/bin/sh
${finalEmacs}/bin/emacs --batch --no-site-file --script ${srcFile} $@
''