uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,18 @@
{ trivialBuild
, haskellPackages
}:
trivialBuild {
pname = "agda-input";
inherit (haskellPackages.Agda) src version;
postUnpack = ''
mv $sourceRoot/src/data/emacs-mode/agda-input.el $sourceRoot
'';
meta = {
inherit (haskellPackages.Agda.meta) homepage license;
description = "Standalone package providing the agda-input method without building Agda.";
};
}

View file

@ -0,0 +1,27 @@
{ trivialBuild
, haskellPackages
}:
trivialBuild rec {
pname = "agda-mode";
version = haskellPackages.Agda.version;
dontUnpack = true;
# already byte-compiled by Agda builder
buildPhase = ''
agda=`${haskellPackages.Agda}/bin/agda-mode locate`
cp `dirname $agda`/*.el* .
'';
meta = {
inherit (haskellPackages.Agda.meta) homepage license;
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.
'';
};
}

View file

@ -0,0 +1,34 @@
{ lib
, stdenv
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "apheleia";
version = "1.2";
src = fetchFromGitHub {
owner = "raxod502";
repo = pname;
rev = "v${version}";
hash = "sha256-yd9yhQOs0+RB8RKaXnV/kClDm8cO97RkC8yw5b8IKRo=";
};
buildInputs = [
emacs
];
meta = with lib; {
homepage = "https://github.com/raxod502/apheleia";
description = "Asynchronous buffer reformat";
longDescription = ''
Run code formatter on buffer contents without moving point, using RCS
patches and dynamic programming.
'';
license = licenses.mit;
maintainers = with maintainers; [ AndersonTorres leungbk ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,22 @@
{ lib
, trivialBuild
, fetchFromGitHub
}:
trivialBuild {
pname = "bqn-mode";
version = "0.pre+date=2022-01-07";
src = fetchFromGitHub {
owner = "museoa";
repo = "bqn-mode";
rev = "86ef8b4d32d272b2765cd4a6e6e0b70a4f3e99a2";
hash = "sha256-6ygV/iNzzpZ77w+Dh/snHAzUxrbfaU9TxuNOtJK6pNQ=";
};
meta = with lib; {
description = "Emacs mode for BQN programming language";
license = licenses.gpl3Only;
maintainers = with maintainers; [ sternenseemann AndersonTorres ];
};
}

View file

@ -0,0 +1,33 @@
{ stdenv
, cedille
, emacs
}:
stdenv.mkDerivation {
pname = "cedille-mode";
inherit (cedille) version src;
buildInputs = [ emacs ];
dontBuild = true;
installPhase = ''
runHook preInstall
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
runHook postInstall
'';
meta = {
inherit (cedille.meta)
homepage license maintainers platforms;
description = "Emacs major mode for Cedille";
};
}

View file

@ -0,0 +1,38 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
, color-theme
}:
trivialBuild {
pname = "color-theme-solarized";
version = "0.pre+unstable=2017-10-24";
src = fetchFromGitHub {
owner = "sellout";
repo = "emacs-color-theme-solarized";
rev = "f3ca8902ea056fb8e46cb09f09c96294e31cd4ee";
hash = "sha256-oxX0lo6sxotEiR3nPrKPE9H01HKB3ohB/p8eEHFTp5k=";
};
buildInputs = [ emacs ];
propagatedUserEnvPkgs = [ color-theme ];
buildPhase = ''
runHook preBuild
emacs -L . -L ${color-theme}/share/emacs/site-lisp/elpa/color-theme-* \
--batch -f batch-byte-compile *.el
runHook postBuild
'';
meta = with lib; {
homepage = "http://ethanschoonover.com/solarized";
description = "Precision colors for machines and people; Emacs implementation";
license = licenses.mit;
maintainers = with maintainers; [ samuelrivas AndersonTorres ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,23 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation {
name = "control-lock";
src = fetchurl {
url = "https://github.com/emacsmirror/emacswiki.org/blob/185fdc34fb1e02b43759ad933d3ee5646b0e78f8/control-lock.el";
sha256 = "1b5xcgq2r565pr1c14dwrmn1fl05p56infapa5pqvajv2kpfla7h";
};
dontUnpack = true;
installPhase = ''
install -d $out/share/emacs/site-lisp
install $src $out/share/emacs/site-lisp/control-lock.el
'';
meta = {
description = "Like caps-lock, but for your control key. Give your pinky a rest!";
homepage = "https://www.emacswiki.org/emacs/control-lock.el";
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,17 @@
{ lib, trivialBuild, fetchurl }:
trivialBuild rec {
pname = "ebuild-mode";
version = "1.55";
src = fetchurl {
url = "https://dev.gentoo.org/~ulm/emacs/${pname}-${version}.tar.xz";
sha256 = "1bs2s5g79vrbk8544lvp388cdbig0s121kwk0h10hif4kp56ka9w";
};
meta = with lib; {
description = "Major modes for Gentoo package files";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,128 @@
/*
# Updating
To update the list of packages from ELPA,
1. Run `./update-elpa`.
2. Check for evaluation errors:
# "../../../../../" points to the default.nix from root of Nixpkgs tree
env NIXPKGS_ALLOW_BROKEN=1 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, gcc, pkgs, buildPackages }:
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 gcc;
inherit (self) emacs;
};
# Use custom elpa url fetcher with fallback/uncompress
fetchurl = buildPackages.callPackage ./fetchelpa.nix { };
generateElpa = lib.makeOverridable ({
generated ? ./elpa-generated.nix
}: let
imported = import generated {
callPackage = pkgs: args: self.callPackage pkgs (args // {
inherit fetchurl;
});
};
super = removeAttrs imported [ "dash" ];
overrides = {
# upstream issue: Wrong type argument: arrayp, nil
org-transclusion =
if super.org-transclusion.version == "1.2.0"
then markBroken super.org-transclusion
else super.org-transclusion;
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;
# Compilation instructions for the Ada executables:
# https://www.nongnu.org/ada-mode/ada-mode.html#Ada-executables
ada-mode = super.ada-mode.overrideAttrs (old: {
# actually unpack source of ada-mode and wisi
# which are both needed to compile the tools
# we need at runtime
dontUnpack = false;
srcs = [
super.ada-mode.src
self.wisi.src
];
sourceRoot = "ada-mode-${self.ada-mode.version}";
nativeBuildInputs = [
buildPackages.gnat
buildPackages.gprbuild
buildPackages.lzip
];
buildInputs = [
pkgs.gnatcoll-xref
];
preInstall = ''
./build.sh -j$NIX_BUILD_CORES
'';
postInstall = ''
./install.sh --prefix=$out
'';
meta = old.meta // {
maintainers = [ lib.maintainers.sternenseemann ];
};
});
plz = super.plz.overrideAttrs (
old: {
dontUnpack = false;
postPatch = old.postPatch or "" + ''
substituteInPlace ./plz.el \
--replace 'plz-curl-program "curl"' 'plz-curl-program "${pkgs.curl}/bin/curl"'
'';
preInstall = ''
tar -cf "$pname-$version.tar" --transform "s,^,$pname-$version/," * .[!.]*
src="$pname-$version.tar"
'';
}
);
};
elpaPackages = super // overrides;
in elpaPackages // { inherit elpaBuild; });
in generateElpa { }

View file

@ -0,0 +1,24 @@
let
pkgs = import ../../../../.. { };
src = pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "emacs2nix";
rev = "2e8d2c644397be57455ad32c2849f692eeac7797";
sha256 = "sha256-qnOYDYHAQ+r5eegKP9GqHz5R2ig96B2W7M+uYa1ti9M=";
fetchSubmodules = true;
};
in
pkgs.mkShell {
packages = [
pkgs.bash
];
EMACS2NIX = src;
shellHook = ''
export PATH=$PATH:${src}
'';
}

View file

@ -0,0 +1,60 @@
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, emacs
, tcl
, tclx
, espeak-ng
}:
stdenv.mkDerivation rec {
pname = "emacspeak";
version = "54.0";
src = fetchFromGitHub {
owner = "tvraman";
repo = pname;
rev = version;
hash= "sha256-aOZ8PmkASJKETPhXhE9WQXyJS7SPe+d97fK/piqqzqc=";
};
nativeBuildInputs = [
emacs
makeWrapper
];
buildInputs = [
espeak-ng
tcl
tclx
];
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 "${placeholder "out"}/share/emacs/site-lisp/emacspeak/servers/espeak" \
--set TCLLIBPATH "${tclx}/lib" \
--add-flags '-l "${placeholder "out"}/share/emacs/site-lisp/emacspeak/lisp/emacspeak-setup.elc"'
'';
meta = with lib; {
homepage = "https://github.com/tvraman/emacspeak/";
description = "Emacs extension that provides spoken output";
license = licenses.gpl2Plus;
maintainers = [ maintainers.AndersonTorres ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,44 @@
{ trivialBuild
, lib
, fetchFromGitHub
, curl
, plz
, cl-lib
, ts
, magit-section
, taxy-magit-section
, taxy
, svg-lib
}:
trivialBuild {
pname = "ement";
version = "unstable-2022-05-14";
src = fetchFromGitHub {
owner = "alphapapa";
repo = "ement.el";
rev = "961d650377f9e7440e47c36c0386e899f5b2d86b";
sha256 = "sha256-4KTSPgso7UvzCRKNFI3YaPR1t4DUwggO4KtBYLm0W4Y=";
};
packageRequires = [
plz
cl-lib
ts
magit-section
taxy-magit-section
taxy
svg-lib
];
patches = [
./handle-nil-images.patch
];
meta = {
description = "Ement.el is a Matrix client for Emacs";
license = lib.licenses.gpl3Only;
platforms = lib.platforms.all;
};
}

View file

@ -0,0 +1,28 @@
diff --git a/ement-lib.el b/ement-lib.el
index f0b2738..025a191 100644
--- a/ement-lib.el
+++ b/ement-lib.el
@@ -644,14 +644,15 @@ can cause undesirable underlining."
"Return a copy of IMAGE set to MAX-WIDTH and MAX-HEIGHT.
IMAGE should be one as created by, e.g. `create-image'."
;; It would be nice if the image library had some simple functions to do this sort of thing.
- (let ((new-image (cl-copy-list image)))
- (when (fboundp 'imagemagick-types)
- ;; Only do this when ImageMagick is supported.
- ;; FIXME: When requiring Emacs 27+, remove this (I guess?).
- (setf (image-property new-image :type) 'imagemagick))
- (setf (image-property new-image :max-width) max-width
- (image-property new-image :max-height) max-height)
- new-image))
+ (when image
+ (let ((new-image (cl-copy-list image)))
+ (when (fboundp 'imagemagick-types)
+ ;; Only do this when ImageMagick is supported.
+ ;; FIXME: When requiring Emacs 27+, remove this (I guess?).
+ (setf (image-property new-image :type) 'imagemagick))
+ (setf (image-property new-image :max-width) max-width
+ (image-property new-image :max-height) max-height)
+ new-image)))
(defun ement--room-alias (room)
"Return latest m.room.canonical_alias event in ROOM."

View file

@ -0,0 +1,30 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
, popup
, ess
}:
trivialBuild rec {
pname = "ess-R-object-popup";
version = "1.0";
src = fetchFromGitHub {
owner = "myuhe";
repo = "ess-R-object-popup.el";
rev = "v${version}";
hash = "sha256-YN8ZLXEbwTFdFfovkV2IXV9v6y/PTgCdiRQqbpRaF2E=";
};
packageRequires = [
popup
ess
];
meta = {
homepage = "https://github.com/myuhe/ess-R-object-popup.el";
description = "Popup descriptions of R objects";
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,34 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "evil-markdown";
version = "0.pre+unstable=2021-07-21";
src = fetchFromGitHub {
owner = "Somelauw";
repo = "evil-markdown";
rev = "8e6cc68af83914b2fa9fd3a3b8472573dbcef477";
hash = "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=";
};
buildInputs = [
emacs
] ++ propagatedUserEnvPkgs;
propagatedUserEnvPkgs = with emacs.pkgs; [
evil
markdown-mode
];
meta = with lib; {
homepage = "https://github.com/Somelauw/evil-markdown";
description = "Integrates Emacs evil and markdown";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ leungbk ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,21 @@
# Elpa only serves the latest version of a given package uncompressed.
# Once that release is no longer the latest & greatest it gets archived and compressed
# meaning that both the URL and the hash changes.
#
# To work around this issue we fall back to the URL with the .lz suffix and if that's the
# one we downloaded we uncompress the file to ensure the hash matches regardless of compression.
{ fetchurl, lzip }:
{ url, ... }@args: fetchurl ((removeAttrs args [ "url" ]) // {
urls = [
url
(url + ".lz")
];
postFetch = ''
if [[ $url == *.lz ]]; then
${lzip}/bin/lzip -c -d $out > uncompressed
mv uncompressed $out
fi
'';
})

View file

@ -0,0 +1,22 @@
{ lib
, fetchFromGitHub
, trivialBuild
}:
trivialBuild {
pname = "font-lock-plus";
version = "208+unstable=2018-01-01";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "font-lock-plus";
rev = "f2c1ddcd4c9d581bd32be88fad026b49f98b6541";
hash = "sha256-lFmdVMXIIXZ9ZohAJw5rhxpTv017qIyzmpuKOWDdeJ4=";
};
meta = with lib; {
homepage = "https://github.com/emacsmirror/font-lock-plus";
description = "Enhancements to standard library font-lock.el";
license = licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,26 @@
{ lib
, stdenv
, fetchFromGitHub
, emacs
, trivialBuild
}:
trivialBuild {
pname = "git-undo";
version = "0.pre+unstable=2019-12-21";
src = fetchFromGitHub {
owner = "jwiegley";
repo = "git-undo-el";
rev = "cf31e38e7889e6ade7d2d2b9f8719fd44f52feb5";
sha256 = "sha256-cVkK9EF6qQyVV3uVqnBEjF8e9nEx/8ixnM8PvxqCyYE=";
};
meta = with lib; {
homepage = "https://github.com/jwiegley/git-undo-el";
description = "Revert region to most recent Git-historical version";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ leungbk ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,34 @@
{ trivialBuild
, lib
, fetchFromGitHub
}:
trivialBuild {
pname = "header-file-mode";
version = "unstable-2022-05-25";
src = fetchFromGitHub {
owner = "aidalgol";
repo = "header-file-mode";
rev = "cf6ce33b436ae9631aece1cd30a459cb0f89d1cd";
sha256 = "sha256-+TDJubmBc0Hl+2ms58rnOf3hTaQE3ayrIpGWl4j39GQ=";
};
postUnpack = ''
sourceRoot="$sourceRoot/lisp"
'';
postBuild = ''
emacs -L . --batch -l package --eval '(package-generate-autoloads "header-file" ".")'
'';
meta = {
description = ''
A major mode that, when associated with the .h file extension, will put
those file into the major mode of their corresponding implementation file.
'';
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ aidalgol ];
};
}

View file

@ -0,0 +1,28 @@
{ lib
, trivialBuild
, fetchFromGitHub
, dictionary
, emacs
, helm
}:
trivialBuild rec {
pname = "helm-words";
version = "0.pre+unstable=2019-03-12";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = pname;
rev = "e6387ece1940a06695b9d910de3d90252efb8d29";
hash = "sha256-rh8YKDLZZCUE6JnnRnFyDDyUjK+35+M2dkawR/+qwNM=";
};
packageRequires = [ helm dictionary ];
meta = with lib; {
homepage = "https://github.com/emacsmirror/helm-words";
description = "Helm extension for looking up words in dictionaries and thesauri";
license = licenses.gpl3Plus;
inherit (emacs.meta) platforms;
};
}

View file

@ -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;
};
}

View file

@ -0,0 +1,25 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild {
pname = "isearch-plus";
version = "3434+unstable=2021-08-23";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "isearch-plus";
rev = "93088ea0ac4d51bdb76c4c32ea53172f6c435852";
hash = "sha256-kD+Fyps3fc5YK6ATU1nrkKHazGMYJnU2gRcpQZf6A1E=";
};
meta = with lib; {
homepage = "https://www.emacswiki.org/emacs/IsearchPlus";
description = "Extensions to isearch";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ leungbk AndersonTorres ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,26 @@
{ lib
, stdenv
, fetchFromGitHub
, trivialBuild
, emacs
}:
trivialBuild {
pname = "isearch-prop";
version = "0.pre+unstable=2019-05-01";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "isearch-prop";
rev = "4a2765f835dd115d472142da05215c4c748809f4";
hash = "sha256-A1Kt4nm7iRV9J5yaLupwiNL5g7ddZvQs79dggmqZ7Rk=";
};
meta = with lib; {
homepage = "https://www.emacswiki.org/emacs/IsearchPlus";
description = "Search text- or overlay-property contexts";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ leungbk ];
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,29 @@
{ lib
, trivialBuild
, fetchurl
}:
trivialBuild rec {
pname = "jam-mode";
version = "0.3";
src = fetchurl {
url = "https://dev.gentoo.org/~ulm/distfiles/${pname}-${version}.el.xz";
hash = "sha256-0IlYqbPa4AAwOpjdd20k8hqtvDhZmcz1WHa/LHx8kMk=";
};
unpackPhase = ''
runHook preUnpack
xz -cd $src > jam-mode.el
runHook postUnpack
'';
meta = with lib; {
description = "An Emacs major mode for editing Jam files";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,97 @@
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 commit;
version = if isNull version then "" else
lib.concatStringsSep "." (map toString
# Hack: Melpa archives contains versions with parse errors such as [ 4 4 -4 413 ] which should be 4.4-413
# This filter method is still technically wrong, but it's computationally cheap enough and tapers over the issue
(builtins.filter (n: n >= 0) 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;
}

View file

@ -0,0 +1,17 @@
{ trivialBuild
, llvmPackages
}:
trivialBuild {
pname = "llvm-mode";
inherit (llvmPackages.llvm) src version;
postUnpack = ''
sourceRoot="$sourceRoot/utils/emacs"
'';
meta = {
inherit (llvmPackages.llvm.meta) homepage license;
description = "Major mode for the LLVM assembler language";
};
}

View file

@ -0,0 +1,254 @@
{ lib, pkgs }: self: with self; with lib.licenses; {
elisp-ffi = let
rev = "da37c516a0e59bdce63fb2dc006a231dee62a1d9";
in melpaBuild {
pname = "elisp-ffi";
version = "20170518.0";
commit = rev;
src = pkgs.fetchFromGitHub {
owner = "skeeto";
repo = "elisp-ffi";
inherit rev;
sha256 = "sha256-StOezQEnNTjRmjY02ub5FRh59aL6gWfw+qgboz0wF94=";
};
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.libffi ];
preBuild = ''
mv ffi.el elisp-ffi.el
make
'';
recipe = pkgs.writeText "recipe" ''
(elisp-ffi
:repo "skeeto/elisp-ffi"
:fetcher github)
'';
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;
};
};
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 = let
rev = "d8d168148c187ed19350bb7a1a190217c2915a63";
in melpaBuild {
pname = "haskell-unicode-input-method";
version = "20110905.2307";
commit = rev;
src = pkgs.fetchFromGitHub {
owner = "roelvandijk";
repo = "emacs-haskell-unicode-input-method";
inherit rev;
sha256 = "09b7bg2s9aa4s8f2kdqs4xps3jxkq5wsvbi87ih8b6id38blhf78";
};
recipe = pkgs.writeText "recipe" ''
(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;
};
};
matrix-client = let
rev = "d2ac55293c96d4c95971ed8e2a3f6f354565c5ed";
in melpaBuild
{
pname = "matrix-client";
version = "0.3.0";
commit = rev;
src = pkgs.fetchFromGitHub {
owner = "alphapapa";
repo = "matrix-client.el";
inherit rev;
sha256 = "1scfv1502yg7x4bsl253cpr6plml1j4d437vci2ggs764sh3rcqq";
};
patches = [
# Fix: avatar loading when imagemagick support is not available
(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;
};
};
agda2-mode = callPackage ./agda2-mode { };
agda-input = callPackage ./agda-input{ };
bqn-mode = callPackage ./bqn-mode { };
llvm-mode = callPackage ./llvm-mode { };
ott-mode = callPackage ./ott-mode { };
urweb-mode = callPackage ./urweb-mode { };
# Packages made the classical callPackage way
apheleia = callPackage ./apheleia { };
ebuild-mode = callPackage ./ebuild-mode { };
evil-markdown = callPackage ./evil-markdown { };
emacspeak = callPackage ./emacspeak { };
ement = callPackage ./ement { };
ess-R-object-popup = callPackage ./ess-R-object-popup { };
font-lock-plus = callPackage ./font-lock-plus { };
git-undo = callPackage ./git-undo { };
header-file-mode = callPackage ./header-file-mode { };
helm-words = callPackage ./helm-words { };
isearch-plus = callPackage ./isearch-plus { };
isearch-prop = callPackage ./isearch-prop { };
jam-mode = callPackage ./jam-mode { };
nano-theme = callPackage ./nano-theme { };
perl-completion = callPackage ./perl-completion { };
control-lock = callPackage ./control-lock { };
pod-mode = callPackage ./pod-mode { };
power-mode = callPackage ./power-mode { };
prisma-mode = let
rev = "5283ca7403bcb21ca0cac8ecb063600752dfd9d4";
in melpaBuild {
pname = "prisma-mode";
version = "20211207.0";
commit = rev;
packageRequires = [ js2-mode ];
src = pkgs.fetchFromGitHub {
owner = "pimeys";
repo = "emacs-prisma-mode";
inherit rev;
sha256 = "sha256-DJJfjbu27Gi7Nzsa1cdi8nIQowKH8ZxgQBwfXLB0Q/I=";
};
recipe = pkgs.writeText "recipe" ''
(prisma-mode
:repo "pimeys/emacs-prisma-mode"
:fetcher github)
'';
meta = {
description = "Major mode for Prisma Schema Language";
license = gpl2Only;
};
};
structured-haskell-mode = self.shm;
sv-kalender = callPackage ./sv-kalender { };
tree-sitter-langs = callPackage ./tree-sitter-langs { final = self; };
tsc = callPackage ./tsc { };
youtube-dl = callPackage ./youtube-dl { };
# From old emacsPackages (pre emacsPackagesNg)
cedille = callPackage ./cedille { cedille = pkgs.cedille; };
color-theme-solarized = callPackage ./color-theme-solarized { };
session-management-for-emacs = callPackage ./session-management-for-emacs { };
hsc3-mode = callPackage ./hsc3 { };
prolog-mode = callPackage ./prolog { };
rect-mark = callPackage ./rect-mark { };
sunrise-commander = callPackage ./sunrise-commander { };
# camelCase aliases for some of the kebab-case expressions above
colorThemeSolarized = color-theme-solarized;
emacsSessionManagement = session-management-for-emacs;
rectMark = rect-mark;
sunriseCommander = sunrise-commander;
}

View file

@ -0,0 +1,568 @@
/*
# Updating
To update the list of packages from MELPA,
1. Run `./update-melpa`
2. Check for evaluation errors:
# "../../../../../" points to the default.nix from root of Nixpkgs tree
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 = lib.optionalAttrs (variant == "stable") {
# upstream issue: missing file header
abridge-diff =
if super.abridge-diff.version == "0.1"
then markBroken super.abridge-diff
else super.abridge-diff;
# upstream issue: missing file header
bufshow = markBroken super.bufshow;
# upstream issue: missing file header
speech-tagger = markBroken super.speech-tagger;
# upstream issue: missing file header
textmate = markBroken super.textmate;
# upstream issue: missing file header
window-numbering = markBroken super.window-numbering;
# upstream issue: missing file header
voca-builder = markBroken super.voca-builder;
# upstream issue: missing file header
initsplit = markBroken super.initsplit;
# upstream issue: missing file header
jsfmt = markBroken super.jsfmt;
# upstream issue: missing file header
maxframe = markBroken super.maxframe;
# upstream issue: missing file header
connection = markBroken super.connection;
# upstream issue: missing file header
dictionary = markBroken super.dictionary;
# upstream issue: missing file header
fold-dwim =
if super.fold-dwim.version == "1.2"
then markBroken super.fold-dwim
else super.fold-dwim;
# upstream issue: missing file header
gl-conf-mode =
if super.gl-conf-mode.version == "0.3"
then markBroken super.gl-conf-mode
else super.gl-conf-mode;
# upstream issue: missing file header
ligo-mode =
if super.ligo-mode.version == "0.3"
then markBroken super.ligo-mode
else super.ligo-mode;
# upstream issue: missing file header
link = markBroken super.link;
# upstream issue: missing file header
org-dp =
if super.org-dp.version == "1"
then markBroken super.org-dp
else super.org-dp;
# upstream issue: missing file header
revbufs =
if super.revbufs.version == "1.2"
then markBroken super.revbufs
else super.revbufs;
# 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;
} // {
# 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.libclang.lib}/include";
LDFLAGS = "-L${pkgs.llvmPackages.libclang.lib}/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" ];
});
erlang = super.erlang.overrideAttrs (attrs: {
buildInputs = attrs.buildInputs ++ [
pkgs.perl
pkgs.ncurses
];
});
# 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: {
# Temporary work around for:
# - https://github.com/vedang/pdf-tools/issues/102
# - https://github.com/vedang/pdf-tools/issues/103
# - https://github.com/vedang/pdf-tools/issues/109
CXXFLAGS = "-std=c++17";
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.libclang ];
});
# 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 ];
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-sticker.el --replace '"ffmpeg' '"${pkgs.ffmpeg}/bin/ffmpeg'
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
instapaper = markBroken super.instapaper;
# 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
sql-presto = markBroken super.sql-presto;
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}"'
'';
});
});
mozc = super.mozc.overrideAttrs (attrs: {
postPatch = attrs.postPatch or "" + ''
substituteInPlace src/unix/emacs/mozc.el \
--replace '"mozc_emacs_helper"' '"${pkgs.ibus-engines.mozc}/lib/mozc/mozc_emacs_helper"'
'';
});
};
in lib.mapAttrs (n: v: if lib.hasAttr n overrides then overrides.${n} else v) super);
in
generateMelpa { }

View file

@ -0,0 +1,23 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "nano-theme";
version = "0.pre+unstable=2021-06-29";
src = fetchFromGitHub {
owner = "rougier";
repo = pname;
rev = "4a231787a32b3019f9f0abb3511a112fd54bf685";
hash = "sha256-eco9BMKLhPuwFJb5QesbM6g3cZv3FdVvQ9fXq6D3Ifc=";
};
meta = {
homepage = "https://github.com/rougier/nano-theme";
description = "GNU Emacs / N Λ N O Theme";
inherit (emacs.meta) platforms;
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,37 @@
/*
# Updating
To update the list of packages from nongnu (ELPA),
1. Run `./update-nongnu`.
2. Check for evaluation errors:
# "../../../../../" points to the default.nix from root of Nixpkgs tree
env NIXPKGS_ALLOW_BROKEN=1 nix-instantiate ../../../../../ -A emacs.pkgs.nongnuPackages
3. Run `git commit -m "nongnu-packages $(date -Idate)" -- nongnu-generated.nix`
*/
{ lib, buildPackages }:
self: let
generateNongnu = lib.makeOverridable ({
generated ? ./nongnu-generated.nix
}: let
imported = import generated {
callPackage = pkgs: args: self.callPackage pkgs (args // {
# Use custom elpa url fetcher with fallback/uncompress
fetchurl = buildPackages.callPackage ./fetchelpa.nix { };
});
};
super = imported;
overrides = {
};
in super // overrides);
in generateNongnu { }

View file

@ -0,0 +1,19 @@
{ trivialBuild
, ott
, haskellPackages
}:
trivialBuild {
pname = "ott-mode";
inherit (ott) src version;
postUnpack = ''
mv $sourceRoot/emacs/ott-mode.el $sourceRoot
'';
meta = {
description = "Emacs ott mode (from ott sources)";
inherit (haskellPackages.Agda.meta) homepage license;
};
}

View file

@ -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";
};
dontUnpack = true;
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;
};
}

View file

@ -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;
};
}

View file

@ -0,0 +1,23 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "power-mode";
version = "0.pre+unstable=2021-06-06";
src = fetchFromGitHub {
owner = "elizagamedev";
repo = "power-mode.el";
rev = "940e0aa36220f863e8f43840b4ed634b464fbdbb";
hash = "sha256-Wy8o9QTWqvH9cP7xsTpF5QSd4mWNIPXJTadoADKeHWY=";
};
meta = {
homepage = "https://github.com/elizagamedev/power-mode.el";
description = "Imbue Emacs with power!";
inherit (emacs.meta) platforms;
};
}

View file

@ -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 = "ZzIDFQWPq1vI9z3btgsHgn0axN6uRQn9Tt8TnqGybOk=";
};
buildCommand = ''
mkdir -p $out/share/emacs/site-lisp/
cp $src $out/share/emacs/site-lisp/prolog.el
'';
meta = {
homepage = "https://bruda.ca/emacs/prolog_mode_for_emacs/";
description = "Prolog mode for Emacs";
license = lib.licenses.gpl2Plus;
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "rect-mark";
version = "1.4";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = pname;
rev = version;
hash = "sha256-/8T1VTYkKUxlNWXuuS54S5jpl4UxJBbgSuWc17a/VyM=";
};
buildInputs = [ emacs ];
meta = with lib; {
homepage = "http://emacswiki.org/emacs/RectangleMark";
description = "Mark a rectangle of text with highlighting";
license = licenses.gpl2Plus;
inherit (emacs.meta) platforms;
};
}

View file

@ -0,0 +1,29 @@
{ stdenv, fetchurl, emacs, lib }:
stdenv.mkDerivation rec {
pname = "session-management-for-emacs";
version = "2.2a";
src = fetchurl {
url = "mirror://sourceforge/emacs-session/session-${version}.tar.gz";
sha256 = "37dfba7420b5164eab90dafa9e8bf9a2c8f76505fe2fefa14a64e81fa76d0144";
};
buildInputs = [ emacs ];
installPhase = ''
mkdir -p "$out/share/emacs/site-lisp"
cp lisp/*.el "$out/share/emacs/site-lisp/"
'';
meta = with lib; {
/* 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 = licenses.gpl2;
maintainers = with maintainers; [ ];
};
}

View file

@ -0,0 +1,29 @@
{ lib
, trivialBuild
, fetchFromGitHub
, emacs
}:
trivialBuild rec {
pname = "sunrise-commander";
version = "0.pre+unstable=2021-09-27";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "16e6df7e86c7a383fb4400fae94af32baf9cb24e";
hash = "sha256-D36qiRi5OTZrBtJ/bD/javAWizZ8NLlC/YP4rdLCSsw=";
};
buildInputs = [
emacs
];
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;
};
}

View file

@ -0,0 +1,19 @@
{ fetchurl, lib, trivialBuild }:
trivialBuild {
pname = "sv-kalender";
version = "1.11";
src = fetchurl {
url = "http://bigwalter.net/daniel/elisp/sv-kalender.el";
sha256 = "0mcx7g1pg6kfp0i4b9rh3q9csgdf3054ijswy368bxwdxsjgfz2m";
};
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 ];
};
}

View file

@ -0,0 +1,31 @@
[
"tree-sitter-agda",
"tree-sitter-bash",
"tree-sitter-c",
"tree-sitter-c-sharp",
"tree-sitter-cpp",
"tree-sitter-css",
"tree-sitter-elixir",
"tree-sitter-elm",
"tree-sitter-fluent",
"tree-sitter-go",
"tree-sitter-haskell",
"tree-sitter-hcl",
"tree-sitter-html",
"tree-sitter-java",
"tree-sitter-javascript",
"tree-sitter-jsdoc",
"tree-sitter-json",
"tree-sitter-julia",
"tree-sitter-nix",
"tree-sitter-ocaml",
"tree-sitter-php",
"tree-sitter-prisma",
"tree-sitter-python",
"tree-sitter-ruby",
"tree-sitter-rust",
"tree-sitter-scala",
"tree-sitter-typescript",
"tree-sitter-verilog",
"tree-sitter-zig"
]

View file

@ -0,0 +1,44 @@
{ lib
, pkgs
, symlinkJoin
, fetchzip
, melpaBuild
, stdenv
, fetchFromGitHub
, writeText
, melpaStablePackages
, runCommand
, tree-sitter-grammars
, plugins ? map (g: tree-sitter-grammars.${g}) (lib.importJSON ./default-grammars.json)
, final
}:
let
inherit (melpaStablePackages) tree-sitter-langs;
libSuffix = if stdenv.isDarwin then "dylib" else "so";
soName = g: lib.removeSuffix "-grammar" (lib.removePrefix "tree-sitter-" g.pname) + "." + libSuffix;
grammarDir = runCommand "emacs-tree-sitter-grammars" {
# Fake same version number as upstream language bundle to prevent triggering runtime downloads
inherit (tree-sitter-langs) version;
} (''
install -d $out/langs/bin
echo -n $version > $out/langs/bin/BUNDLE-VERSION
'' + lib.concatStringsSep "\n" (map (
g: "ln -s ${g}/parser $out/langs/bin/${soName g}") plugins
));
in
melpaStablePackages.tree-sitter-langs.overrideAttrs(old: {
postPatch = old.postPatch or "" + ''
substituteInPlace ./tree-sitter-langs-build.el \
--replace "tree-sitter-langs-grammar-dir tree-sitter-langs--dir" "tree-sitter-langs-grammar-dir \"${grammarDir}/langs\""
'';
passthru = old.passthru or {} // {
inherit plugins;
withPlugins = fn: final.tree-sitter-langs.override { plugins = fn tree-sitter-grammars; };
};
})

View file

@ -0,0 +1,74 @@
#!/usr/bin/env nix-shell
#! nix-shell ../../../../../../. -i python3 -p python3 -p nix
from os.path import (
dirname,
abspath,
join,
)
from typing import (
List,
Any,
)
import subprocess
import json
import sys
import os
def fmt_grammar(grammar: str) -> str:
return "tree-sitter-" + grammar
def eval_expr(nixpkgs: str, expr: str) -> Any:
p = subprocess.run(
[
"nix-instantiate",
"--json",
"--eval",
"--expr",
("with import %s {}; %s" % (nixpkgs, expr)),
],
check=True,
stdout=subprocess.PIPE,
)
return json.loads(p.stdout)
def check_grammar_exists(nixpkgs: str, grammar: str) -> bool:
return eval_expr(
nixpkgs, f'lib.hasAttr "{fmt_grammar(grammar)}" tree-sitter-grammars'
)
def build_attr(nixpkgs, attr: str) -> str:
return (
subprocess.run(
["nix-build", "--no-out-link", nixpkgs, "-A", attr],
check=True,
stdout=subprocess.PIPE,
)
.stdout.decode()
.strip()
)
if __name__ == "__main__":
cwd = dirname(abspath(__file__))
nixpkgs = abspath(join(cwd, "../../../../../.."))
src_dir = build_attr(nixpkgs, "emacs.pkgs.tree-sitter-langs.src")
existing: List[str] = []
grammars = os.listdir(join(src_dir, "repos"))
for g in grammars:
exists = check_grammar_exists(nixpkgs, g)
if exists:
existing.append(fmt_grammar(g))
else:
sys.stderr.write("Missing grammar: " + fmt_grammar(g) + "\n")
sys.stderr.flush()
with open(join(cwd, "default-grammars.json"), mode="w") as f:
json.dump(sorted(existing), f, indent=2)
f.write("\n")

View file

@ -0,0 +1,89 @@
{ lib
, symlinkJoin
, melpaBuild
, fetchFromGitHub
, rustPlatform
, writeText
, clang
, llvmPackages
, runtimeShell
, writeScript
, python3
, nix-prefetch-github
, nix
}:
let
srcMeta = lib.importJSON ./src.json;
inherit (srcMeta) version;
src = fetchFromGitHub srcMeta.src;
tsc = melpaBuild {
inherit src;
inherit version;
pname = "tsc";
commit = version;
sourceRoot = "source/core";
recipe = writeText "recipe" ''
(tsc
:repo "emacs-tree-sitter/elisp-tree-sitter"
:fetcher github)
'';
};
tsc-dyn = rustPlatform.buildRustPackage {
inherit version;
inherit src;
pname = "tsc-dyn";
nativeBuildInputs = [ clang ];
sourceRoot = "source/core";
configurePhase = ''
export LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib"
'';
postInstall = ''
LIB=($out/lib/libtsc_dyn.*)
TSC_PATH=$out/share/emacs/site-lisp/elpa/tsc-${version}
install -d $TSC_PATH
install -m444 $out/lib/libtsc_dyn.* $TSC_PATH/''${LIB/*libtsc_/tsc-}
echo -n $version > $TSC_PATH/DYN-VERSION
rm -r $out/lib
'';
inherit (srcMeta) cargoSha256;
};
in symlinkJoin {
name = "tsc-${version}";
paths = [ tsc tsc-dyn ];
passthru = {
updateScript = let
pythonEnv = python3.withPackages(ps: [ ps.requests ]);
in writeScript "tsc-update" ''
#!${runtimeShell}
set -euo pipefail
export PATH=${lib.makeBinPath [
nix-prefetch-github
nix
pythonEnv
]}:$PATH
exec python3 ${builtins.toString ./update.py} ${builtins.toString ./.}
'';
};
meta = {
description = "The core APIs of the Emacs binding for tree-sitter.";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ pimeys ];
};
}

View file

@ -0,0 +1,10 @@
{
"src": {
"owner": "emacs-tree-sitter",
"repo": "elisp-tree-sitter",
"rev": "909717c685ff5a2327fa2ca8fb8a25216129361c",
"sha256": "LrakDpP3ZhRQqz47dPcyoQnu5lROdaNlxGaQfQT6u+k="
},
"version": "0.18.0",
"cargoSha256": "sha256-IRCZqszBkGF8anF/kpcPOzHdOP4lAtJBAp6FS5tAOx8="
}

View file

@ -0,0 +1,122 @@
#!/usr/bin/env python3
from textwrap import dedent
from os.path import (
abspath,
dirname,
join,
)
from typing import (
Dict,
Any,
)
import subprocess
import tempfile
import json
import sys
import re
import requests
def eval_drv(nixpkgs: str, expr: str) -> Any:
expr = "\n".join(
(
"with (import %s {});" % nixpkgs,
expr,
)
)
with tempfile.NamedTemporaryFile(mode="w") as f:
f.write(dedent(expr))
f.flush()
p = subprocess.run(
["nix-instantiate", "--json", f.name], stdout=subprocess.PIPE, check=True
)
return p.stdout.decode().strip()
def get_src(tag_name: str) -> Dict[str, str]:
p = subprocess.run(
[
"nix-prefetch-github",
"--rev",
tag_name,
"--json",
"emacs-tree-sitter",
"elisp-tree-sitter",
],
stdout=subprocess.PIPE,
check=True,
)
src = json.loads(p.stdout)
fields = ["owner", "repo", "rev", "sha256"]
return {f: src[f] for f in fields}
def get_cargo_sha256(drv_path: str):
# Note: No check=True since we expect this command to fail
p = subprocess.run(["nix-store", "-r", drv_path], stderr=subprocess.PIPE)
stderr = p.stderr.decode()
lines = iter(stderr.split("\n"))
for l in lines:
if l.startswith("error: hash mismatch in fixed-output derivation"):
break
else:
raise ValueError("Did not find expected hash mismatch message")
for l in lines:
m = re.match(r"\s+got:\s+(.+)$", l)
if m:
return m.group(1)
raise ValueError("Could not extract actual sha256 hash: ", stderr)
if __name__ == "__main__":
cwd = sys.argv[1]
nixpkgs = abspath(join(cwd, "../../../../../.."))
tag_name = requests.get(
"https://api.github.com/repos/emacs-tree-sitter/elisp-tree-sitter/releases/latest"
).json()["tag_name"]
src = get_src(tag_name)
with tempfile.NamedTemporaryFile(mode="w") as f:
json.dump(src, f)
f.flush()
drv_path = eval_drv(
nixpkgs,
"""
rustPlatform.buildRustPackage {
pname = "tsc-dyn";
version = "%s";
nativeBuildInputs = [ clang ];
src = fetchFromGitHub (lib.importJSON %s);
sourceRoot = "source/core";
cargoSha256 = lib.fakeSha256;
}
"""
% (tag_name, f.name),
)
cargo_sha256 = get_cargo_sha256(drv_path)
with open(join(cwd, "src.json"), mode="w") as f:
json.dump(
{
"src": src,
"version": tag_name,
"cargoSha256": cargo_sha256,
},
f,
indent=2,
)
f.write("\n")

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$SCRIPT_DIR"
./update-from-overlay
./update-manual
git commit -m "emacs.pkgs.manualPackages: $(date --iso)" -- .

View file

@ -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

View file

@ -0,0 +1,17 @@
#!/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/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

View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$SCRIPT_DIR"
nix-build --no-out-link update-manual.nix | xargs -n 1 -P $(nproc) bash -c

View file

@ -0,0 +1,11 @@
let
pkgs = import ../../../../../. {
config.allowBroken = true;
};
inherit (pkgs) lib emacs;
inherit (lib) isDerivation hasAttr filterAttrs mapAttrs attrValues;
# Extract updateScript's from manually package emacs packages
hasScript = filterAttrs (_: v: isDerivation v && hasAttr "updateScript" v) emacs.pkgs.manualPackages;
in attrValues (mapAttrs (_: v: v.updateScript) hasScript)

View file

@ -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 "$@"

View file

@ -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))))))

View file

@ -0,0 +1,4 @@
#! /usr/bin/env nix-shell
#! nix-shell --show-trace ./emacs2nix.nix -i bash
exec nongnu-packages.sh --names $EMACS2NIX/names.nix -o nongnu-generated.nix

View file

@ -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
];
}

View file

@ -0,0 +1,27 @@
{ lib
, trivialBuild
, urweb
, cl-lib
, flycheck
}:
trivialBuild {
pname = "urweb-mode";
inherit (urweb) src version;
packageRequires = [
cl-lib
flycheck
];
postUnpack = ''
sourceRoot=$sourceRoot/src/elisp
'';
meta = {
description = "Major mode for editing Ur/Web";
inherit (urweb.meta) license homepage;
maintainers = [ lib.maintainers.sternenseemann ];
};
}

View file

@ -0,0 +1,28 @@
{ lib
, stdenv
, fetchFromGitHub
, trivialBuild
, emacs
}:
trivialBuild {
pname = "youtube-dl";
version = "0.pre+unstable=2018-10-12";
src = fetchFromGitHub {
owner = "skeeto";
repo = "youtube-dl-emacs";
rev = "af877b5bc4f01c04fccfa7d47a2c328926f20ef4";
sha256 = "sha256-Etl95rcoRACDPjcTPQqYK2L+w8OZbOrTrRT0JadMdH4=";
};
buildInputs = [ emacs ];
meta = with lib; {
description = "Emacs youtube-dl download manager";
homepage = "https://github.com/skeeto/youtube-dl-emacs";
license = licenses.unlicense;
maintainers = with maintainers; [ leungbk ];
inherit (emacs.meta) platforms;
};
}