2019-12-09 03:20:02 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2020-02-21 13:47:29 +01:00
|
|
|
{ name, src, deps ? (_: []), emacs ? pkgs.emacs26-nox }:
|
2019-12-09 03:20:02 +01:00
|
|
|
|
|
|
|
let
|
2020-02-21 13:47:29 +01:00
|
|
|
inherit (pkgs) emacsPackagesNg emacsPackagesNgGen writeTextFile;
|
2019-12-09 03:20:02 +01:00
|
|
|
inherit (builtins) isString toFile;
|
|
|
|
|
2019-12-14 13:49:18 +01:00
|
|
|
finalEmacs = (emacsPackagesNgGen emacs).emacsWithPackages deps;
|
2019-12-09 03:20:02 +01:00
|
|
|
|
|
|
|
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} $@
|
|
|
|
'';
|
|
|
|
}
|