Rename emacs-modes to emacs/elisp-packages

This commit is contained in:
AndersonTorres
2021-05-21 00:32:06 -03:00
parent 788deaad9d
commit 70a5cbc298
37 changed files with 24 additions and 23 deletions
@@ -0,0 +1,51 @@
{ lib, fetchurl, stdenv, emacs, python }:
stdenv.mkDerivation rec {
name = "cedet-1.1";
src = fetchurl {
url = "mirror://sourceforge/cedet/${name}.tar.gz";
sha256 = "0p2bwlpwwa019axvgj09xkxbr53j0pq23d46s4la9jfhl47nbh22";
};
buildInputs = [ emacs python ];
doCheck = true;
checkPhase = "make utest";
installPhase = ''
mkdir -p "$out/share/emacs/site-lisp"
cp -v */*.el */*/*.el */*.elc */*/*.elc "$out/share/emacs/site-lisp"
chmod a-x "$out/share/emacs/site-lisp/"*
mkdir -p "$out/share/info"
cp -v */*.info* */*/*.info* "$out/share/info"
'';
meta = {
description = "CEDET, a Collection of Emacs Development Environment Tools";
longDescription = ''
CEDET is a collection of tools written with the end goal of
creating an advanced development environment in Emacs.
Emacs already is a great environment for writing software, but
there are additional areas that need improvement. Many new
ideas for integrated environments have been developed in newer
products, such as JBuilder, Eclipse, or KDevelop. CEDET is a
project which brings together several different tools needed to
implement advanced features.
CEDET includes EIEIO (Enhanced Implementation of Emacs
Interpreted Objects), Semantic, SRecode, Speedbar, EDE (Emacs
Development Environment), and COGRE (COnnected GRaph Editor).
'';
license = lib.licenses.gpl2Plus;
homepage = "http://cedet.sourceforge.net/";
# Fails with `semantic-idle.el:42:1:Error: Invalid function: class-p`
broken = true;
};
}
@@ -0,0 +1,30 @@
{ stdenv, cedille, emacs }:
stdenv.mkDerivation {
pname = "cedille-mode";
version = cedille.version;
src = cedille.src;
buildInputs = [ emacs ];
buildPhase = ":";
installPhase = ''
install -d $out/share/emacs/site-lisp
install se-mode/*.el se-mode/*.elc $out/share/emacs/site-lisp
install cedille-mode/*.el cedille-mode/*.elc $out/share/emacs/site-lisp
install *.el *.elc $out/share/emacs/site-lisp
substituteInPlace $out/share/emacs/site-lisp/cedille-mode.el \
--replace /usr/bin/cedille ${cedille}/bin/cedille \
'';
meta = {
description = "Emacs major mode for Cedille";
homepage = cedille.meta.homepage;
license = cedille.meta.license ;
platforms = cedille.meta.platforms;
maintainers = cedille.meta.maintainers;
};
}
@@ -0,0 +1,33 @@
{lib, stdenv, fetchzip, emacs, color-theme}:
let
commit = "f3ca8902ea056fb8e46cb09f09c96294e31cd4ee";
in
stdenv.mkDerivation {
name = "color-theme-solarized-1.0.0";
src = fetchzip {
url = "https://github.com/sellout/emacs-color-theme-solarized/archive/${commit}.zip";
sha256 = "16d7adqi07lzzr0qipl1fbag9l8kiyr3xrqxi528pimcisbg85d3";
};
buildInputs = [ emacs ];
propagatedUserEnvPkgs = [ color-theme ];
buildPhase = ''
emacs -L . -L ${color-theme}/share/emacs/site-lisp/elpa/color-theme-* --batch -f batch-byte-compile *.el
'';
installPhase = ''
mkdir -p $out/share/emacs/site-lisp
install *.el* $out/share/emacs/site-lisp
'';
meta = with lib; {
description = "Precision colors for machines and people";
homepage = "http://ethanschoonover.com/solarized";
maintainers = [ maintainers.samuelrivas ];
license = licenses.mit;
platforms = platforms.all;
};
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,66 @@
/*
# Updating
To update the list of packages from MELPA,
1. Run `./update-elpa`.
2. Check for evaluation errors:
`nix-instantiate ../../../../../ -A emacs.pkgs.elpaPackages`.
3. Run `git commit -m "elpa-packages $(date -Idate)" -- elpa-generated.nix`
## Update from overlay
Alternatively, run the following command:
./update-from-overlay
It will update both melpa and elpa packages using
https://github.com/nix-community/emacs-overlay. It's almost instantenous and
formats commits for you.
*/
{ lib, stdenv, texinfo, writeText }:
self: let
markBroken = pkg: pkg.override {
elpaBuild = args: self.elpaBuild (args // {
meta = (args.meta or {}) // { broken = true; };
});
};
elpaBuild = import ../../../../build-support/emacs/elpa.nix {
inherit lib stdenv texinfo writeText;
inherit (self) emacs;
};
generateElpa = lib.makeOverridable ({
generated ? ./elpa-generated.nix
}: let
imported = import generated {
inherit (self) callPackage;
};
super = removeAttrs imported [ "dash" ];
overrides = {
rcirc-menu = markBroken super.rcirc-menu; # Missing file header
cl-lib = null; # builtin
tle = null; # builtin
advice = null; # builtin
seq = if lib.versionAtLeast self.emacs.version "27"
then null
else super.seq;
project = if lib.versionAtLeast self.emacs.version "28"
then null
else super.project;
};
elpaPackages = super // overrides;
in elpaPackages // { inherit elpaBuild; });
in generateElpa { }
@@ -0,0 +1,23 @@
let
pkgs = import ../../../../.. { };
src = pkgs.fetchgit {
url = "https://github.com/ttuegel/emacs2nix.git";
fetchSubmodules = true;
rev = "860da04ca91cbb69c9b881a54248d16bdaaf9923";
sha256 = "1r3xmyk9rfgx7ln69dk8mgbnh3awcalm3r1c5ia2shlsrymvv1df";
};
in
pkgs.mkShell {
packages = [
pkgs.bash
];
EMACS2NIX = src;
shellHook = ''
export PATH=$PATH:${src}
'';
}
@@ -0,0 +1,42 @@
{ stdenv, fetchurl, makeWrapper, emacs, tcl, tclx, espeak-ng, lib }:
stdenv.mkDerivation rec {
pname = "emacspeak";
version = "51.0";
src = fetchurl {
url = "https://github.com/tvraman/emacspeak/releases/download/${version}/${pname}-${version}.tar.bz2";
sha256 = "09a0ywxlqa8jmc0wmvhaf7bdydnkyhy9nqfsdqcpbsgdzj6qpg90";
};
nativeBuildInputs = [ makeWrapper emacs ];
buildInputs = [ tcl tclx espeak-ng ];
preConfigure = ''
make config
'';
postBuild = ''
make -C servers/native-espeak PREFIX=$out "TCL_INCLUDE=${tcl}/include"
'';
postInstall = ''
make -C servers/native-espeak PREFIX=$out install
local d=$out/share/emacs/site-lisp/emacspeak/
install -d -- "$d"
cp -a . "$d"
find "$d" \( -type d -or \( -type f -executable \) \) -execdir chmod 755 {} +
find "$d" -type f -not -executable -execdir chmod 644 {} +
makeWrapper ${emacs}/bin/emacs $out/bin/emacspeak \
--set DTK_PROGRAM "${espeak-ng}/bin/espeak" \
--add-flags '-l "${placeholder "out"}/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.elc"'
'';
meta = {
homepage = "https://github.com/tvraman/emacspeak/";
description = "Emacs extension that provides spoken output";
license = lib.licenses.gpl2;
maintainers = [ ];
platforms = lib.platforms.linux;
};
}
@@ -0,0 +1,22 @@
{ lib, stdenv, fetchgit }:
stdenv.mkDerivation {
name = "ess-R-object-popup-20130302";
src = fetchgit {
url = "https://github.com/myuhe/ess-R-object-popup.el.git";
rev = "7e1f601bfba72de0fda44d9c82f96028ecbb9948";
sha256 = "0q8pbaa6wahli6fh0kng5zmnypsxi1fr2bzs2mfk3h8vf4nikpv0";
};
installPhase = ''
mkdir -p $out/share/emacs/site-lisp
cp *.el *.elc $out/share/emacs/site-lisp/
'';
meta = {
description = "Popup descriptions of R objects";
homepage = "https://github.com/myuhe/ess-R-object-popup.el";
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,19 @@
{ fetchurl, lib, melpaBuild, writeText }:
melpaBuild {
pname = "font-lock+";
version = "20180101.25";
src = fetchurl {
url = "https://www.emacswiki.org/emacs/download/font-lock%2b.el?revision=25";
sha256 = "0197yzn4hbjmw5h3m08264b7zymw63pdafph5f3yzfm50q8p7kp4";
name = "font-lock+.el";
};
recipe = writeText "recipe" "(font-lock+ :fetcher github :repo \"\")";
meta = {
homepage = "https://melpa.org/#/font-lock+";
license = lib.licenses.gpl2Plus;
};
}
@@ -0,0 +1,23 @@
{ lib, stdenv, fetchgit }:
stdenv.mkDerivation {
name = "helm-words-20190917";
src = fetchgit {
url = "https://github.com/pronobis/helm-words.git";
rev = "e6387ece1940a06695b9d910de3d90252efb8d29";
sha256 = "1ly0mbzlgc26fqvf7rxpmy698g0cf9qldrwrx022ar6r68l1h7xf";
};
installPhase = ''
mkdir -p $out/share/emacs/site-lisp
cp *.el *.elc $out/share/emacs/site-lisp/
'';
meta = {
description = "Emacs major mode for jade and stylus";
homepage = "https://github.com/brianc/helm-words";
license = lib.licenses.gpl3;
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, emacs }:
# this package installs the emacs-mode which
# resides in the hsc3 sources.
let version = "0.15";
in stdenv.mkDerivation {
pname = "hsc3-mode";
inherit version;
src = fetchurl {
url = "mirror://hackage/hsc3-0.15/hsc3-0.15.tar.gz";
sha256 = "2f3b15655419cf8ebe25ab1c6ec22993b2589b4ffca7c3a75ce478ca78a0bde6";
};
buildInputs = [ emacs ];
installPhase = ''
mkdir -p "$out/share/emacs/site-lisp"
cp "emacs/hsc3.el" "$out/share/emacs/site-lisp"
'';
meta = {
homepage = "http://rd.slavepianos.org/?t=hsc3";
description = "hsc3 mode package for Emacs";
platforms = lib.platforms.unix;
};
}
@@ -0,0 +1,27 @@
{ stdenv, fetchFromGitHub, emacs }:
let
version = "3.6-4-gb659bf8";
in
stdenv.mkDerivation {
pname = "ido-ubiquitous";
inherit version;
src = fetchFromGitHub {
owner = "DarwinAwardWinner";
repo = "ido-ubiquitous";
rev = version;
sha256 = "06r8qpfr60gc673w881m0nplj91b6bfw77bxgl6irz1z9bp7cc4y";
};
buildInputs = [ emacs ];
buildPhase = ''
emacs -L . --batch -f batch-byte-compile *.el
'';
installPhase = ''
install -d $out/share/emacs/site-lisp
install *.el *.elc $out/share/emacs/site-lisp
'';
}
@@ -0,0 +1,22 @@
{ trivialBuild, lib, fetchurl }:
trivialBuild rec {
pname = "jam-mode";
version = "0.3";
src = fetchurl {
url = "https://dev.gentoo.org/~ulm/distfiles/jam-mode-${version}.el.xz";
sha256 = "1jchgiy2rgvnb3swr6ar72yas6pj4inpgpcq78q01q6snflmi2fh";
};
unpackPhase = ''
xz -cd $src > jam-mode.el
'';
meta = with lib; {
description = "An Emacs major mode for editing Jam files";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
platforms = platforms.all;
};
}
@@ -0,0 +1,95 @@
lib: self:
let
fetcherGenerators = { repo ? null
, url ? null
, ... }:
{ sha256
, commit
, ...}: {
github = self.callPackage ({ fetchFromGitHub }:
fetchFromGitHub {
owner = lib.head (lib.splitString "/" repo);
repo = lib.head (lib.tail (lib.splitString "/" repo));
rev = commit;
inherit sha256;
}
) {};
gitlab = self.callPackage ({ fetchFromGitLab }:
fetchFromGitLab {
owner = lib.head (lib.splitString "/" repo);
repo = lib.head (lib.tail (lib.splitString "/" repo));
rev = commit;
inherit sha256;
}
) {};
git = self.callPackage ({ fetchgit }:
(fetchgit {
rev = commit;
inherit sha256 url;
}).overrideAttrs(_: {
GIT_SSL_NO_VERIFY = true;
})
) {};
bitbucket = self.callPackage ({ fetchhg }:
fetchhg {
rev = commit;
url = "https://bitbucket.com/${repo}";
inherit sha256;
}
) {};
hg = self.callPackage ({ fetchhg }:
fetchhg {
rev = commit;
inherit sha256 url;
}
) {};
};
in {
melpaDerivation = variant:
{ ename, fetcher
, commit ? null
, sha256 ? null
, ... }@args:
let
sourceArgs = args.${variant};
version = sourceArgs.version or null;
deps = sourceArgs.deps or null;
error = sourceArgs.error or args.error or null;
hasSource = lib.hasAttr variant args;
pname = builtins.replaceStrings [ "@" ] [ "at" ] ename;
broken = ! isNull error;
in
if hasSource then
lib.nameValuePair ename (
self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs:
melpaBuild {
inherit pname;
ename = ename;
version = if isNull version then "" else
lib.concatStringsSep "." (map toString version);
# TODO: Broken should not result in src being null (hack to avoid eval errors)
src = if (isNull sha256 || broken) then null else
lib.getAttr fetcher (fetcherGenerators args sourceArgs);
recipe = if isNull commit then null else
fetchurl {
name = pname + "-recipe";
url = "https://raw.githubusercontent.com/melpa/melpa/${commit}/recipes/${ename}";
inherit sha256;
};
packageRequires = lib.optionals (! isNull deps)
(map (dep: pkgargs.${dep} or self.${dep} or null)
deps);
meta = (sourceArgs.meta or {}) // {
inherit broken;
};
}
) {}
)
else
null;
}
@@ -0,0 +1,256 @@
{ lib, pkgs }: self: with self; with lib.licenses; {
elisp-ffi = melpaBuild rec {
pname = "elisp-ffi";
version = "1.0.0";
src = pkgs.fetchFromGitHub {
owner = "skeeto";
repo = "elisp-ffi";
rev = version;
sha256 = "0z2n3h5l5fj8wl8i1ilfzv11l3zba14sgph6gz7dx7q12cnp9j22";
};
buildInputs = [ pkgs.libffi ];
preBuild = "make";
recipe = pkgs.writeText "recipe" ''
(elisp-ffi
:repo "skeeto/elisp-ffi"
:fetcher github
:files ("ffi-glue" "ffi.el"))
'';
meta = {
description = "Emacs Lisp Foreign Function Interface";
longDescription = ''
This library provides an FFI for Emacs Lisp so that Emacs
programs can invoke functions in native libraries. It works by
driving a subprocess to do the heavy lifting, passing result
values on to Emacs.
'';
license = publicDomain;
};
};
agda2-mode = trivialBuild {
pname = "agda-mode";
version = pkgs.haskellPackages.Agda.version;
phases = [ "buildPhase" "installPhase" ];
# already byte-compiled by Agda builder
buildPhase = ''
agda=`${pkgs.haskellPackages.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 = pkgs.haskellPackages.Agda.meta.homepage;
license = pkgs.haskellPackages.Agda.meta.license;
};
};
agda-input = self.trivialBuild {
pname = "agda-input";
inherit (pkgs.haskellPackages.Agda) src version;
postUnpack = "mv $sourceRoot/src/data/emacs-mode/agda-input.el $sourceRoot";
meta = {
description = "Standalone package providing the agda-input method without building Agda.";
inherit (pkgs.haskellPackages.Agda.meta) homepage license;
};
};
emacspeak = callPackage ./emacspeak {};
ess-R-object-popup =
callPackage ./ess-R-object-popup { };
font-lock-plus = callPackage ./font-lock-plus { };
ghc-mod = melpaBuild {
pname = "ghc";
version = pkgs.haskellPackages.ghc-mod.version;
src = pkgs.haskellPackages.ghc-mod.src;
packageRequires = [ haskell-mode ];
propagatedUserEnvPkgs = [ pkgs.haskellPackages.ghc-mod ];
recipe = pkgs.writeText "recipe" ''
(ghc-mod :repo "DanielG/ghc-mod" :fetcher github :files ("elisp/*.el"))
'';
fileSpecs = [ "elisp/*.el" ];
meta = {
description = "An extension of haskell-mode that provides completion of symbols and documentation browsing";
license = bsd3;
};
};
haskell-unicode-input-method = melpaBuild {
pname = "emacs-haskell-unicode-input-method";
version = "20110905.2307";
src = pkgs.fetchFromGitHub {
owner = "roelvandijk";
repo = "emacs-haskell-unicode-input-method";
rev = "d8d168148c187ed19350bb7a1a190217c2915a63";
sha256 = "09b7bg2s9aa4s8f2kdqs4xps3jxkq5wsvbi87ih8b6id38blhf78";
};
recipe = pkgs.writeText "recipe" ''
(emacs-haskell-unicode-input-method
:repo "roelvandijk/emacs-haskell-unicode-input-method"
:fetcher github)
'';
packageRequires = [];
meta = {
homepage = "https://melpa.org/#haskell-unicode-input-method/";
license = lib.licenses.free;
};
};
helm-words = callPackage ./helm-words { };
jam-mode = callPackage ./jam-mode { };
llvm-mode = trivialBuild {
pname = "llvm-mode";
inherit (pkgs.llvmPackages.llvm) src version;
dontConfigure = true;
buildPhase = ''
cp utils/emacs/*.el .
'';
meta = {
inherit (pkgs.llvmPackages.llvm.meta) homepage license;
description = "Major mode for the LLVM assembler language.";
};
};
matrix-client = melpaBuild {
pname = "matrix-client";
version = "0.3.0";
src = pkgs.fetchFromGitHub {
owner = "alphapapa";
repo = "matrix-client.el";
rev = "d2ac55293c96d4c95971ed8e2a3f6f354565c5ed";
sha256 = "1scfv1502yg7x4bsl253cpr6plml1j4d437vci2ggs764sh3rcqq";
};
patches = [
(pkgs.fetchpatch {
url = "https://github.com/alphapapa/matrix-client.el/commit/5f49e615c7cf2872f48882d3ee5c4a2bff117d07.patch";
sha256 = "07bvid7s1nv1377p5n61q46yww3m1w6bw4vnd4iyayw3fby1lxbm";
})
];
packageRequires = [
anaphora
cl-lib
self.map
dash-functional
esxml
f
ov
tracking
rainbow-identifiers
dash
s
request
frame-purpose
a
ht
];
recipe = pkgs.writeText "recipe" ''
(matrix-client
:repo "alphapapa/matrix-client.el"
:fetcher github)
'';
meta = {
description = "A chat client and API wrapper for Matrix.org";
license = gpl3Plus;
};
};
org-mac-link =
callPackage ./org-mac-link { };
ott-mode = self.trivialBuild {
pname = "ott-mod";
inherit (pkgs.ott) src version;
postUnpack = "mv $sourceRoot/emacs/ott-mode.el $sourceRoot";
meta = {
description = "Standalone package providing ott-mode without building ott and with compiled bytecode.";
inherit (pkgs.haskellPackages.Agda.meta) homepage license;
};
};
perl-completion =
callPackage ./perl-completion { };
pod-mode = callPackage ./pod-mode { };
railgun = callPackage ./railgun { };
structured-haskell-mode = self.shm;
sv-kalender = callPackage ./sv-kalender { };
tramp = callPackage ./tramp { };
zeitgeist = callPackage ./zeitgeist { };
# From old emacsPackages (pre emacsPackagesNg)
cedet = callPackage ./cedet { };
cedille = callPackage ./cedille { cedille = pkgs.cedille; };
colorThemeSolarized = callPackage ./color-theme-solarized { };
emacsSessionManagement = callPackage ./session-management-for-emacs { };
hsc3-mode = callPackage ./hsc3 { };
ido-ubiquitous = callPackage ./ido-ubiquitous { };
prolog-mode = callPackage ./prolog { };
rectMark = callPackage ./rect-mark { };
sunriseCommander = callPackage ./sunrise-commander { };
# Legacy aliases, these try to mostly map to melpa stable because it's
# closer to the old outdated package infra.
#
# Ideally this should be dropped some time during/after 20.03
bbdb3 = self.melpaStablePackages.bbdb;
jade = self.jade-mode;
# scalaMode2 = null; # No clear mapping as of now
flymakeCursor = self.melpaStablePackages.flymake-cursor;
cryptol = self.melpaStablePackages.cryptol-mode;
maudeMode = self.maude-mode;
phpMode = self.melpaStablePackages.php-mode;
idris = self.melpaStablePackages.idris-mode;
rainbowDelimiters = self.melpaStablePackages.rainbow-delimiters;
colorTheme = self.color-theme;
sbtMode = self.melpaStablePackages.sbt-mode;
markdownMode = self.melpaStablePackages.markdown-mode;
scalaMode1 = self.melpaStablePackages.scala-mode;
prologMode = self.prolog-mode;
hsc3Mode = self.hsc3-mode;
graphvizDot = self.melpaStablePackages.graphviz-dot-mode;
proofgeneral_HEAD = self.proof-general;
proofgeneral = self.melpaStablePackages.proof-general;
haskellMode = self.melpaStablePackages.haskell-mode;
writeGood = self.melpaStablePackages.writegood-mode;
erlangMode = self.melpaStablePackages.erlang;
d = self.melpaStablePackages.d-mode;
autoComplete = self.melpaStablePackages.auto-complete;
tuaregMode = self.melpaStablePackages.tuareg;
structuredHaskellMode = self.melpaStablePackages.shm;
xmlRpc = self.melpaStablePackages.xml-rpc;
emacsw3m = self.w3m;
loremIpsum = self.lorem-ipsum;
js2 = self.melpaStablePackages.js2-mode;
}
@@ -0,0 +1,533 @@
/*
# Updating
To update the list of packages from MELPA,
1. Run `./update-melpa`
2. Check for evaluation errors:
env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../../ -A emacs.pkgs.melpaStablePackages
env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate --show-trace ../../../../../ -A emacs.pkgs.melpaPackages
3. Run `git commit -m "melpa-packages: $(date -Idate)" recipes-archive-melpa.json`
## Update from overlay
Alternatively, run the following command:
./update-from-overlay
It will update both melpa and elpa packages using
https://github.com/nix-community/emacs-overlay. It's almost instantenous and
formats commits for you.
*/
{ lib, pkgs }: variant: self:
let
dontConfigure = pkg:
if pkg != null then pkg.override (args: {
melpaBuild = drv: args.melpaBuild (drv // {
dontConfigure = true;
});
}) else null;
markBroken = pkg:
if pkg != null then pkg.override (args: {
melpaBuild = drv: args.melpaBuild (drv // {
meta = (drv.meta or { }) // { broken = true; };
});
}) else null;
externalSrc = pkg: epkg:
if pkg != null then pkg.override (args: {
melpaBuild = drv: args.melpaBuild (drv // {
inherit (epkg) src version;
propagatedUserEnvPkgs = [ epkg ];
});
}) else null;
buildWithGit = pkg: pkg.overrideAttrs (attrs: {
nativeBuildInputs =
(attrs.nativeBuildInputs or [ ]) ++ [ pkgs.git ];
});
fix-rtags = pkg:
if pkg != null then dontConfigure (externalSrc pkg pkgs.rtags)
else null;
generateMelpa = lib.makeOverridable ({ archiveJson ? ./recipes-archive-melpa.json
}:
let
inherit (import ./libgenerated.nix lib self) melpaDerivation;
super = (
lib.listToAttrs (builtins.filter
(s: s != null)
(map
(melpaDerivation variant)
(lib.importJSON archiveJson)
)
)
);
overrides = {
# Expects bash to be at /bin/bash
ac-rtags = fix-rtags super.ac-rtags;
airline-themes = super.airline-themes.override {
inherit (self.melpaPackages) powerline;
};
auto-complete-clang-async = super.auto-complete-clang-async.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.llvmPackages.llvm ];
CFLAGS = "-I${pkgs.llvmPackages.clang}/include";
LDFLAGS = "-L${pkgs.llvmPackages.clang}/lib";
});
# part of a larger package
caml = dontConfigure super.caml;
# part of a larger package
# upstream issue: missing package version
cmake-mode = dontConfigure super.cmake-mode;
company-rtags = fix-rtags super.company-rtags;
easy-kill-extras = super.easy-kill-extras.override {
inherit (self.melpaPackages) easy-kill;
};
dune = dontConfigure super.dune;
emacsql-sqlite = super.emacsql-sqlite.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.sqlite ];
postBuild = ''
cd source/sqlite
make
cd -
'';
postInstall = ''
install -m=755 -D source/sqlite/emacsql-sqlite \
$out/share/emacs/site-lisp/elpa/emacsql-sqlite-${old.version}/sqlite/emacsql-sqlite
'';
stripDebugList = [ "share" ];
});
# https://github.com/syl20bnr/evil-escape/pull/86
evil-escape = super.evil-escape.overrideAttrs (attrs: {
postPatch = ''
substituteInPlace evil-escape.el \
--replace ' ;;; evil' ';;; evil'
'';
packageRequires = with self; [ evil ];
});
ess-R-data-view = super.ess-R-data-view.override {
inherit (self.melpaPackages) ess ctable popup;
};
flycheck-rtags = fix-rtags super.flycheck-rtags;
pdf-tools = super.pdf-tools.overrideAttrs (old: {
nativeBuildInputs = [
pkgs.autoconf
pkgs.automake
pkgs.pkg-config
pkgs.removeReferencesTo
];
buildInputs = old.buildInputs ++ [ pkgs.libpng pkgs.zlib pkgs.poppler ];
preBuild = ''
make server/epdfinfo
remove-references-to ${lib.concatStringsSep " " (
map (output: "-t " + output) (
[
pkgs.glib.dev
pkgs.libpng.dev
pkgs.poppler.dev
pkgs.zlib.dev
pkgs.cairo.dev
]
++ lib.optional pkgs.stdenv.isLinux pkgs.stdenv.cc.libc.dev
)
)} server/epdfinfo
'';
recipe = pkgs.writeText "recipe" ''
(pdf-tools
:repo "politza/pdf-tools" :fetcher github
:files ("lisp/pdf-*.el" "server/epdfinfo"))
'';
});
# Build same version as Haskell package
hindent = (externalSrc super.hindent pkgs.haskellPackages.hindent).overrideAttrs (attrs: {
packageRequires = [ self.haskell-mode ];
});
irony = super.irony.overrideAttrs (old: {
cmakeFlags = old.cmakeFlags or [ ] ++ [ "-DCMAKE_INSTALL_BINDIR=bin" ];
NIX_CFLAGS_COMPILE = "-UCLANG_RESOURCE_DIR";
preConfigure = ''
cd server
'';
preBuild = ''
make
install -D bin/irony-server $out/bin/irony-server
cd ..
'';
checkPhase = ''
cd source/server
make check
cd ../..
'';
preFixup = ''
rm -rf $out/share/emacs/site-lisp/elpa/*/server
'';
dontUseCmakeBuildDir = true;
doCheck = true;
packageRequires = [ self.emacs ];
nativeBuildInputs = [ pkgs.cmake pkgs.llvmPackages.llvm pkgs.llvmPackages.clang ];
});
# tries to write a log file to $HOME
insert-shebang = super.insert-shebang.overrideAttrs (attrs: {
HOME = "/tmp";
});
ivy-rtags = fix-rtags super.ivy-rtags;
libgit = super.libgit.overrideAttrs(attrs: {
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [ pkgs.cmake ];
buildInputs = attrs.buildInputs ++ [ pkgs.libgit2 ];
dontUseCmakeBuildDir = true;
postPatch = ''
sed -i s/'add_subdirectory(libgit2)'// CMakeLists.txt
'';
postBuild = ''
pushd working/libgit
make
popd
'';
postInstall = ''
outd=$(echo $out/share/emacs/site-lisp/elpa/libgit-**)
mkdir $outd/build
install -m444 -t $outd/build ./source/src/libegit2.so
rm -r $outd/src $outd/Makefile $outd/CMakeLists.txt
'';
});
evil-magit = buildWithGit super.evil-magit;
eopengrok = buildWithGit super.eopengrok;
forge = buildWithGit super.forge;
magit = buildWithGit super.magit;
magit-find-file = buildWithGit super.magit-find-file;
magit-gh-pulls = buildWithGit super.magit-gh-pulls;
magit-imerge = buildWithGit super.magit-imerge;
magit-lfs = buildWithGit super.magit-lfs;
magit-org-todos = buildWithGit super.magit-org-todos;
magit-tbdiff = buildWithGit super.magit-tbdiff;
magit-topgit = buildWithGit super.magit-topgit;
magit-vcsh = buildWithGit super.magit-vcsh;
magit-gerrit = buildWithGit super.magit-gerrit;
magit-annex = buildWithGit super.magit-annex;
magit-todos = buildWithGit super.magit-todos;
magit-filenotify = buildWithGit super.magit-filenotify;
magit-gitflow = buildWithGit super.magit-gitflow;
magithub = buildWithGit super.magithub;
magit-svn = buildWithGit super.magit-svn;
kubernetes = buildWithGit super.kubernetes;
kubernetes-evil = buildWithGit super.kubernetes-evil;
egg = buildWithGit super.egg;
kapacitor = buildWithGit super.kapacitor;
gerrit = buildWithGit super.gerrit;
gerrit-download = buildWithGit super.gerrit-download;
github-pullrequest = buildWithGit super.github-pullrequest;
jist = buildWithGit super.jist;
mandoku = buildWithGit super.mandoku;
mandoku-tls = buildWithGit super.mandoku-tls;
magit-p4 = buildWithGit super.magit-p4;
magit-rbr = buildWithGit super.magit-rbr;
magit-diff-flycheck = buildWithGit super.magit-diff-flycheck;
magit-reviewboard = buildWithGit super.magit-reviewboard;
magit-patch-changelog = buildWithGit super.magit-patch-changelog;
magit-circleci = buildWithGit super.magit-circleci;
magit-delta = buildWithGit super.magit-delta;
orgit = buildWithGit super.orgit;
orgit-forge = buildWithGit super.orgit-forge;
# upstream issue: missing file header
mhc = super.mhc.override {
inherit (self.melpaPackages) calfw;
};
# missing .NET
nemerle = markBroken super.nemerle;
# part of a larger package
notmuch = dontConfigure super.notmuch;
rtags = dontConfigure (externalSrc super.rtags pkgs.rtags);
rtags-xref = dontConfigure super.rtags;
shm = super.shm.overrideAttrs (attrs: {
propagatedUserEnvPkgs = [ pkgs.haskellPackages.structured-haskell-mode ];
});
# Telega has a server portion for it's network protocol
telega = super.telega.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ pkgs.tdlib ];
nativeBuildInputs = [ pkgs.pkg-config ];
patches = [
(pkgs.fetchpatch {
name = "telega-server-bin-store-prefer.patch";
url = "https://github.com/zevlg/telega.el/commit/72550f984ca869309d197203ef7de99182d71729.patch";
sha256 = "18xvz53bygksak6h5f8cz79y83p2va15i8qz7n4s3g9gsklmkj2p";
})
];
postPatch = ''
substituteInPlace telega-customize.el \
--replace 'defcustom telega-server-command "telega-server"' \
"defcustom telega-server-command \"$out/bin/telega-server\""
substituteInPlace telega-sticker.el --replace '"dwebp"' '"${pkgs.libwebp}/bin/dwebp"'
substituteInPlace telega-vvnote.el --replace '"ffmpeg' '"${pkgs.ffmpeg}/bin/ffmpeg'
'';
postBuild = ''
cd source/server
make
cd -
'';
postInstall = ''
mkdir -p $out/bin
install -m755 -Dt $out/bin ./source/server/telega-server
'';
});
treemacs-magit = super.treemacs-magit.overrideAttrs (attrs: {
# searches for Git at build time
nativeBuildInputs =
(attrs.nativeBuildInputs or [ ]) ++ [ pkgs.git ];
});
vdiff-magit = super.vdiff-magit.overrideAttrs (attrs: {
nativeBuildInputs =
(attrs.nativeBuildInputs or [ ]) ++ [ pkgs.git ];
});
zmq = super.zmq.overrideAttrs (old: {
stripDebugList = [ "share" ];
preBuild = ''
export EZMQ_LIBDIR=$(mktemp -d)
make
'';
nativeBuildInputs = [
pkgs.autoconf
pkgs.automake
pkgs.pkg-config
pkgs.libtool
(pkgs.zeromq.override { enableDrafts = true; })
];
postInstall = ''
mv $EZMQ_LIBDIR/emacs-zmq.* $out/share/emacs/site-lisp/elpa/zmq-*
rm -r $out/share/emacs/site-lisp/elpa/zmq-*/src
rm $out/share/emacs/site-lisp/elpa/zmq-*/Makefile
'';
});
# Map legacy renames from emacs2nix since code generation was ported to emacs lisp
_0blayout = super."0blayout";
desktop-plus = super."desktop+";
ghub-plus = super."ghub+";
git-gutter-plus = super."git-gutter+";
git-gutter-fringe-plus = super."git-gutter-fringe+";
ido-completing-read-plus = super."ido-completing-read+";
image-plus = super."image+";
image-dired-plus = super."image-dired+";
markdown-mode-plus = super."markdown-mode+";
package-plus = super."package+";
rect-plus = super."rect+";
# upstream issue: missing file header
bufshow = markBroken super.bufshow;
# upstream issue: missing file header
connection = markBroken super.connection;
# upstream issue: missing file header
dictionary = markBroken super.dictionary;
# upstream issue: missing file header
elmine = markBroken super.elmine;
# upstream issue: missing file header
ido-complete-space-or-hyphen = markBroken super.ido-complete-space-or-hyphen;
# upstream issue: missing file header
initsplit = markBroken super.initsplit;
# upstream issue: missing file header
instapaper = markBroken super.instapaper;
# upstream issue: missing file header
jsfmt = markBroken super.jsfmt;
# upstream issue: missing file header
maxframe = markBroken super.maxframe;
# upstream issue: doesn't build
magit-stgit = markBroken super.magit-stgit;
# upstream issue: missing file header
melancholy-theme = markBroken super.melancholy-theme;
# upstream issue: doesn't build
eterm-256color = markBroken super.eterm-256color;
# upstream issue: doesn't build
per-buffer-theme = markBroken super.per-buffer-theme;
# upstream issue: missing file header
qiita = markBroken super.qiita;
# upstream issue: missing file header
speech-tagger = markBroken super.speech-tagger;
# upstream issue: missing file header
sql-presto = markBroken super.sql-presto;
# upstream issue: missing file header
textmate = markBroken super.textmate;
# upstream issue: missing file header
link = markBroken super.link;
# upstream issue: missing file header
voca-builder = markBroken super.voca-builder;
# upstream issue: missing file header
window-numbering = markBroken super.window-numbering;
editorconfig = super.editorconfig.overrideAttrs (attrs: {
propagatedUserEnvPkgs = [ pkgs.editorconfig-core-c ];
});
# missing dependencies
evil-search-highlight-persist = super.evil-search-highlight-persist.overrideAttrs (attrs: {
packageRequires = with self; [ evil highlight ];
});
helm-rtags = fix-rtags super.helm-rtags;
# tries to write to $HOME
php-auto-yasnippets = super.php-auto-yasnippets.overrideAttrs (attrs: {
HOME = "/tmp";
});
racer = super.racer.overrideAttrs (attrs: {
postPatch = attrs.postPatch or "" + ''
substituteInPlace racer.el \
--replace /usr/local/src/rust/src ${pkgs.rustPlatform.rustcSrc}
'';
});
spaceline = super.spaceline.override {
inherit (self.melpaPackages) powerline;
};
vterm = super.vterm.overrideAttrs (old: {
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = old.buildInputs ++ [ self.emacs pkgs.libvterm-neovim ];
cmakeFlags = [
"-DEMACS_SOURCE=${self.emacs.src}"
"-DUSE_SYSTEM_LIBVTERM=ON"
];
# we need the proper out directory to exist, so we do this in the
# postInstall instead of postBuild
postInstall = ''
pushd source/build >/dev/null
make
install -m444 -t $out/share/emacs/site-lisp/elpa/vterm-** ../*.so
popd > /dev/null
rm -rf $out/share/emacs/site-lisp/elpa/vterm-**/{CMake*,build,*.c,*.h}
'';
});
w3m = super.w3m.override (args: {
melpaBuild = drv: args.melpaBuild (drv // {
prePatch =
let w3m = "${lib.getBin pkgs.w3m}/bin/w3m"; in
''
substituteInPlace w3m.el \
--replace 'defcustom w3m-command nil' \
'defcustom w3m-command "${w3m}"'
'';
});
});
};
# Deprecated legacy aliases for backwards compat
aliases = lib.listToAttrs (lib.attrValues (lib.mapAttrs (n: v: { name = v; value = builtins.trace "Melpa attribute '${v}' is a legacy alias that will be removed in 21.05, use '${n}' instead" melpaPackages.${n}; }) (lib.filterAttrs (n: v: lib.hasAttr n melpaPackages) {
"auto-complete-clang-async" = "emacsClangCompleteAsync";
"vterm" = "emacs-libvterm";
"0xc" = "_0xc";
"2048-game" = "_2048-game";
"4clojure" = "_4clojure";
"@" = "at";
"term+" = "term-plus";
"term+key-intercept" = "term-plus-key-intercept";
"term+mux" = "term-plus-mux";
"xml+" = "xml-plus";
})));
melpaPackages = lib.mapAttrs (n: v: if lib.hasAttr n overrides then overrides.${n} else v) super;
in
melpaPackages // aliases);
in
generateMelpa { }
@@ -0,0 +1,33 @@
{ callPackage }:
{
org = callPackage ({ elpaBuild, fetchurl, lib }:
elpaBuild {
pname = "org";
ename = "org";
version = "20210510";
src = fetchurl {
url = "https://orgmode.org/elpa/org-20210510.tar";
sha256 = "015c68pk52vksar7kpyb0nkcyjihlczmpq4h5vdv8xayas2qlzc7";
};
packageRequires = [];
meta = {
homepage = "https://elpa.gnu.org/packages/org.html";
license = lib.licenses.free;
};
}) {};
org-plus-contrib = callPackage ({ elpaBuild, fetchurl, lib }:
elpaBuild {
pname = "org-plus-contrib";
ename = "org-plus-contrib";
version = "20210510";
src = fetchurl {
url = "https://orgmode.org/elpa/org-plus-contrib-20210510.tar";
sha256 = "0pdwjnpcsk75jv4qs8n4xia6vspwn6dndbdx9z7kq5vqz7w4ykmw";
};
packageRequires = [];
meta = {
homepage = "https://elpa.gnu.org/packages/org-plus-contrib.html";
license = lib.licenses.free;
};
}) {};
}
@@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, emacs }:
stdenv.mkDerivation {
name = "org-mac-link-1.2";
src = fetchurl {
url = "https://raw.githubusercontent.com/stuartsierra/org-mode/master/contrib/lisp/org-mac-link.el";
sha256 = "1gkzlfbhg289r1hbqd25szan1wizgk6s99h9xxjip5bjv0jywcx5";
};
phases = [ "buildPhase" "installPhase"];
buildInputs = [ emacs ];
buildPhase = ''
cp $src org-mac-link.el
emacs --batch -f batch-byte-compile org-mac-link.el
'';
installPhase = ''
install -d $out/share/emacs/site-lisp
install org-mac-link.el $out/share/emacs/site-lisp
'';
meta = {
description = "Insert org-mode links to items selected in various Mac apps";
homepage = "https://orgmode.org/worg/org-contrib/org-mac-link.html";
license = lib.licenses.gpl3;
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,32 @@
/*
# Updating
To update the list of packages from Org (ELPA),
1. Run `./update-org`.
2. Check for evaluation errors: `nix-instantiate ../../../../.. -A emacs.pkgs.orgPackages`.
3. Run `git commit -m "org-packages $(date -Idate)" -- org-generated.nix`
*/
{ lib }:
self: let
generateOrg = lib.makeOverridable ({
generated ? ./org-generated.nix
}: let
imported = import generated {
inherit (self) callPackage;
};
super = imported;
overrides = {
};
in super // overrides);
in generateOrg { }
@@ -0,0 +1,23 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation {
name = "perl-completion";
src = fetchurl {
url = "http://emacswiki.org/emacs/download/perl-completion.el";
sha256 = "0x6qsgs4hm87k0z9q3g4p6508kc3y123j5jayll3jf3lcl2vm6ks";
};
phases = [ "installPhase"];
installPhase = ''
install -d $out/share/emacs/site-lisp
install $src $out/share/emacs/site-lisp/perl-completion.el
'';
meta = {
description = "Minor mode provides useful features for editing perl codes";
homepage = "http://emacswiki.org/emacs/PerlCompletion";
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,18 @@
{ trivialBuild, lib, fetchurl }:
trivialBuild rec {
pname = "pod-mode";
version = "1.04";
src = fetchurl {
url = "mirror://cpan/authors/id/F/FL/FLORA/pod-mode-${version}.tar.gz";
sha256 = "1wr0khymkaa65blrc5nya607c1a3sjsww49bbf8f0a6176as71sv";
};
meta = with lib; {
description = "Major mode for editing .pod-files";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
platforms = platforms.all;
};
}
@@ -0,0 +1,22 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation {
pname = "prolog-mode";
version = "1.28";
src = fetchurl {
url = "http://bruda.ca/_media/emacs/prolog.el";
sha256 = "oCMzks4xuor8Il8Ll8PXh1zIvMl5qN0RCFJ9yKiHOHU=";
};
buildCommand = ''
mkdir -p $out/share/emacs/site-lisp/
cp $src $out/share/emacs/site-lisp/prolog.el
'';
meta = {
homepage = "http://bruda.ca/emacs/prolog_mode_for_emacs/";
description = "Prolog mode for Emacs";
license = lib.licenses.gpl2Plus;
};
}
@@ -0,0 +1,22 @@
{ lib, stdenv, fetchgit }:
stdenv.mkDerivation {
name = "railgun-2012-10-17";
src = fetchgit {
url = "https://github.com/mbriggs/railgun.el.git";
rev = "66aaa1b091baef53a69d0d7425f48d184b865fb8";
sha256 = "00x09vjd3jz5f73qkf5v1y402zn8vl8dsyfwlq9z646p18ba7gyh";
};
installPhase = ''
mkdir -p $out/share/emacs/site-lisp
cp *.el *.elc $out/share/emacs/site-lisp/
'';
meta = {
description = "Propel yourself through a rails project with the power of magnets";
homepage = "https://github.com/mbriggs/railgun.el";
platforms = lib.platforms.all;
};
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, emacs }:
stdenv.mkDerivation {
name = "rect-mark-1.4";
src = fetchurl {
url = "http://emacswiki.org/emacs/download/rect-mark.el";
sha256 = "0pyyg53z9irh5jdfvh2qp4pm8qrml9r7lh42wfmdw6c7f56qryh8";
};
phases = [ "buildPhase" "installPhase"];
buildInputs = [ emacs ];
buildPhase = ''
cp $src rect-mark.el
emacs --batch -f batch-byte-compile rect-mark.el
'';
installPhase = ''
install -d $out/share/emacs/site-lisp
install rect-mark.el* $out/share/emacs/site-lisp
'';
meta = {
description = "Mark a rectangle of text with highlighting";
homepage = "http://emacswiki.org/emacs/RectangleMark";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,27 @@
{stdenv, fetchurl, emacs}:
stdenv.mkDerivation {
name = "session-management-for-emacs-2.2a";
src = fetchurl {
url = "mirror://sourceforge/emacs-session/session-2.2a.tar.gz";
sha256 = "37dfba7420b5164eab90dafa9e8bf9a2c8f76505fe2fefa14a64e81fa76d0144";
};
buildInputs = [emacs];
installPhase = ''
mkdir -p "$out/share/emacs/site-lisp"
cp lisp/*.el "$out/share/emacs/site-lisp/"
'';
meta = {
/* installation: add to your ~/.emacs
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
*/
description = "Small session management for emacs";
homepage = "http://emacs-session.sourceforge.net/";
license = "GPL";
};
}
@@ -0,0 +1,42 @@
{ lib
, stdenv
, fetchFromGitHub
, emacs
}:
stdenv.mkDerivation rec {
pname = "sunrise-commander";
version = "0.0.0-unstable=2021-04-23";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "db880fbea03d2db00db1398c91918c3c6f0392e3";
hash = "sha256-IGHCKYQaGUapaA9vxq0xO58KCpBPOiQpHqrEaHK0usE=";
};
buildInputs = [
emacs
];
buildPhase = ''
runHook preBuild
emacs -q --no-splash --directory=. --batch --file=batch-byte-compile *.el
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/emacs/site-lisp
install *.el* $out/share/emacs/site-lisp
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/sunrise-commander/sunrise-commander/";
description = "Orthodox (two-pane) file manager for Emacs";
license = licenses.gpl3Plus;
maintainers = [ maintainers.AndersonTorres ];
platforms = platforms.all;
};
}
@@ -0,0 +1,22 @@
{ fetchurl, lib, trivialBuild }:
trivialBuild {
pname = "sv-kalender";
version = "1.9";
src = fetchurl {
url = "http://bigwalter.net/daniel/elisp/sv-kalender.el";
sha256 = "0kilp0nyhj67qscy13s0g07kygz2qwmddklhan020sk7z7jv3lpi";
postFetch = ''
echo "(provide 'sv-kalender)" >> $out
'';
};
meta = with lib; {
description = "Swedish calendar for Emacs";
homepage = "http://bigwalter.net/daniel/elisp/sv-kalender.el";
platforms = platforms.all;
license = licenses.gpl3Plus;
maintainers = [ maintainers.rycee ];
};
}
@@ -0,0 +1,16 @@
{ lib, stdenv, fetchurl, emacs, texinfo }:
stdenv.mkDerivation rec {
name = "tramp-2.4.2";
src = fetchurl {
url = "mirror://gnu/tramp/${name}.tar.gz";
sha256 = "082nwvi99y0bvpl1yhn4yjc8a613jh1pdck253lxn062lkcxxw61";
};
buildInputs = [ emacs texinfo ];
meta = {
description = "Transparently access remote files from Emacs. Newer versions than built-in.";
homepage = "https://www.gnu.org/software/tramp";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
};
}
@@ -0,0 +1,4 @@
#! /usr/bin/env nix-shell
#! nix-shell --show-trace ./emacs2nix.nix -i bash
exec elpa-packages.sh --names $EMACS2NIX/names.nix -o elpa-generated.nix
@@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl nix
set -euxo pipefail
export NIXPKGS_ALLOW_BROKEN=1
# This script piggybacks on the automatic code generation done by the nix-community emacs overlay
# You can use this to avoid running lengthy code generation jobs locally
curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/elpa/elpa-generated.nix
nix-instantiate ../../../../../ -A emacs.pkgs.elpaPackages --show-trace
git diff --exit-code elpa-generated.nix > /dev/null || git commit -m "emacs.pkgs.elpa-packages: $(date --iso)" -- elpa-generated.nix
curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/org/org-generated.nix
nix-instantiate ../../../../../ -A emacs.pkgs.orgPackages --show-trace
git diff --exit-code org-generated.nix > /dev/null || git commit -m "emacs.pkgs.org-packages: $(date --iso)" -- org-generated.nix
curl -s -O https://raw.githubusercontent.com/nix-community/emacs-overlay/master/repos/melpa/recipes-archive-melpa.json
nix-instantiate --show-trace ../../../../../ -A emacs.pkgs.melpaStablePackages
nix-instantiate --show-trace ../../../../../ -A emacs.pkgs.melpaPackages
git diff --exit-code recipes-archive-melpa.json > /dev/null || git commit -m "emacs.pkgs.melpa-packages: $(date --iso)" -- recipes-archive-melpa.json
@@ -0,0 +1,6 @@
#! /usr/bin/env nix-shell
#! nix-shell --show-trace ./updater-emacs.nix -i bash
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
exec emacs --fg-daemon=updater --quick -l $SCRIPT_DIR/update-melpa.el -f run-updater "$@"
@@ -0,0 +1,437 @@
;; -*- lexical-binding: t -*-
;; This is the updater for recipes-archive-melpa.json
(require 'promise)
(require 'semaphore-promise)
(require 'url)
(require 'json)
(require 'cl)
(require 'subr-x)
(require 'seq)
;; # Lib
(defun alist-set (key value alist)
(cons
(cons key value)
(assq-delete-all
key alist)))
(defun alist-update (key f alist)
(let ((value (alist-get key alist)))
(cons
(cons key (funcall f value))
(assq-delete-all
key alist))))
(defun process-promise (semaphore program &rest args)
"Generate an asynchronous process and
return Promise to resolve in that process."
(promise-then
(semaphore-promise-gated
semaphore
(lambda (resolve reject)
(funcall resolve (apply #'promise:make-process program args))))
#'car))
(defun mangle-name (s)
(if (string-match "^[a-zA-Z].*" s)
s
(concat "_" s)))
;; ## Shell promise + env
(defun as-string (o)
(with-output-to-string (princ o)))
(defun assocenv (env &rest namevals)
(let ((process-environment (copy-sequence env)))
(mapc (lambda (e)
(setenv (as-string (car e))
(cadr e)))
(seq-partition namevals 2))
process-environment))
(defun shell-promise (semaphore env script)
(semaphore-promise-gated
semaphore
(lambda (resolve reject)
(let ((process-environment env))
(funcall resolve (promise:make-shell-command script))))))
;; # Updater
;; ## Previous Archive Reader
(defun previous-commit (index ename variant)
(when-let (pdesc (and index (gethash ename index)))
(when-let (desc (and pdesc (gethash variant pdesc)))
(gethash 'commit desc))))
(defun previous-sha256 (index ename variant)
(when-let (pdesc (and index (gethash ename index)))
(when-let (desc (and pdesc (gethash variant pdesc)))
(gethash 'sha256 desc))))
(defun parse-previous-archive (filename)
(let ((idx (make-hash-table :test 'equal)))
(loop for desc in
(let ((json-object-type 'hash-table)
(json-array-type 'list)
(json-key-type 'symbol))
(json-read-file filename))
do (puthash (gethash 'ename desc)
desc idx))
idx))
;; ## Prefetcher
;; (defun latest-git-revision (url)
;; (process-promise "git" "ls-remote" url))
(defun prefetch (semaphore fetcher repo commit)
(promise-then
(apply 'process-promise
semaphore
(pcase fetcher
("github" (list "nix-prefetch-url"
"--unpack" (concat "https://github.com/" repo "/archive/" commit ".tar.gz")))
("gitlab" (list "nix-prefetch-url"
"--unpack" (concat "https://gitlab.com/api/v4/projects/"
(url-hexify-string repo)
"/repository/archive.tar.gz?ref="
commit)))
("bitbucket" (list "nix-prefetch-hg"
(concat "https://bitbucket.com/" repo) commit))
("hg" (list "nix-prefetch-hg"
repo commit))
("git" (list "nix-prefetch-git"
"--fetch-submodules"
"--url" repo
"--rev" commit))
(_ (throw 'unknown-fetcher fetcher))))
(lambda (res)
(pcase fetcher
("git" (alist-get 'sha256 (json-read-from-string res)))
(_ (car (split-string res)))))))
(defun source-sha (semaphore ename eprops aprops previous variant)
(let* ((fetcher (alist-get 'fetcher eprops))
(url (alist-get 'url eprops))
(repo (alist-get 'repo eprops))
(commit (gethash 'commit aprops))
(prev-commit (previous-commit previous ename variant))
(prev-sha256 (previous-sha256 previous ename variant)))
(if (and commit prev-sha256
(equal prev-commit commit))
(progn
(message "INFO: %s: re-using %s %s" ename prev-commit prev-sha256)
(promise-resolve `((sha256 . ,prev-sha256))))
(if (and commit (or repo url))
(promise-then
(prefetch semaphore fetcher (or repo url) commit)
(lambda (sha256)
(message "INFO: %s: prefetched repository %s %s" ename commit sha256)
`((sha256 . ,sha256)))
(lambda (err)
(message "ERROR: %s: during prefetch %s" ename err)
(promise-resolve
`((error . ,err)))))
(progn
(message "ERROR: %s: no commit information" ename)
(promise-resolve
`((error . "No commit information"))))))))
(defun source-info (recipe archive source-sha)
(let* ((esym (car recipe))
(ename (symbol-name esym))
(eprops (cdr recipe))
(aentry (gethash esym archive))
(version (and aentry (gethash 'ver aentry)))
(deps (when-let (deps (gethash 'deps aentry))
(remove 'emacs (hash-table-keys deps))))
(aprops (and aentry (gethash 'props aentry)))
(commit (gethash 'commit aprops)))
(append `((version . ,version))
(when (< 0 (length deps))
`((deps . ,(sort deps 'string<))))
`((commit . ,commit))
source-sha)))
(defun recipe-info (recipe-index ename)
(if-let (desc (gethash ename recipe-index))
(destructuring-bind (rcp-commit . rcp-sha256) desc
`((commit . ,rcp-commit)
(sha256 . ,rcp-sha256)))
`((error . "No recipe info"))))
(defun start-fetch (semaphore recipe-index-promise recipes unstable-archive stable-archive previous)
(promise-all
(mapcar (lambda (entry)
(let* ((esym (car entry))
(ename (symbol-name esym))
(eprops (cdr entry))
(fetcher (alist-get 'fetcher eprops))
(url (alist-get 'url eprops))
(repo (alist-get 'repo eprops))
(unstable-aentry (gethash esym unstable-archive))
(unstable-aprops (and unstable-aentry (gethash 'props unstable-aentry)))
(unstable-commit (and unstable-aprops (gethash 'commit unstable-aprops)))
(stable-aentry (gethash esym stable-archive))
(stable-aprops (and stable-aentry (gethash 'props stable-aentry)))
(stable-commit (and stable-aprops (gethash 'commit stable-aprops)))
(unstable-shap (if unstable-aprops
(source-sha semaphore ename eprops unstable-aprops previous 'unstable)
(promise-resolve nil)))
(stable-shap (if (equal unstable-commit stable-commit)
unstable-shap
(if stable-aprops
(source-sha semaphore ename eprops stable-aprops previous 'stable)
(promise-resolve nil)))))
(promise-then
(promise-all (list recipe-index-promise unstable-shap stable-shap))
(lambda (res)
(seq-let [recipe-index unstable-sha stable-sha] res
(append `((ename . ,ename))
(if-let (desc (gethash ename recipe-index))
(destructuring-bind (rcp-commit . rcp-sha256) desc
(append `((commit . ,rcp-commit)
(sha256 . ,rcp-sha256))
(when (not unstable-aprops)
(message "ERROR: %s: not in archive" ename)
`((error . "Not in archive")))))
`((error . "No recipe info")))
`((fetcher . ,fetcher))
(if (or (equal "github" fetcher)
(equal "bitbucket" fetcher)
(equal "gitlab" fetcher))
`((repo . ,repo))
`((url . ,url)))
(when unstable-aprops `((unstable . ,(source-info entry unstable-archive unstable-sha))))
(when stable-aprops `((stable . ,(source-info entry stable-archive stable-sha))))))))))
recipes)))
;; ## Emitter
(defun emit-json (prefetch-semaphore recipe-index-promise recipes archive stable-archive previous)
(promise-then
(start-fetch
prefetch-semaphore
recipe-index-promise
(sort recipes (lambda (a b)
(string-lessp
(symbol-name (car a))
(symbol-name (car b)))))
archive stable-archive
previous)
(lambda (descriptors)
(message "Finished downloading %d descriptors" (length descriptors))
(let ((buf (generate-new-buffer "*recipes-archive*")))
(with-current-buffer buf
;; (switch-to-buffer buf)
;; (json-mode)
(insert
(let ((json-encoding-pretty-print t)
(json-encoding-default-indentation " "))
(json-encode descriptors)))
buf)))))
;; ## Recipe indexer
(defun http-get (url parser)
(promise-new
(lambda (resolve reject)
(url-retrieve
url (lambda (status)
(funcall resolve (condition-case err
(progn
(goto-char (point-min))
(search-forward "\n\n")
(message (buffer-substring (point-min) (point)))
(delete-region (point-min) (point))
(funcall parser))
(funcall reject err))))))))
(defun json-read-buffer (buffer)
(with-current-buffer buffer
(save-excursion
(mark-whole-buffer)
(json-read))))
(defun error-count (recipes-archive)
(length
(seq-filter
(lambda (desc)
(alist-get 'error desc))
recipes-archive)))
;; (error-count (json-read-buffer "recipes-archive-melpa.json"))
(defun latest-recipe-commit (semaphore repo base-rev recipe)
(shell-promise
semaphore (assocenv process-environment
"GIT_DIR" repo
"BASE_REV" base-rev
"RECIPE" recipe)
"exec git log --first-parent -n1 --pretty=format:%H $BASE_REV -- recipes/$RECIPE"))
(defun latest-recipe-sha256 (semaphore repo base-rev recipe)
(promise-then
(shell-promise
semaphore (assocenv process-environment
"GIT_DIR" repo
"BASE_REV" base-rev
"RECIPE" recipe)
"exec nix-hash --flat --type sha256 --base32 <(
git cat-file blob $(
git ls-tree $BASE_REV recipes/$RECIPE | cut -f1 | cut -d' ' -f3
)
)")
(lambda (res)
(car
(split-string res)))))
(defun index-recipe-commits (semaphore repo base-rev recipes)
(promise-then
(promise-all
(mapcar (lambda (recipe)
(promise-then
(latest-recipe-commit semaphore repo base-rev recipe)
(let ((sha256p (latest-recipe-sha256 semaphore repo base-rev recipe)))
(lambda (commit)
(promise-then sha256p
(lambda (sha256)
(message "Indexed Recipe %s %s %s" recipe commit sha256)
(cons recipe (cons commit sha256))))))))
recipes))
(lambda (rcp-commits)
(let ((idx (make-hash-table :test 'equal)))
(mapc (lambda (rcpc)
(puthash (car rcpc) (cdr rcpc) idx))
rcp-commits)
idx))))
(defun with-melpa-checkout (resolve)
(let ((tmpdir (make-temp-file "melpa-" t)))
(promise-finally
(promise-then
(shell-promise
(semaphore-create 1 "dummy")
(assocenv process-environment "MELPA_DIR" tmpdir)
"cd $MELPA_DIR
(git init --bare
git remote add origin https://github.com/melpa/melpa.git
git fetch origin) 1>&2
echo -n $MELPA_DIR")
(lambda (dir)
(message "Created melpa checkout %s" dir)
(funcall resolve dir)))
(lambda ()
(delete-directory tmpdir t)
(message "Deleted melpa checkout %s" tmpdir)))))
(defun list-recipes (repo base-rev)
(promise-then
(shell-promise nil (assocenv process-environment
"GIT_DIR" repo
"BASE_REV" base-rev)
"git ls-tree --name-only $BASE_REV recipes/")
(lambda (s)
(mapcar (lambda (n)
(substring n 8))
(split-string s)))))
;; ## Main runner
(defvar recipe-indexp)
(defvar archivep)
(defun run-updater ()
(message "Turning off logging to *Message* buffer")
(setq message-log-max nil)
(setenv "GIT_ASKPASS")
(setenv "SSH_ASKPASS")
(setq process-adaptive-read-buffering nil)
;; Indexer and Prefetcher run in parallel
;; Recipe Indexer
(setq recipe-indexp
(with-melpa-checkout
(lambda (repo)
(promise-then
(promise-then
(list-recipes repo "origin/master")
(lambda (recipe-names)
(promise:make-thread #'index-recipe-commits
;; The indexer runs on a local git repository,
;; so it is CPU bound.
;; Adjust for core count + 2
(semaphore-create 6 "local-indexer")
repo "origin/master"
;; (seq-take recipe-names 20)
recipe-names)))
(lambda (res)
(message "Indexed Recipes: %d" (hash-table-count res))
(defvar recipe-index res)
res)
(lambda (err)
(message "ERROR: %s" err))))))
;; Prefetcher + Emitter
(setq archivep
(promise-then
(promise-then (promise-all
(list (http-get "https://melpa.org/recipes.json"
(lambda ()
(let ((json-object-type 'alist)
(json-array-type 'list)
(json-key-type 'symbol))
(json-read))))
(http-get "https://melpa.org/archive.json"
(lambda ()
(let ((json-object-type 'hash-table)
(json-array-type 'list)
(json-key-type 'symbol))
(json-read))))
(http-get "https://stable.melpa.org/archive.json"
(lambda ()
(let ((json-object-type 'hash-table)
(json-array-type 'list)
(json-key-type 'symbol))
(json-read))))))
(lambda (resolved)
(message "Finished download")
(seq-let [recipes-content archive-content stable-archive-content] resolved
;; The prefetcher is network bound, so 64 seems a good estimate
;; for parallel network connections
(promise:make-thread #'emit-json (semaphore-create 64 "prefetch-pool")
recipe-indexp
recipes-content
archive-content
stable-archive-content
(parse-previous-archive "recipes-archive-melpa.json")))))
(lambda (buf)
(with-current-buffer buf
(write-file "recipes-archive-melpa.json")))
(lambda (err)
(message "ERROR: %s" err))))
;; Shutdown routine
(make-thread
(lambda ()
(promise-finally archivep
(lambda ()
;; (message "Joining threads %s" (all-threads))
;; (mapc (lambda (thr)
;; (when (not (eq thr (current-thread)))
;; (thread-join thr)))
;; (all-threads))
(kill-emacs 0))))))
@@ -0,0 +1,4 @@
#! /usr/bin/env nix-shell
#! nix-shell --show-trace ./emacs2nix.nix -i bash
exec org-packages.sh --names $EMACS2NIX/names.nix -o org-generated.nix
@@ -0,0 +1,40 @@
let
pkgs = import ../../../../.. {};
emacsEnv = pkgs.emacs.pkgs.withPackages (epkgs: let
promise = epkgs.trivialBuild {
pname = "promise";
version = "1";
src = pkgs.fetchFromGitHub {
owner = "bendlas";
repo = "emacs-promise";
rev = "4da97087c5babbd8429b5ce62a8323b9b03c6022";
sha256 = "0yin7kj69g4zxs30pvk47cnfygxlaw7jc7chr3b36lz51yqczjsy";
};
};
semaphore = epkgs.trivialBuild {
pname = "semaphore";
version = "1";
packageRequires = [ promise ];
src = pkgs.fetchFromGitHub {
owner = "webnf";
repo = "semaphore.el";
rev = "93802cb093073bc6a6ccd797328dafffcef248e0";
sha256 = "09pfyp27m35sv340xarhld7xx2vv5fs5xj4418709iw6l6hpk853";
};
};
in [ promise semaphore ]);
in pkgs.mkShell {
packages = [
pkgs.git
pkgs.nix
pkgs.bash
pkgs.nix-prefetch-git
pkgs.nix-prefetch-hg
emacsEnv
];
}
@@ -0,0 +1,25 @@
{ lib, stdenv, fetchurl, emacs }:
stdenv.mkDerivation {
name = "zeitgeist-20120221";
dontUnpack = true;
src = fetchurl {
url = "https://raw.githubusercontent.com/alexmurray/dotfiles/master/.emacs.d/vendor/zeitgeist.el";
sha256 = "0fssx3lp8ar3b1ichbagir7z17habv367l7zz719ipycr24rf1nw";
};
buildInputs = [ emacs ];
installPhase = ''
mkdir -p $out/share/emacs/site-lisp
cp $src $out/share/emacs/site-lisp/zeitgeist.el
'';
meta = {
description = "Integreate Emacs with Zeitgeist";
homepage = "http://zeitgeist-project.com/";
platforms = lib.platforms.all;
};
}