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-03-09 00:17:01 +01:00
|
|
|
inherit (pkgs) emacsPackages emacsPackagesGen writeTextFile;
|
2019-12-09 03:20:02 +01:00
|
|
|
inherit (builtins) isString toFile;
|
|
|
|
|
2020-03-09 00:17:01 +01:00
|
|
|
finalEmacs = (emacsPackagesGen 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} $@
|
|
|
|
'';
|
|
|
|
}
|