From 961b67894824f005f57767977fa37da4fec3e3fc Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Wed, 16 Feb 2022 11:15:38 -0700 Subject: [PATCH] add piston nix pkg for emacs --- packages/emacs/27.1.0/build.sh | 24 ----------------------- packages/emacs/27.1.0/environment | 4 ---- packages/emacs/27.1.0/metadata.json | 5 ----- packages/emacs/27.1.0/run | 4 ---- packages/emacs/27.1.0/test.el | 1 - runtimes/default.nix | 1 + runtimes/emacs.nix | 30 +++++++++++++++++++++++++++++ 7 files changed, 31 insertions(+), 38 deletions(-) delete mode 100755 packages/emacs/27.1.0/build.sh delete mode 100644 packages/emacs/27.1.0/environment delete mode 100644 packages/emacs/27.1.0/metadata.json delete mode 100644 packages/emacs/27.1.0/run delete mode 100644 packages/emacs/27.1.0/test.el create mode 100644 runtimes/emacs.nix diff --git a/packages/emacs/27.1.0/build.sh b/packages/emacs/27.1.0/build.sh deleted file mode 100755 index a4aecc6..0000000 --- a/packages/emacs/27.1.0/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -export PATH=$PWD/bin:$PATH - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build - -# Emacs version 27.1 supports Docker builds -# Otherwise, older versions will work too, but you will have to disable `/proc/sys/kernel/randomize_va_space` which is less secure -curl -L "http://ftpmirror.gnu.org/emacs/emacs-27.1.tar.gz" -o emacs.tar.gz -tar xzf emacs.tar.gz --strip-components=1 -rm emacs.tar.gz - -# Building without all that X11 stuff -./configure --prefix="$PREFIX" --with-x=no --with-x-toolkit=no --with-xpm=no --with-jpeg=no --with-png=no --with-gif=no --with-tiff=no --with-gnutls=no -make -j$(nproc) -make install -j$(nproc) - -cd .. - -rm -rf build diff --git a/packages/emacs/27.1.0/environment b/packages/emacs/27.1.0/environment deleted file mode 100644 index 780b668..0000000 --- a/packages/emacs/27.1.0/environment +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export PATH=$PWD/bin:$PATH diff --git a/packages/emacs/27.1.0/metadata.json b/packages/emacs/27.1.0/metadata.json deleted file mode 100644 index caa2fb4..0000000 --- a/packages/emacs/27.1.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "emacs", - "version": "27.1.0", - "aliases": ["emacs", "el", "elisp"] -} diff --git a/packages/emacs/27.1.0/run b/packages/emacs/27.1.0/run deleted file mode 100644 index 8bf46e4..0000000 --- a/packages/emacs/27.1.0/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Put instructions to run the runtime -emacs -Q --script "$@" \ No newline at end of file diff --git a/packages/emacs/27.1.0/test.el b/packages/emacs/27.1.0/test.el deleted file mode 100644 index ebe0215..0000000 --- a/packages/emacs/27.1.0/test.el +++ /dev/null @@ -1 +0,0 @@ -(princ "OK") \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index d1a2459..140fd83 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -50,4 +50,5 @@ args: { "gcc-d" = import ./gcc-d.nix args; "gcc-fortran" = import ./gcc-fortran.nix args; "yabasic" = import ./yabasic.nix args; + "emacs" = import ./emacs.nix args; } diff --git a/runtimes/emacs.nix b/runtimes/emacs.nix new file mode 100644 index 0000000..53c4d81 --- /dev/null +++ b/runtimes/emacs.nix @@ -0,0 +1,30 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.emacs-nox; +in piston.mkRuntime { + language = "emacs"; + version = pkg.version; + + aliases = [ + "el" + "elisp" + ]; + + run = '' + ${pkg}/bin/emacs -Q --script "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.el" = '' + (princ "OK") + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.el"; + }) + ]; +} \ No newline at end of file