2019-12-09 03:20:02 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2019-12-09 04:00:56 +01:00
|
|
|
{ name, src, deps ? (_: []), emacs ? pkgs.third_party.emacs26-nox }:
|
2019-12-09 03:20:02 +01:00
|
|
|
|
|
|
|
let
|
2019-12-14 13:49:18 +01:00
|
|
|
inherit (pkgs.third_party) 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} $@
|
|
|
|
'';
|
|
|
|
}
|