Merge pull request #6641 from oxij/emacs-ng

Somewhat more generic emacs packages' builder and a bunch of new emacs packages and metas
This commit is contained in:
Eric Seidel 2015-03-05 13:22:45 -08:00
commit 6b60f3dcad
10 changed files with 429 additions and 139 deletions

View File

@ -0,0 +1,31 @@
{trivialBuild, fetchFromGitHub}:
trivialBuild rec {
pname = "nyan-mode";
version = "20150128";
src = fetchFromGitHub {
owner = "TeMPOraL";
repo = pname;
rev = "41faa2c809da7b2cb3e6f8fadefae3f338ced3f2";
sha256 = "1idaac7sjc8hhbf5zif61ncg1pvg28c0qfihavdx61albww0ll7f";
};
patches = [ ./directory.patch ];
preBuild = ''
substituteInPlace nyan-mode.el \
--replace "@OUT@" "$out/"
'';
postInstall = ''
cp -r img $out
cp -r mus $out
'';
meta = {
description = "An analog indicator of the position in the buffer";
homepage = https://github.com/TeMPOraL/nyan-mode/;
license = "GPLv3+";
};
}

View File

@ -0,0 +1,13 @@
diff --git a/nyan-mode.el b/nyan-mode.el
index 939a25a..3d0b983 100644
--- a/nyan-mode.el
+++ b/nyan-mode.el
@@ -106,7 +106,7 @@ This can be t or nil."
:group 'nyan)
-(defconst +nyan-directory+ (file-name-directory (or load-file-name buffer-file-name)))
+(defconst +nyan-directory+ "@OUT@")
(defconst +nyan-cat-size+ 3)

View File

@ -0,0 +1,41 @@
# generic builder for Emacs packages
{ lib, stdenv, emacs, texinfo }:
with lib;
{ pname
, version ? null
, buildInputs ? []
, packageRequires ? []
, meta ? {}
, ...
}@args:
let
defaultMeta = {
broken = false;
platforms = emacs.meta.platforms;
};
in
stdenv.mkDerivation ({
name = "emacs-${pname}${optionalString (version != null) "-${version}"}";
buildInputs = [emacs texinfo] ++ packageRequires ++ buildInputs;
propagatedBuildInputs = packageRequires;
propagatedUserEnvPkgs = packageRequires;
setupHook = ./setup-hook.sh;
doCheck = false;
meta = defaultMeta // meta;
}
// removeAttrs args [ "buildInputs" "packageRequires"
"meta"
])

View File

@ -0,0 +1,67 @@
# builder for Emacs packages built for packages.el
# using MELPA package-build.el
{ lib, stdenv, fetchurl, emacs, texinfo }:
with lib;
{ pname
, version
, files ? null
, fileSpecs ? [ "*.el" "*.el.in" "dir"
"*.info" "*.texi" "*.texinfo"
"doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo"
]
, meta ? {}
, ...
}@args:
let
packageBuild = fetchurl {
url = https://raw.githubusercontent.com/milkypostman/melpa/12a862e5c5c62ce627dab83d7cf2cca6e8b56c47/package-build.el;
sha256 = "1nviyyprypz7nmam9rwli4yv3kxh170glfbznryrp4czxkrjjdhk";
};
fname = "${pname}-${version}";
targets = concatStringsSep " " (if files == null then fileSpecs else files);
defaultMeta = {
homepage = "http://melpa.org/#/${pname}";
};
in
import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
inherit packageBuild;
buildPhase = ''
runHook preBuild
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-f melpa2nix-build-package \
${pname} ${version} ${targets}
runHook postBuild
'';
installPhase = ''
runHook preInstall
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-f melpa2nix-install-package \
${fname}.* $out/share/emacs/site-lisp/elpa
runHook postInstall
'';
meta = defaultMeta // meta;
}
// removeAttrs args [ "files" "fileSpecs"
"meta"
])

View File

@ -0,0 +1,34 @@
# trivial builder for Emacs packages
{ lib, ... }@envargs:
with lib;
args:
import ./generic.nix envargs ({
#preConfigure = ''
# export LISPDIR=$out/share/emacs/site-lisp
# export VERSION_SPECIFIC_LISPDIR=$out/share/emacs/site-lisp
#'';
buildPhase = ''
eval "$preBuild"
emacs -L . --batch -f batch-byte-compile *.el
eval "$postBuild"
'';
installPhase = ''
eval "$preInstall"
LISPDIR=$out/share/emacs/site-lisp
install -d $LISPDIR
install *.el *.elc $LISPDIR
eval "$postInstall"
'';
}
// args)

View File

@ -1,104 +0,0 @@
# generic builder for Emacs packages
{ stdenv, fetchurl, emacs, texinfo
, extension ? (self : super : {})
}:
{ pname
, version
, src
, packageRequires ? []
, extraBuildInputs ? []
, files ? null
, fileSpecs ? [ "*.el" "*.el.in" "dir"
"*.info" "*.texi" "*.texinfo"
"doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo"
]
, meta ? {}
, preUnpack ? "", postUnpack ? ""
, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? ""
, configureFlags ? [], preConfigure ? "", postConfigure ? ""
, buildPhase ? "", preBuild ? "", postBuild ? ""
, preInstall ? "", postInstall ? ""
, doCheck ? false, checkPhase ? "", preCheck ? "", postCheck ? ""
, preFixup ? "", postFixup ? ""
}:
let
inherit (stdenv.lib) concatStringsSep optionalAttrs;
packageBuild = fetchurl {
url = https://raw.githubusercontent.com/milkypostman/melpa/12a862e5c5c62ce627dab83d7cf2cca6e8b56c47/package-build.el;
sha256 = "1nviyyprypz7nmam9rwli4yv3kxh170glfbznryrp4czxkrjjdhk";
};
fname = "${pname}-${version}";
targets = concatStringsSep " " (if files == null then fileSpecs else files);
defaultMeta = {
broken = false;
homepage = "http://melpa.org/#/${pname}";
platforms = emacs.meta.platforms;
};
in
stdenv.mkDerivation ({
name = "emacs-${fname}";
inherit src packageBuild;
buildInputs = [emacs texinfo] ++ packageRequires ++ extraBuildInputs;
propagatedBuildInputs = packageRequires;
propagatedUserEnvPkgs = packageRequires;
setupHook = ./setup-hook.sh;
buildPhase = ''
runHook preBuild
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-f melpa2nix-build-package \
${pname} ${version} ${targets}
runHook postBuild
'';
installPhase = ''
runHook preInstall
emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-f melpa2nix-install-package \
${fname}.* $out/share/emacs/site-lisp/elpa
runHook postInstall
'';
meta = defaultMeta // meta;
}
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
// optionalAttrs (configureFlags != []) { inherit configureFlags; }
// optionalAttrs (patches != []) { inherit patches; }
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
// optionalAttrs (prePatch != "") { inherit prePatch; }
// optionalAttrs (postPatch != "") { inherit postPatch; }
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
// optionalAttrs (postConfigure != "") { inherit postConfigure; }
// optionalAttrs (buildPhase != "") { inherit buildPhase; }
// optionalAttrs (preBuild != "") { inherit preBuild; }
// optionalAttrs (postBuild != "") { inherit postBuild; }
// optionalAttrs (doCheck) { inherit doCheck; }
// optionalAttrs (checkPhase != "") { inherit checkPhase; }
// optionalAttrs (preCheck != "") { inherit preCheck; }
// optionalAttrs (postCheck != "") { inherit postCheck; }
// optionalAttrs (preInstall != "") { inherit preInstall; }
// optionalAttrs (postInstall != "") { inherit postInstall; }
// optionalAttrs (preFixup != "") { inherit preFixup; }
// optionalAttrs (postFixup != "") { inherit postFixup; }
)

View File

@ -9995,6 +9995,9 @@ let
elvis = callPackage ../applications/editors/elvis { }; elvis = callPackage ../applications/editors/elvis { };
emacs = emacs24; emacs = emacs24;
emacsPackages = emacs24Packages;
emacsPackagesNg = emacs24PackagesNg;
emacsMelpa = emacs24PackagesNg; # for backward compatibility
emacs24 = callPackage ../applications/editors/emacs-24 { emacs24 = callPackage ../applications/editors/emacs-24 {
# use override to enable additional features # use override to enable additional features
@ -10017,14 +10020,7 @@ let
}); });
emacs24Macport = self.emacs24Macport_24_4; emacs24Macport = self.emacs24Macport_24_4;
emacsMelpa = import ./emacs-melpa-packages.nix { emacsPackagesGen = emacs: self: let callPackage = newScope self; in rec {
inherit stdenv pkgs fetchurl fetchgit fetchFromGitHub emacs texinfo;
external = {
inherit (haskellngPackages) ghc-mod structured-haskell-mode;
};
};
emacsPackages = emacs: self: let callPackage = newScope self; in rec {
inherit emacs; inherit emacs;
autoComplete = callPackage ../applications/editors/emacs-modes/auto-complete { }; autoComplete = callPackage ../applications/editors/emacs-modes/auto-complete { };
@ -10179,7 +10175,27 @@ let
cask = callPackage ../applications/editors/emacs-modes/cask { }; cask = callPackage ../applications/editors/emacs-modes/cask { };
}; };
emacs24Packages = recurseIntoAttrs (emacsPackages emacs24 pkgs.emacs24Packages); emacs24Packages = recurseIntoAttrs (emacsPackagesGen emacs24 pkgs.emacs24Packages);
emacsPackagesNgGen = emacs: import ./emacs-packages.nix {
overrides = (config.emacsPackageOverrides or (p: {})) pkgs;
inherit lib stdenv fetchurl fetchgit fetchFromGitHub emacs;
trivialBuild = import ../build-support/emacs/trivial.nix {
inherit lib stdenv emacs texinfo;
};
melpaBuild = import ../build-support/emacs/melpa.nix {
inherit lib stdenv fetchurl emacs texinfo;
};
external = {
inherit (haskellngPackages) ghc-mod structured-haskell-mode Agda;
};
};
emacs24PackagesNg = emacsPackagesNgGen emacs24;
inherit (gnome3) empathy; inherit (gnome3) empathy;

View File

@ -1,27 +1,37 @@
{ pkgs, stdenv, fetchurl, fetchFromGitHub, fetchgit
, emacs, texinfo
# non-emacs packages
, external
}:
# package.el-based emacs packages # package.el-based emacs packages
#
## init.el ## add this at the start your init.el:
# (require 'package) # (require 'package)
# (setq package-archives nil #
# package-user-dir "~/.nix-profile/share/emacs/site-lisp/elpa") # ;; optional. makes unpure packages archives unavailable
# (setq package-archives nil)
#
# (add-to-list 'package-directory-list "/run/current-system/sw/share/emacs/site-lisp/elpa")
#
# ;; optional. use this if you install emacs packages to user profiles (with nix-env)
# (add-to-list 'package-directory-list "~/.nix-profile/share/emacs/site-lisp/elpa")
#
# (package-initialize) # (package-initialize)
with stdenv.lib.licences; { overrides
let , lib, stdenv, fetchurl, fetchgit, fetchFromGitHub
melpaBuild = import ../build-support/melpa {
inherit stdenv fetchurl emacs texinfo; , emacs
}; , trivialBuild
in , melpaBuild
, external
}@args:
with lib.licences;
let self = _self // overrides;
callPackage = lib.callPackageWith (self // removeAttrs args ["overrides" "external"]);
_self = with self; {
## START HERE
rec {
ac-haskell-process = melpaBuild rec { ac-haskell-process = melpaBuild rec {
pname = "ac-haskell-process"; pname = "ac-haskell-process";
version = "0.5"; version = "0.5";
@ -44,7 +54,10 @@ rec {
rev = "8351e2df4fbbeb2a4003f2fb39f46d33803f3dac"; rev = "8351e2df4fbbeb2a4003f2fb39f46d33803f3dac";
sha256 = "17axrgd99glnl6ma4ls3k01ysdqmiqr581wnrbsn3s4gp53mm2x6"; sha256 = "17axrgd99glnl6ma4ls3k01ysdqmiqr581wnrbsn3s4gp53mm2x6";
}; };
meta = { licence = gpl3Plus; }; meta = {
description = "Advanced cursor movements mode for Emacs";
licence = gpl3Plus;
};
}; };
ag = melpaBuild rec { ag = melpaBuild rec {
@ -60,6 +73,73 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
agda2-mode = with external; trivialBuild {
pname = "agda-mode";
version = Agda.version;
phases = [ "buildPhase" "installPhase" ];
# already byte-compiled by Agda builder
buildPhase = ''
agda=`${Agda}/bin/agda-mode locate`
cp `dirname $agda`/*.el* .
'';
meta = {
description = "Agda2-mode for Emacs extracted from Agda package";
longDescription = ''
Wrapper packages that liberates init.el from `agda-mode locate` magic.
Simply add this to user profile or systemPackages and do `(require 'agda2)` in init.el.
'';
homepage = Agda.meta.homepage;
license = Agda.meta.license;
};
};
anzu = melpaBuild rec {
pname = "anzu";
version = "0.52";
src = fetchFromGitHub {
owner = "syohex";
repo = "emacs-anzu";
rev = "f41db6225d8fb983324765aa42c94d3ee379a49f";
sha256 = "1mn20swasrl8kr557r1850vr1q0gcnwlxxafnc6lq5g01kjfcdxd";
};
meta = {
description = "Show number of matches in Emacs mode-line while searching";
longDescription = ''
anzu.el is an Emacs port of anzu.vim. anzu.el provides a minor
mode which displays current match and total matches information
in the mode-line in various search mode.
'';
homepage = https://github.com/syohex/emacs-anzu/;
license = gpl3Plus;
};
};
apel = melpaBuild rec {
pname = "apel";
version = "10.8";
src = fetchFromGitHub {
owner = "wanderlust";
repo = pname;
rev = "8402e59eadb580f59969114557b331b4d9364f95";
sha256 = "0sdxnf4b8rqs1cbjxh23wvxmj7ll3zddv8yfdgif6zmgyy8xhc9m";
};
files = [
"alist.el" "apel-ver.el" "broken.el" "calist.el"
"emu.el" "filename.el" "install.el" "inv-23.el" "invisible.el"
"mcharset.el" "mcs-20.el" "mcs-e20.el" "mule-caesar.el"
"path-util.el" "pccl-20.el" "pccl.el" "pces-20.el" "pces-e20.el"
"pces.el" "pcustom.el" "poe.el" "poem-e20.el" "poem-e20_3.el"
"poem.el" "product.el" "pym.el" "richtext.el" "static.el"
];
meta = {
description = "A Portable Emacs Library";
license = gpl3Plus; # probably
};
};
async = melpaBuild rec { async = melpaBuild rec {
pname = "async"; pname = "async";
version = "1.2"; version = "1.2";
@ -95,12 +175,11 @@ rec {
sha256 = "050lb8qjq7ra35mqp6j6qkwbvq5zj3yhz73aym5kf1vjd42rmjcw"; sha256 = "050lb8qjq7ra35mqp6j6qkwbvq5zj3yhz73aym5kf1vjd42rmjcw";
}; };
packageRequires = [ popup ]; packageRequires = [ popup ];
meta = { meta = {
description = "Auto-complete extension for Emacs"; description = "Auto-complete extension for Emacs";
homepage = http://cx4a.org/software/auto-complete/; homepage = http://cx4a.org/software/auto-complete/;
license = gpl3Plus; license = gpl3Plus;
platforms = stdenv.lib.platforms.all; platforms = lib.platforms.all;
}; };
}; };
@ -117,6 +196,22 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
browse-kill-ring = melpaBuild rec {
pname = "browse-kill-ring";
version = "20140104";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "f81ca5f14479fa9e938f89bf8f6baa3c4bdfb755";
sha256 = "149g4qs5dqy6yzdj5smb39id5f72bz64qfv5bjf3ssvhwl2rfba8";
};
meta = {
description = "Interactively insert items from Emacs kill-ring";
homepage = https://github.com/browse-kill-ring/browse-kill-ring/;
license = gpl2Plus;
};
};
change-inner = melpaBuild rec { change-inner = melpaBuild rec {
pname = "change-inner"; pname = "change-inner";
version = "20130208"; version = "20130208";
@ -215,7 +310,10 @@ rec {
sha256 = "0wrmlmgr4mwxlmmh8blplddri2lpk4g8k3l1vpb5c6a975420qvn"; sha256 = "0wrmlmgr4mwxlmmh8blplddri2lpk4g8k3l1vpb5c6a975420qvn";
}; };
packageRequires = [ evil ]; packageRequires = [ evil ];
meta = { licence = gpl3Plus; }; meta = {
description = "surround.vim emulation for Emacs evil mode";
licence = gpl3Plus;
};
}; };
evil = melpaBuild { evil = melpaBuild {
@ -227,7 +325,10 @@ rec {
sha256 = "0yiqpzsm5sr7xdkixdvfg312dk9vsdcmj69gizk744d334yn8rsz"; sha256 = "0yiqpzsm5sr7xdkixdvfg312dk9vsdcmj69gizk744d334yn8rsz";
}; };
packageRequires = [ goto-chg undo-tree ]; packageRequires = [ goto-chg undo-tree ];
meta = { licence = gpl3Plus; }; meta = {
description = "Extensible vi layer for Emacs";
licence = gpl3Plus;
};
}; };
exec-path-from-shell = melpaBuild rec { exec-path-from-shell = melpaBuild rec {
@ -251,7 +352,26 @@ rec {
rev = "fa413e07c97997d950c92d6012f5442b5c3cee78"; rev = "fa413e07c97997d950c92d6012f5442b5c3cee78";
sha256 = "04k0518wfy72wpzsswmncnhd372fxa0r8nbfhmbyfmns8n7sr045"; sha256 = "04k0518wfy72wpzsswmncnhd372fxa0r8nbfhmbyfmns8n7sr045";
}; };
meta = { licence = gpl3Plus; }; meta = {
description = "Increases the selected region by semantic units in Emacs";
licence = gpl3Plus;
};
};
flim = melpaBuild rec {
pname = "flim";
version = "1.14.9"; # 20141216
src = fetchFromGitHub {
owner = "wanderlust";
repo = pname;
rev = "488a4d70fb4ae57bdd30dc75c2d75579894e28a2";
sha256 = "178fhpbyffksr4v3m8jmx4rx2vqyz23qhbyvic5afabxi6lahjfs";
};
packageRequires = [ apel ];
meta = {
description = "Email message encoding library for Emacs";
license = gpl3Plus; # probably
};
}; };
flycheck-pos-tip = melpaBuild rec { flycheck-pos-tip = melpaBuild rec {
@ -442,6 +562,22 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
ido-ubiquitous = melpaBuild rec {
pname = "ido-ubiquitous";
version = "2.17";
src = fetchFromGitHub {
owner = "DarwinAwardWinner";
repo = pname;
rev = "323e4cddc05d5a4546c1b64132b2b1e9f8896452";
sha256 = "0wdjz3cqzrxhrk68g5gyvc9j2rb6f4yw00xbjgw9ldwlhmkwy5ja";
};
meta = {
description = "Does what you expected ido-everywhere to do in Emacs";
homepage = https://github.com/DarwinAwardWinner/ido-ubiquitous/;
license = gpl3Plus;
};
};
idris-mode = melpaBuild rec { idris-mode = melpaBuild rec {
pname = "idris-mode"; pname = "idris-mode";
version = "0.9.15"; version = "0.9.15";
@ -507,6 +643,8 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
nyan-mode = callPackage ../applications/editors/emacs-modes/nyan-mode {};
org-plus-contrib = melpaBuild rec { org-plus-contrib = melpaBuild rec {
pname = "org-plus-contrib"; pname = "org-plus-contrib";
version = "20141020"; version = "20141020";
@ -583,6 +721,22 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
semi = melpaBuild rec {
pname = "semi";
version = "1.14.7"; # 20150203
src = fetchFromGitHub {
owner = "wanderlust";
repo = pname;
rev = "9976269556c5bcc021e4edf1b0e1accd39929528";
sha256 = "1g1xg57pz4msd3f998af5gq28qhmvi410faygzspra6y6ygaka68";
};
packageRequires = [ apel flim ];
meta = {
description = "MIME library for Emacs";
license = gpl3Plus; # probably
};
};
shorten = melpaBuild rec { shorten = melpaBuild rec {
pname = "shorten"; pname = "shorten";
version = "1.5"; version = "1.5";
@ -622,6 +776,22 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
smex = melpaBuild rec {
pname = "smex";
version = "20141210";
src = fetchFromGitHub {
owner = "nonsequitur";
repo = pname;
rev = "aff8d4485139ac28f1c7e62912c0d0d480995831";
sha256 = "0017f1ji7rxad2n49dhn5g0pmw6lmw80cqk6dynszizj46xpbqfp";
};
meta = {
description = "M-x enhancement for Emacs build on top of Ido";
homepage = https://github.com/nonsequitur/smex/;
license = emacs.meta.license; # should be "same as Emacs"
};
};
structured-haskell-mode = melpaBuild rec { structured-haskell-mode = melpaBuild rec {
pname = "shm"; pname = "shm";
version = external.structured-haskell-mode.version; version = external.structured-haskell-mode.version;
@ -700,6 +870,27 @@ rec {
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
wanderlust = melpaBuild rec {
pname = "wanderlust";
version = "2.15.9"; # 20150301
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "13fb4f6519490d4ac7138f3bcf76707654348071";
sha256 = "1l48xfcwkm205prspa1rns6lqfizik5gpdwmlfgyb5mabm9x53zn";
};
packageRequires = [ apel flim semi ];
fileSpecs = [
"doc/wl.texi" "doc/wl-ja.texi"
"elmo/*.el" "wl/*.el"
"etc/icons"
];
meta = {
description = "E-Mail client for Emacs";
license = gpl3Plus; # probably
};
};
weechat = melpaBuild rec { weechat = melpaBuild rec {
pname = "weechat.el"; pname = "weechat.el";
version = "20141016"; version = "20141016";
@ -709,7 +900,7 @@ rec {
rev = "4cb2ced1eda5167ce774e04657d2cd077b63c706"; rev = "4cb2ced1eda5167ce774e04657d2cd077b63c706";
sha256 = "003sihp7irm0qqba778dx0gf8xhkxd1xk7ig5kgkryvl2jyirk28"; sha256 = "003sihp7irm0qqba778dx0gf8xhkxd1xk7ig5kgkryvl2jyirk28";
}; };
postPatch = stdenv.lib.optionalString (!stdenv.isLinux) '' postPatch = lib.optionalString (!stdenv.isLinux) ''
rm weechat-sauron.el weechat-secrets.el rm weechat-sauron.el weechat-secrets.el
''; '';
packageRequires = [ s ]; packageRequires = [ s ];
@ -727,4 +918,5 @@ rec {
}; };
meta = { licence = gpl3Plus; }; meta = { licence = gpl3Plus; };
}; };
}
}; in self