tvl-depot/nix/writeElispBin/default.nix
Vincent Ambo 87f1e15baa chore(writeElispBin): Move from //overrides to //nix
... some legacy cleanup ...

Change-Id: I9e73451256f842e75ddbf1382badaf06c775c755
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2212
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-12-01 12:55:59 +00:00

18 lines
437 B
Nix

{ depot, pkgs, ... }:
{ name, src, deps ? (_: []), emacs ? pkgs.emacs27-nox }:
let
inherit (pkgs) emacsPackages emacsPackagesGen;
inherit (builtins) isString toFile;
finalEmacs = (emacsPackagesGen 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} $@
''