about summary refs log tree commit diff
path: root/overrides/writeElispBin/default.nix
blob: 1b3ba054430bc88c8b264d6a444f131de593ff8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ depot, pkgs, ... }:

{ name, src, deps ? (_: []), emacs ? pkgs.emacs26-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} $@
''