tvl-depot/overrides/writeElispBin.nix
Vincent Ambo 688233acac feat: Add writeElispBin helper function
Exactly as the name suggests. Currently, passing arguments from the
CLI is not really supported.
2019-12-09 02:20:02 +00:00

23 lines
503 B
Nix

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