about summary refs log blame commit diff
path: root/nix/writeElispBin/default.nix
blob: e23c55a0a4ba41962a5f19cfa2daff4288d0e5a2 (plain) (tree)
1
2
3
4
5
6
7
8
9
                     
 
                                                         

   
                                                

                                     
                                                               
 

                   

                                
 

                                


                                                                       
{ depot, pkgs, ... }:

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