diff options
Diffstat (limited to 'overrides/writeElispBin.nix')
-rw-r--r-- | overrides/writeElispBin.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/overrides/writeElispBin.nix b/overrides/writeElispBin.nix new file mode 100644 index 000000000000..a1616fb9d464 --- /dev/null +++ b/overrides/writeElispBin.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ name, src, deps ? (_: []), emacs ? pkgs.third_party.emacs26-nox }: + +let + inherit (pkgs.third_party) emacsPackagesNg emacsPackagesNgGen writeTextFile; + inherit (builtins) isString toFile; + + finalEmacs = (emacsPackagesNgGen emacs).emacsWithPackages deps; + + 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} $@ + ''; +} |