push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,204 @@
{
channel,
pname,
version,
versionPrefix,
sha256Hash,
}:
{
android-tools,
bash,
buildFHSEnv,
coreutils,
dpkg,
e2fsprogs,
fetchurl,
findutils,
git,
gnugrep,
gnused,
gnutar,
gtk2,
glib,
gzip,
fontsConf,
fontconfig,
freetype,
libX11,
libXext,
libXi,
libXrandr,
libXrender,
libXtst,
makeFontsConf,
makeWrapper,
ncurses5,
openssl,
ps,
python3,
lib,
stdenv,
unzip,
usbutils,
which,
runCommand,
xkeyboard_config,
zip,
zlib,
makeDesktopItem,
tiling_wm ? false, # if we are using a tiling wm, need to set _JAVA_AWT_WM_NONREPARENTING in wrapper
}:
let
drvName = "${pname}-${version}";
filename = "asfp-${versionPrefix}-${version}-linux.deb";
androidStudioForPlatform = stdenv.mkDerivation {
name = "${drvName}-unwrapped";
src = fetchurl {
url = "https://dl.google.com/android/asfp/${filename}";
sha256 = sha256Hash;
};
nativeBuildInputs = [
dpkg
makeWrapper
];
installPhase = ''
cp -r ./tmp/*/ $out
wrapProgram $out/bin/studio.sh \
--set-default JAVA_HOME "$out/jbr" \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
${lib.optionalString tiling_wm "--set _JAVA_AWT_WM_NONREPARENTING 1"} \
--set FONTCONFIG_FILE ${fontsConf} \
--prefix PATH : "${
lib.makeBinPath [
# Checked in studio.sh
coreutils
findutils
gnugrep
which
gnused
# Used during setup wizard
gnutar
gzip
# Runtime stuff
git
ps
usbutils
android-tools
# For Soong sync
openssl
python3
unzip
zip
e2fsprogs
]
}" \
--prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
# Crash at startup without these
fontconfig
freetype
libXext
libXi
libXrender
libXtst
libX11
# Support multiple monitors
libXrandr
# For GTKLookAndFeel
gtk2
glib
# For Soong sync
e2fsprogs
]
}"
'';
};
desktopItem = makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
desktopName = "Android Studio for Platform (${channel} channel)";
comment = "The official Android IDE for Android platform development";
categories = [
"Development"
"IDE"
];
startupNotify = true;
startupWMClass = "jetbrains-studio";
};
# Android Studio for Platform downloads prebuilt binaries as part of the SDK. These tools
# (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS
# environment is used as a work around for that.
fhsEnv = buildFHSEnv {
pname = "${drvName}-fhs-env";
inherit version;
multiPkgs = pkgs: [
zlib
ncurses5
ncurses5.dev
];
profile = ''
export ALLOW_NINJA_ENV=true
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib32
'';
};
in
runCommand drvName
{
startScript = ''
#!${bash}/bin/bash
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudioForPlatform}/bin/studio.sh "$@"
'';
preferLocalBuild = true;
allowSubstitutes = false;
passthru = {
unwrapped = androidStudioForPlatform;
};
meta = with lib; {
description = "Official IDE for Android platform development";
longDescription = ''
Android Studio for Platform (ASfP) is the version of the Android Studio IDE
for Android Open Source Project (AOSP) platform developers who build with the Soong build system.
'';
homepage = "https://developer.android.com/studio/platform.html";
license = with licenses; [
asl20
unfree
]; # The code is under Apache-2.0, but:
# If one selects Help -> Licenses in Android Studio, the dialog shows the following:
# "Android Studio includes proprietary code subject to separate license,
# including JetBrains CLion(R) (www.jetbrains.com/clion) and IntelliJ(R)
# IDEA Community Edition (www.jetbrains.com/idea)."
# Also: For actual development the Android SDK is required and the Google
# binaries are also distributed as proprietary software (unlike the
# source-code itself).
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ robbins ];
teams = [ teams.android ];
mainProgram = pname;
};
}
''
mkdir -p $out/{bin,share/pixmaps}
echo -n "$startScript" > $out/bin/${pname}
chmod +x $out/bin/${pname}
ln -s ${androidStudioForPlatform}/bin/studio.png $out/share/pixmaps/${pname}.png
ln -s ${desktopItem}/share/applications $out/share/applications
''

View File

@@ -0,0 +1,48 @@
{
callPackage,
makeFontsConf,
buildFHSEnv,
tiling_wm ? false,
}:
let
mkStudio =
opts:
callPackage (import ./common.nix opts) {
fontsConf = makeFontsConf {
fontDirectories = [ ];
};
inherit buildFHSEnv;
inherit tiling_wm;
};
stableVersion = {
version = "2024.2.2.13";
# this seems to be a fuckup on google's side
versionPrefix = "Ladybug%20Feature%20Drop";
sha256Hash = "sha256-yMUTWOpYHa/Aizrgvs/mbofrDqrbL5bJYjuklIdyU/0=";
};
canaryVersion = {
version = "2024.3.1.9";
versionPrefix = "canary-meerkat";
sha256Hash = "sha256-j5KEwHbc+0eFi3GZlD5PMuM/RWw2MJ1PaXZrPMvhCik=";
};
in
{
# Attributes are named by their corresponding release channels
stable = mkStudio (
stableVersion
// {
channel = "stable";
pname = "android-studio-for-platform";
}
);
canary = mkStudio (
canaryVersion
// {
channel = "canary";
pname = "android-studio-for-platform-canary";
}
);
}

View File

@@ -0,0 +1,362 @@
{
channel,
pname,
version,
sha256Hash,
}:
{
alsa-lib,
runtimeShell,
buildFHSEnv,
cacert,
coreutils,
dbus,
e2fsprogs,
expat,
fetchurl,
findutils,
file,
fontsConf,
git,
gnugrep,
gnused,
gnutar,
gtk2,
glib,
gzip,
fontconfig,
freetype,
libbsd,
libpulseaudio,
libGL,
libdrm,
libpng,
libuuid,
libsecret,
libX11,
libxcb,
libxkbcommon,
mesa-demos,
xcbutilwm,
xcbutilrenderutil,
xcbutilkeysyms,
xcbutilimage,
xcbutilcursor,
libxkbfile,
libXcomposite,
libXcursor,
libXdamage,
libXext,
libXfixes,
libXi,
libXrandr,
libXrender,
libXtst,
makeWrapper,
ncurses5,
nspr,
nss_latest,
pciutils,
pkgsi686Linux,
ps,
setxkbmap,
lib,
stdenv,
systemd,
unzip,
usbutils,
which,
runCommand,
wayland,
xkeyboard_config,
xorg,
zlib,
makeDesktopItem,
tiling_wm, # if we are using a tiling wm, need to set _JAVA_AWT_WM_NONREPARENTING in wrapper
androidenv,
forceWayland ? false,
}:
let
drvName = "android-studio-${channel}-${version}";
filename = "android-studio-${version}-linux.tar.gz";
androidStudio = stdenv.mkDerivation {
name = "${drvName}-unwrapped";
src = fetchurl {
url = "https://dl.google.com/dl/android/studio/ide-zips/${version}/${filename}";
sha256 = sha256Hash;
};
nativeBuildInputs = [
unzip
makeWrapper
];
# Causes the shebangs in interpreter scripts deployed to mobile devices to be patched, which Android does not understand
dontPatchShebangs = true;
installPhase = ''
cp -r . $out
wrapProgram $out/bin/studio \
--set-default JAVA_HOME "$out/jbr" \
--set ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
${lib.optionalString tiling_wm "--set _JAVA_AWT_WM_NONREPARENTING 1"} \
--set FONTCONFIG_FILE ${fontsConf} \
--prefix PATH : "${
lib.makeBinPath [
# Checked in studio.sh
coreutils
findutils
gnugrep
which
gnused
# For Android emulator
file
mesa-demos
pciutils
setxkbmap
# Used during setup wizard
gnutar
gzip
# Runtime stuff
git
ps
usbutils
libsecret
]
}" \
--prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
# Crash at startup without these
fontconfig
freetype
libXext
libXi
libXrender
libXtst
libsecret
# No crash, but attempted to load at startup
e2fsprogs
# Gradle wants libstdc++.so.6
(lib.getLib stdenv.cc.cc)
# mksdcard wants 32 bit libstdc++.so.6
pkgsi686Linux.stdenv.cc.cc.lib
# aapt wants libz.so.1
zlib
pkgsi686Linux.zlib
# Support multiple monitors
libXrandr
# For Android emulator
alsa-lib
dbus
expat
libbsd
libpulseaudio
libuuid
libX11
libxcb
libxkbcommon
xcbutilwm
xcbutilrenderutil
xcbutilkeysyms
xcbutilimage
xcbutilcursor
xorg.libICE
xorg.libSM
libxkbfile
libXcomposite
libXcursor
libXdamage
libXfixes
libGL
libdrm
libpng
nspr
nss_latest
systemd
# For GTKLookAndFeel
gtk2
glib
# For wayland support
wayland
]
}" \
${lib.optionalString forceWayland "--add-flags -Dawt.toolkit.name=WLToolkit"}
# AS launches LLDBFrontend with a custom LD_LIBRARY_PATH
wrapProgram $(find $out -name LLDBFrontend) --prefix LD_LIBRARY_PATH : "${
lib.makeLibraryPath [
ncurses5
zlib
]
}"
'';
meta.mainProgram = "studio";
};
desktopItem = makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
desktopName = "Android Studio (${channel} channel)";
comment = "The official Android IDE";
categories = [
"Development"
"IDE"
];
startupNotify = true;
startupWMClass = "jetbrains-studio";
};
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
# (e.g. `mksdcard`) have `/lib/ld-linux.so.2` set as the interpreter. An FHS
# environment is used as a work around for that.
fhsEnv = buildFHSEnv {
pname = "${drvName}-fhs-env";
inherit version;
multiPkgs = pkgs: [
ncurses5
# Flutter can only search for certs Fedora-way.
(runCommand "fedoracert" { } ''
mkdir -p $out/etc/pki/tls/
ln -s ${cacert}/etc/ssl/certs $out/etc/pki/tls/certs
'')
];
};
mkAndroidStudioWrapper =
{
androidStudio,
androidSdk ? null,
}:
runCommand drvName
{
startScript =
let
hasAndroidSdk = androidSdk != null;
androidSdkRoot = lib.optionalString hasAndroidSdk "${androidSdk}/libexec/android-sdk";
in
''
#!${runtimeShell}
${lib.optionalString hasAndroidSdk ''
echo "=== nixpkgs Android Studio wrapper" >&2
# Default ANDROID_SDK_ROOT to the packaged one, if not provided.
ANDROID_SDK_ROOT="''${ANDROID_SDK_ROOT-${androidSdkRoot}}"
if [ -d "$ANDROID_SDK_ROOT" ]; then
export ANDROID_SDK_ROOT
# Legacy compatibility.
export ANDROID_HOME="$ANDROID_SDK_ROOT"
echo " - ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >&2
# See if we can export ANDROID_NDK_ROOT too.
ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk-bundle"
if [ ! -d "$ANDROID_NDK_ROOT" ]; then
ANDROID_NDK_ROOT="$(ls "$ANDROID_SDK_ROOT/ndk/"* 2>/dev/null | head -n1)"
fi
if [ -d "$ANDROID_NDK_ROOT" ]; then
export ANDROID_NDK_ROOT
echo " - ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" >&2
else
unset ANDROID_NDK_ROOT
fi
else
unset ANDROID_SDK_ROOT
unset ANDROID_HOME
fi
''}
exec ${fhsEnv}/bin/${drvName}-fhs-env ${lib.getExe androidStudio} "$@"
'';
preferLocalBuild = true;
allowSubstitutes = false;
passthru =
let
withSdk = androidSdk: mkAndroidStudioWrapper { inherit androidStudio androidSdk; };
in
{
inherit version;
unwrapped = androidStudio;
full = withSdk androidenv.androidPkgs.androidsdk;
inherit withSdk;
sdk = androidSdk;
updateScript = [
./update.sh
"${channel}"
];
};
meta = {
description = "Official IDE for Android (${channel} channel)";
longDescription = ''
Android Studio is the official IDE for Android app development, based on
IntelliJ IDEA.
'';
homepage =
if channel == "stable" then
"https://developer.android.com/studio/index.html"
else
"https://developer.android.com/studio/preview/index.html";
license = with lib.licenses; [
asl20
unfree
]; # The code is under Apache-2.0, but:
# If one selects Help -> Licenses in Android Studio, the dialog shows the following:
# "Android Studio includes proprietary code subject to separate license,
# including JetBrains CLion(R) (www.jetbrains.com/clion) and IntelliJ(R)
# IDEA Community Edition (www.jetbrains.com/idea)."
# Also: For actual development the Android SDK is required and the Google
# binaries are also distributed as proprietary software (unlike the
# source-code itself).
platforms = [ "x86_64-linux" ];
maintainers =
rec {
stable = with lib.maintainers; [
alapshin
];
beta = stable;
canary = stable;
dev = stable;
}
."${channel}";
teams =
rec {
stable = with lib.teams; [
android
];
beta = stable;
canary = stable;
dev = stable;
}
."${channel}";
mainProgram = pname;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}
''
mkdir -p $out/{bin,share/pixmaps}
echo -n "$startScript" > $out/bin/${pname}
chmod +x $out/bin/${pname}
ln -s ${androidStudio}/bin/studio.png $out/share/pixmaps/${pname}.png
ln -s ${desktopItem}/share/applications $out/share/applications
'';
in
mkAndroidStudioWrapper { inherit androidStudio; }

View File

@@ -0,0 +1,65 @@
{
callPackage,
makeFontsConf,
buildFHSEnv,
tiling_wm ? false,
}:
let
mkStudio =
opts:
callPackage (import ./common.nix opts) {
fontsConf = makeFontsConf {
fontDirectories = [ ];
};
inherit buildFHSEnv;
inherit tiling_wm;
};
stableVersion = {
version = "2025.1.3.7"; # "Android Studio Narwhal 3 Feature Drop | 2025.1.3"
sha256Hash = "sha256-pet3uTmL4pQ/FxB2qKv+IZNx540gMC7hmfOaQ8iLQpQ=";
};
betaVersion = {
version = "2025.1.4.7"; # "Android Studio Narwhal 4 Feature Drop | 2025.1.4 RC 2"
sha256Hash = "sha256-KrKUsA7wFeI7IBa9VOp+MERqWIiMnNzLFO8oF0rCiIw=";
};
latestVersion = {
version = "2025.2.1.3"; # "Android Studio Otter | 2025.2.1 Canary 3"
sha256Hash = "sha256-McgPREXfErJ6vcHPKlAC4EVf61QedMV6J643LM5N7Wg=";
};
in
{
# Attributes are named by their corresponding release channels
stable = mkStudio (
stableVersion
// {
channel = "stable";
pname = "android-studio";
}
);
beta = mkStudio (
betaVersion
// {
channel = "beta";
pname = "android-studio-beta";
}
);
dev = mkStudio (
latestVersion
// {
channel = "dev";
pname = "android-studio-dev";
}
);
canary = mkStudio (
latestVersion
// {
channel = "canary";
pname = "android-studio-canary";
}
);
}

View File

@@ -0,0 +1,68 @@
#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=./. -i bash -p jq nix-prefetch-scripts
set -euo pipefail
DEFAULT_NIX="$(realpath "./pkgs/applications/editors/android-studio/default.nix")"
RELEASES_JSON="$(curl --silent -L https://jb.gg/android-studio-releases-list.json)"
# Available channels: Release/Patch (stable), Beta, Canary
getLatest() {
local attribute="$1"
local channel="$2"
case "$channel" in
"stable") local select='.channel == "Release" or .channel == "Patch"' ;;
"beta") local select='.channel == "Beta" or .channel == "RC"' ;;
*) local select=".channel == \"${channel^}\"" ;;
esac
local result="$(echo "$RELEASES_JSON" \
| jq -r ".content.item[] | select(${select}) | [.version, .${attribute}] | join(\" \")" \
| sort --version-sort \
| cut -d' ' -f 2- \
| tail -n 1)"
if [[ -n "$result" ]]; then
echo "$result"
else
echo "could not find the latest $attribute for $channel"
exit 1
fi
}
updateChannel() {
local channel="$1"
local latestVersion="$(getLatest "version" "$channel")"
local localVersion="$(nix --extra-experimental-features nix-command eval --raw --file . androidStudioPackages."${channel}".version)"
if [[ "${latestVersion}" == "${localVersion}" ]]; then
echo "$channel is already up to date at $latestVersion"
return 0
fi
echo "updating $channel from $localVersion to $latestVersion"
local latestHash="$(nix-prefetch-url "https://dl.google.com/dl/android/studio/ide-zips/${latestVersion}/android-studio-${latestVersion}-linux.tar.gz")"
local latestSri="$(nix --extra-experimental-features nix-command hash to-sri --type sha256 "$latestHash")"
local localHash="$(nix --extra-experimental-features nix-command eval --raw --file . androidStudioPackages."${channel}".unwrapped.src.drvAttrs.outputHash)"
sed -i "s~${localHash}~${latestSri}~g" "${DEFAULT_NIX}"
# Match the formatting of default.nix: `version = "2021.3.1.14"; # "Android Studio Dolphin (2021.3.1) Beta 5"`
local versionString="${latestVersion}\"; # \"$(getLatest "name" "${channel}")\""
sed -i "s~${localVersion}.*~${versionString}~g" "${DEFAULT_NIX}"
echo "updated ${channel} to ${latestVersion}"
}
if (( $# == 0 )); then
for channel in "beta" "canary" "stable"; do
updateChannel "$channel"
done
else
while (( "$#" )); do
case "$1" in
beta|canary|stable)
updateChannel "$1" ;;
*)
echo "unknown channel: $1" && exit 1 ;;
esac
shift 1
done
fi

View File

@@ -0,0 +1,145 @@
{
stdenv,
lib,
fetchFromGitHub,
coreutils,
lazarus,
fpc,
libX11,
# GTK2/3
pango,
cairo,
glib,
atk,
gtk2,
gtk3,
gdk-pixbuf,
python3,
# Qt5
libsForQt5,
widgetset ? "qt5",
# See https://github.com/Alexey-T/CudaText-lexers
additionalLexers ? [ "Nix" ],
}:
assert builtins.elem widgetset [
"gtk2"
"gtk3"
"qt5"
];
let
deps = lib.mapAttrs (
name: spec:
fetchFromGitHub {
repo = name;
inherit (spec) owner rev hash;
}
) (lib.importJSON ./deps.json);
in
stdenv.mkDerivation rec {
pname = "cudatext";
version = "1.202.1";
src = fetchFromGitHub {
owner = "Alexey-T";
repo = "CudaText";
rev = version;
hash = "sha256-ZFMO986D4RtrTnLFdcL0a2BNjcsB+9pIolylblku7j4=";
};
patches = [ ./proc_globdata.patch ];
postPatch = ''
substituteInPlace app/proc_globdata.pas \
--subst-var out \
--subst-var-by python3 ${python3}
substituteInPlace app/proc_editor_saving.pas \
--replace-fail '/bin/cp' "${coreutils}/bin/cp"
'';
nativeBuildInputs = [
lazarus
fpc
]
++ lib.optional (widgetset == "qt5") libsForQt5.wrapQtAppsHook;
buildInputs = [
libX11
]
++ lib.optionals (lib.hasPrefix "gtk" widgetset) [
pango
cairo
glib
atk
gdk-pixbuf
]
++ lib.optional (widgetset == "gtk2") gtk2
++ lib.optional (widgetset == "gtk3") gtk3
++ lib.optional (widgetset == "qt5") libsForQt5.libqtpas;
NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}";
buildPhase =
lib.concatStringsSep "\n" (
lib.mapAttrsToList (name: dep: ''
cp -r ${dep} ${name}
'') deps
)
+ ''
# See https://wiki.freepascal.org/CudaText#How_to_compile_CudaText
substituteInPlace ATSynEdit/atsynedit/atsynedit_package.lpk \
--replace GTK2_IME_CODE _GTK2_IME_CODE
lazbuild --lazarusdir=${lazarus}/share/lazarus --pcp=./lazarus --ws=${widgetset} \
bgrabitmap/bgrabitmap/bgrabitmappack.lpk \
EncConv/encconv/encconv_package.lpk \
ATBinHex-Lazarus/atbinhex/atbinhex_package.lpk \
ATFlatControls/atflatcontrols/atflatcontrols_package.lpk \
ATSynEdit/atsynedit/atsynedit_package.lpk \
ATSynEdit_Cmp/atsynedit_cmp/atsynedit_cmp_package.lpk \
EControl/econtrol/econtrol_package.lpk \
ATSynEdit_Ex/atsynedit_ex/atsynedit_ex_package.lpk \
Python-for-Lazarus/python4lazarus/python4lazarus_package.lpk \
Emmet-Pascal/emmet/emmet_package.lpk \
app/cudatext.lpi
'';
installPhase = ''
install -Dm755 app/cudatext -t $out/bin
install -dm755 $out/share/cudatext
cp -r app/{data,py,settings_default} $out/share/cudatext
install -Dm644 setup/debfiles/cudatext-512.png -t $out/share/pixmaps
install -Dm644 setup/debfiles/cudatext.desktop -t $out/share/applications
''
+ lib.concatMapStringsSep "\n" (lexer: ''
if [ -d "CudaText-lexers/${lexer}" ]; then
install -Dm644 CudaText-lexers/${lexer}/*.{cuda-lexmap,lcf} $out/share/cudatext/data/lexlib
else
echo "${lexer} lexer not found"
exit 1
fi
'') additionalLexers;
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "Cross-platform code editor";
longDescription = ''
Text/code editor with lite UI. Syntax highlighting for 200+ languages.
Config system in JSON files. Multi-carets and multi-selections.
Search and replace with RegEx. Extendable by Python plugins and themes.
'';
homepage = "https://cudatext.github.io/";
changelog = "https://cudatext.github.io/history.txt";
license = licenses.mpl20;
maintainers = with maintainers; [ sikmir ];
platforms = platforms.linux;
mainProgram = "cudatext";
};
}

View File

@@ -0,0 +1,57 @@
{
"EncConv": {
"owner": "Alexey-T",
"rev": "2023.04.16",
"hash": "sha256-6KaYv4OO6Ctk+vgow67LKGkbEEd1+lFJ9B1wSk4m3pc="
},
"ATBinHex-Lazarus": {
"owner": "Alexey-T",
"rev": "2023.08.12",
"hash": "sha256-dEwz052aYcJtKpRcP8t7gE2RHuHPQ4T0zHFMv6zVZ6g="
},
"ATFlatControls": {
"owner": "Alexey-T",
"rev": "2023.10.30",
"hash": "sha256-fuTQnnuWjIsABx457y+n6luLxQf+b9TiZGLXYjNsUrw="
},
"ATSynEdit": {
"owner": "Alexey-T",
"rev": "2023.11.23",
"hash": "sha256-LGYGCxEPdZL4BU3TGiFxydu7AN8g5kqOdW+dcbiCf7E="
},
"ATSynEdit_Cmp": {
"owner": "Alexey-T",
"rev": "2023.05.31",
"hash": "sha256-QXu/p3o0RSwMyntFYrjIQBtOBGvL9rAsINaglG3fZvo="
},
"EControl": {
"owner": "Alexey-T",
"rev": "2023.11.16",
"hash": "sha256-FxUV+K9JRsdr0xqQzvg1UI4bBHyhqxiVoPN58h2+WVg="
},
"ATSynEdit_Ex": {
"owner": "Alexey-T",
"rev": "2023.11.23",
"hash": "sha256-RNXP8O3UF+hwA3TNzLorZqlt04Idnc4Z9LA87JJSsZE="
},
"Python-for-Lazarus": {
"owner": "Alexey-T",
"rev": "2023.06.30",
"hash": "sha256-mO8/RNJjy9KtFuDUmV2Y8Ff+Jjm9yRd7GSrI6mOONUc="
},
"Emmet-Pascal": {
"owner": "Alexey-T",
"rev": "2023.08.12",
"hash": "sha256-s9ZKrL+XIWIwejnLz+uuyDbbDuOZLJhiuiMChKB4Reg="
},
"CudaText-lexers": {
"owner": "Alexey-T",
"rev": "2021.07.09",
"hash": "sha256-OyC85mTMi9m5kbtx8TAK2V4voL1i+J+TFoLVwxlHiD4="
},
"bgrabitmap": {
"owner": "bgrabitmap",
"rev": "v11.5.6",
"hash": "sha256-7TuHCCaH8/RxiVQmDILPW4T6op/XW6djwA5iSh/Yb5w="
}
}

View File

@@ -0,0 +1,30 @@
diff --git i/app/proc_globdata.pas w/app/proc_globdata.pas
index d161b09c7..0fcfbdc09 100644
--- i/app/proc_globdata.pas
+++ w/app/proc_globdata.pas
@@ -1342,6 +1342,7 @@ begin
{$ifdef unix}
for Dir in [
+ '@python3@/lib',
'/usr/lib64',
'/usr/lib',
'/usr/lib/x86_64-linux-gnu'
@@ -1364,7 +1365,7 @@ var
function GetDirPrecopy: string;
begin
{$ifdef linux}
- exit('/usr/share/cudatext');
+ exit('@out@/share/cudatext');
{$endif}
{$ifdef darwin}
@@ -2056,7 +2057,7 @@ begin
FindWrapAtEdge_Delay:= 350;
FindWrapAtEdge_ThemeItem:= ''; //'EdMarkedRangeBg';
- AllowProgramUpdates:= true;
+ AllowProgramUpdates:= false;
EscapeClose:= false;
EscapeCloseConsole:= true;
EscapeCloseFinder:= true;

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl gnused jq nix-prefetch moreutils
set -euo pipefail
cd "$(dirname "$0")"
nixpkgs="$(git rev-parse --show-toplevel)"
oldVersion=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).cudatext.version" | tr -d '"')
version=$(curl -s https://api.github.com/repos/Alexey-T/CudaText/releases/latest | jq -r '.tag_name')
if [[ $version == $oldVersion ]]; then
echo "Already at latest version $version"
exit 0
fi
echo "New version: $version"
url="https://github.com/Alexey-T/CudaText/archive/refs/tags/${version}.tar.gz"
hash=$(nix-prefetch-url --quiet --unpack --type sha256 $url)
sriHash=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $hash)
sed -i "s#version = \".*\"#version = \"$version\"#" default.nix
sed -i "s#hash = \".*\"#hash = \"$sriHash\"#" default.nix
while IFS=$'\t' read repo owner rev; do
latest=$(curl -s https://api.github.com/repos/${owner}/${repo}/releases/latest | jq -r '.tag_name')
if [ "$latest" != "$rev" ]; then
url="https://github.com/${owner}/${repo}/archive/refs/tags/${latest}.tar.gz"
hash=$(nix-prefetch-url --quiet --unpack --type sha256 $url)
sriHash=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $hash)
jq ".\"${repo}\".rev = \"${latest}\" | .\"${repo}\".hash = \"${sriHash}\"" deps.json | sponge deps.json
fi
done <<< $(jq -r 'to_entries[]|[.key,.value.owner,.value.rev]|@tsv' deps.json)

View File

@@ -0,0 +1,127 @@
{
lib,
stdenv,
makeDesktopItem,
freetype,
fontconfig,
libX11,
libXrender,
zlib,
jdk,
glib,
glib-networking,
gtk,
libXtst,
libsecret,
gsettings-desktop-schemas,
webkitgtk_4_1,
makeWrapper,
perl,
...
}:
{
pname,
src ? builtins.getAttr stdenv.hostPlatform.system sources,
sources ? null,
description,
version,
}:
stdenv.mkDerivation rec {
inherit pname version src;
desktopItem = makeDesktopItem {
name = "Eclipse";
exec = "eclipse";
icon = "eclipse";
comment = "Integrated Development Environment";
desktopName = "Eclipse IDE";
genericName = "Integrated Development Environment";
categories = [ "Development" ];
};
nativeBuildInputs = [
makeWrapper
perl
];
buildInputs = [
fontconfig
freetype
glib
gsettings-desktop-schemas
gtk
jdk
libX11
libXrender
libXtst
libsecret
zlib
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1;
buildCommand = ''
# Unpack tarball.
mkdir -p $out
tar xfvz $src -C $out
# Patch binaries.
interpreter="$(cat $NIX_BINTOOLS/nix-support/dynamic-linker)"
libCairo=$out/eclipse/libcairo-swt.so
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
[ -f $libCairo ] && patchelf --set-rpath ${
lib.makeLibraryPath [
freetype
fontconfig
libX11
libXrender
zlib
]
} $libCairo
# Create wrapper script. Pass -configuration to store
# settings in ~/.eclipse/org.eclipse.platform_<version> rather
# than ~/.eclipse/org.eclipse.platform_<version>_<number>.
productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct)
makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${
lib.makeLibraryPath (
[
glib
gtk
libXtst
libsecret
]
++ lib.optional (webkitgtk_4_1 != null) webkitgtk_4_1
)
} \
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--add-flags "-configuration \$HOME/.eclipse/''${productId}_${version}/configuration"
# Create desktop item.
mkdir -p $out/share/applications
cp ${desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm
# ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix
perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin.*\n||' $out/eclipse/eclipse.ini
''; # */
passthru.updateScript = ./update.sh;
meta = {
homepage = "https://www.eclipse.org/";
inherit description;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = [ lib.maintainers.jerith666 ];
};
}

View File

@@ -0,0 +1,153 @@
{
lib,
stdenv,
fetchurl,
makeDesktopItem,
makeWrapper,
freetype,
fontconfig,
libX11,
libXrender,
zlib,
glib,
gtk3,
gtk2,
libXtst,
jdk,
jdk8,
gsettings-desktop-schemas,
webkitgtk_4_1 ? null, # for internal web browser
buildEnv,
runCommand,
callPackage,
}:
# use ./update.sh to help with updating for each quarterly release
#
# then, to test:
# for e in cpp dsl embedcpp modeling platform sdk java jee committers rcp; do for s in pkgs pkgsCross.aarch64-multiplatform; do echo; echo $s $e; nix-build -A ${s}.eclipses.eclipse-${e} -o eclipse-${s}-${e}; done; done
let
eclipses = lib.trivial.importJSON ./eclipses.json;
inherit (eclipses)
platform_major
platform_minor
year
# release month sometimes differs from build month
month
buildmonth
dayHourMinute
;
timestamp = "${year}${buildmonth}${dayHourMinute}";
gtk = gtk3;
arch =
if stdenv.hostPlatform.isx86_64 then
"x86_64"
else if stdenv.hostPlatform.isAarch64 then
"aarch64"
else
throw "don't know what platform suffix for ${stdenv.hostPlatform.system} will be";
# work around https://bugs.eclipse.org/bugs/show_bug.cgi?id=476075#c3
buildEclipseUnversioned = callPackage ./build-eclipse.nix {
inherit
stdenv
makeDesktopItem
freetype
fontconfig
libX11
libXrender
zlib
jdk
glib
gtk
libXtst
gsettings-desktop-schemas
webkitgtk_4_1
makeWrapper
;
};
buildEclipse =
eclipseData:
buildEclipseUnversioned (eclipseData // { version = "${platform_major}.${platform_minor}"; });
generateEclipse =
id:
{
description,
hashes,
dropUrl,
}:
builtins.listToAttrs [
{
name = "eclipse-${lib.strings.toLower id}";
value = buildEclipse {
pname = "eclipse-${lib.strings.toLower id}";
inherit description;
src = fetchurl {
url =
if dropUrl then
"https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz"
else
"https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
hash = hashes.${arch};
};
};
}
];
generatedEclipses = lib.attrsets.concatMapAttrs generateEclipse eclipses.eclipses;
in
generatedEclipses
// {
# expose this function so users can build their own eclipses if needed
inherit buildEclipse;
### Environments
# Function that assembles a complete Eclipse environment from an
# Eclipse package and list of Eclipse plugins.
eclipseWithPlugins =
{
eclipse,
plugins ? [ ],
jvmArgs ? [ ],
}:
let
# Gather up the desired plugins.
pluginEnv = buildEnv {
name = "eclipse-plugins";
paths = lib.filter (x: x ? isEclipsePlugin) (lib.closePropagation plugins);
};
# Prepare the JVM arguments to add to the ini file. We here also
# add the property indicating the plugin directory.
dropinPropName = "org.eclipse.equinox.p2.reconciler.dropins.directory";
dropinProp = "-D${dropinPropName}=${pluginEnv}/eclipse/dropins";
jvmArgsText = lib.concatStringsSep "\n" (jvmArgs ++ [ dropinProp ]);
# Base the derivation name on the name of the underlying
# Eclipse.
name = (lib.meta.appendToName "with-plugins" eclipse).name;
in
runCommand name { nativeBuildInputs = [ makeWrapper ]; } ''
mkdir -p $out/bin $out/etc
# Prepare an eclipse.ini with the plugin directory.
cat ${eclipse}/eclipse/eclipse.ini - > $out/etc/eclipse.ini <<EOF
${jvmArgsText}
EOF
makeWrapper ${eclipse}/bin/eclipse $out/bin/eclipse \
--add-flags "--launcher.ini $out/etc/eclipse.ini"
ln -s ${eclipse}/share $out/
'';
### Plugins
plugins = callPackage ./plugins.nix { };
}

View File

@@ -0,0 +1,91 @@
{
"platform_major": "4",
"platform_minor": "37",
"version": "4.37",
"year": "2025",
"month": "09",
"buildmonth": "09",
"dayHourMinute": "050730",
"eclipses": {
"cpp": {
"description": "Eclipse IDE for C/C++ Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-La+sX7ouIfvgbXPNIlmkpDzwwiT5VJfkl4ma4eFKjqw=",
"aarch64": "sha256-U1kFulGX7apNrlY3WPeu/FqQqu3SoxfsHHErbAscFtE="
}
},
"dsl": {
"description": "Eclipse IDE for Java and DSL Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-8zXSMxKKTPnL8rqW7YT+6Gtud1pyHFmcLKOSihJWjCA=",
"aarch64": "sha256-7nsn3iWBp9N/mdcpyPH7j5tfV+sL/jCTuhvpDHmKx8I="
}
},
"embedcpp": {
"description": "Eclipse IDE for Embedded C/C++ Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-48cEpt11ndShjxUCQDX2ObI+cx9frGloJ7EICjmErC8=",
"aarch64": "sha256-zSMDR+Y4JIdu+PoYFyk+FPNKcYbRiika2TeGg3g88pg="
}
},
"modeling": {
"description": "Eclipse Modeling Tools",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-9Qq5ziLa2vjX6bJjZ67qwF4nVNdqTQ80kz9GANtJCIw=",
"aarch64": "sha256-6//g6G3U1fC5mGgOci6Zgxx3YTJEZQ2pMBVjbJ9/mPE="
}
},
"platform": {
"description": "Eclipse Platform ${year}-${month}",
"dropUrl": true,
"hashes": {
"x86_64": "sha256-C8P9x7C0tMYFQwJiBlF5JycWvWcF71ZWsDEwXPl1K34=",
"aarch64": "sha256-8qpNqHpi1BEHQt3nkFbeLzQccPSwu0op2THyWulhnLU="
}
},
"SDK": {
"description": "Eclipse ${year}-${month} Classic",
"dropUrl": true,
"hashes": {
"x86_64": "sha256-Kx9WEpu4UbCeeKfmWV0iIyAd09xh9ffHm39dahlIlW8=",
"aarch64": "sha256-MWI2KpZQPTbw7Ro0+3Ab+nnIzbSTPGwqjhBfeu4tmE8="
}
},
"java": {
"description": "Eclipse IDE for Java Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-L5vqC+jboYQAR+CtNAEXgDACxEG0r1rlx4ruc264cUc=",
"aarch64": "sha256-xxZjwmF24CbKeK7IQXkgylFTTGIHo1Wz6FnL/EUmCaQ="
}
},
"jee": {
"description": "Eclipse IDE for Enterprise Java and Web Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-bFCbFLRtltZ/GJwAoFd3MH/FknDF6hnvX9LQHQs9eKg=",
"aarch64": "sha256-DXw/dt4Gjz0e7szjJUaKB3wsUdnNj3wCX8cVpMlYkCc="
}
},
"committers": {
"description": "Eclipse IDE for Eclipse Committers and Eclipse Platform Plugin Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-HF1RuiuDGFxwxFQrXXUcpssA4SnioTYGSjQrF0H/F2Q=",
"aarch64": "sha256-ZZ7Wy6Nua4sKPlFv/LaiM+pRrF23PEuUVK4I5rA40Sk="
}
},
"rcp": {
"description": "Eclipse IDE for RCP and RAP Developers",
"dropUrl": false,
"hashes": {
"x86_64": "sha256-jxLIw4MaLqAi+b6l6lf56cb9z7J8NBUJYbbxhv65uSc=",
"aarch64": "sha256-A+3dk2FZaXBO/pb9F/33imO0Fk6j4zszLfnDsP+znG4="
}
}
}
}

View File

@@ -0,0 +1,814 @@
{
lib,
stdenv,
fetchurl,
fetchzip,
unzip,
}:
rec {
# A primitive builder of Eclipse plugins. This function is intended
# to be used when building more advanced builders.
buildEclipsePluginBase =
{
name,
buildInputs ? [ ],
passthru ? { },
...
}@attrs:
stdenv.mkDerivation (
attrs
// {
name = "eclipse-plugin-" + name;
buildInputs = buildInputs ++ [ unzip ];
passthru = {
isEclipsePlugin = true;
}
// passthru;
}
);
# Helper for the common case where we have separate feature and
# plugin JARs.
buildEclipsePlugin =
{
name,
srcFeature,
srcPlugin ? null,
srcPlugins ? [ ],
...
}@attrs:
assert srcPlugin == null -> srcPlugins != [ ];
assert srcPlugin != null -> srcPlugins == [ ];
let
pSrcs = if (srcPlugin != null) then [ srcPlugin ] else srcPlugins;
in
buildEclipsePluginBase (
attrs
// {
srcs = [ srcFeature ] ++ pSrcs;
buildCommand = ''
dropinDir="$out/eclipse/dropins/${name}"
mkdir -p $dropinDir/features
unzip ${srcFeature} -d $dropinDir/features/
mkdir -p $dropinDir/plugins
for plugin in ${toString pSrcs}; do
cp -v $plugin $dropinDir/plugins/$(stripHash $plugin)
done
'';
}
);
# Helper for the case where the build directory has the layout of an
# Eclipse update site, that is, it contains the directories
# `features` and `plugins`. All features and plugins inside these
# directories will be installed.
buildEclipseUpdateSite =
{ name, ... }@attrs:
buildEclipsePluginBase (
attrs
// {
dontBuild = true;
doCheck = false;
installPhase = ''
dropinDir="$out/eclipse/dropins/${name}"
# Install features.
cd features
for feature in *.jar; do
featureName=''${feature%.jar}
mkdir -p $dropinDir/features/$featureName
unzip $feature -d $dropinDir/features/$featureName
done
cd ..
# Install plugins.
mkdir -p $dropinDir/plugins
# A bundle should be unpacked if the manifest matches this
# pattern.
unpackPat="Eclipse-BundleShape:\\s*dir"
cd plugins
for plugin in *.jar ; do
pluginName=''${plugin%.jar}
manifest=$(unzip -p $plugin META-INF/MANIFEST.MF)
if [[ $manifest =~ $unpackPat ]] ; then
mkdir $dropinDir/plugins/$pluginName
unzip $plugin -d $dropinDir/plugins/$pluginName
else
cp -v $plugin $dropinDir/plugins/
fi
done
cd ..
'';
}
);
acejump = buildEclipsePlugin rec {
name = "acejump-${version}";
version = "1.0.0.201610261941";
srcFeature = fetchurl {
url = "https://tobiasmelcher.github.io/acejumpeclipse/features/acejump.feature_${version}.jar";
sha256 = "1szswjxp9g70ibfbv3p8dlq1bngq7nc22kp657z9i9kp8309md2d";
};
srcPlugin = fetchurl {
url = "https://tobiasmelcher.github.io/acejumpeclipse/plugins/acejump_${version}.jar";
sha256 = "1cn64xj2bm69vnn9db2xxh6kq148v83w5nx3183mrqb59ym3v9kf";
};
meta = with lib; {
homepage = "https://github.com/tobiasmelcher/EclipseAceJump";
description = "Provides fast jumps to text based on initial letter";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.mit;
platforms = platforms.all;
};
};
ansi-econsole = buildEclipsePlugin rec {
name = "ansi-econsole-${version}";
version = "1.3.5.201612301822";
srcFeature = fetchurl {
url = "https://mihnita.github.io/ansi-econsole/install/features/net.mihai-nita.ansicon_${version}.jar";
sha256 = "086ylxpsrlpbvwv5mw7v6b44j63cwzgi8apg2mq058ydr5ak6hxs";
};
srcPlugin = fetchurl {
url = "https://mihnita.github.io/ansi-econsole/install/plugins/net.mihai-nita.ansicon.plugin_${version}.jar";
sha256 = "1j42l0xxzs89shqkyn91lb0gia10mifzy0i73c3n7gj7sv2ddbjq";
};
meta = with lib; {
homepage = "https://mihai-nita.net/java/#ePluginAEC";
description = "Adds support for ANSI escape sequences in the Eclipse console";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
};
};
antlr-runtime_4_5 = buildEclipsePluginBase rec {
name = "antlr-runtime-4.5.3";
src = fetchurl {
url = "https://www.antlr.org/download/${name}.jar";
sha256 = "0lm78i2annlczlc2cg5xvby0g1dyl0sh1y5xc2pymjlmr67a1g4k";
};
buildCommand = ''
dropinDir="$out/eclipse/dropins/"
mkdir -p $dropinDir
cp -v $src $dropinDir/${name}.jar
'';
meta = with lib; {
description = "Powerful parser generator for processing structured text or binary files";
homepage = "https://www.antlr.org/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.bsd3;
platforms = platforms.all;
};
};
antlr-runtime_4_7 = buildEclipsePluginBase rec {
name = "antlr-runtime-4.7.1";
src = fetchurl {
url = "https://www.antlr.org/download/${name}.jar";
sha256 = "07f91mjclacrvkl8a307w2abq5wcqp0gcsnh0jg90ddfpqcnsla3";
};
buildCommand = ''
dropinDir="$out/eclipse/dropins/"
mkdir -p $dropinDir
cp -v $src $dropinDir/${name}.jar
'';
meta = with lib; {
description = "Powerful parser generator for processing structured text or binary files";
homepage = "https://www.antlr.org/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.bsd3;
platforms = platforms.all;
};
};
anyedittools = buildEclipsePlugin rec {
name = "anyedit-${version}";
version = "2.7.2.202006062100";
srcFeature = fetchurl {
url = "https://github.com/iloveeclipse/plugins/blob/latest/features/AnyEditTools_${version}.jar";
sha256 = "0dwwwvz8by10f5gnws1ahmg02g6v4xbaqcwc0cydvv1h52cyb40g";
};
srcPlugin = fetchurl {
url = "https://github.com/iloveeclipse/plugins/blob/latest/plugins/de.loskutov.anyedit.AnyEditTools_${version}.jar";
sha256 = "1ip8dk92ka7bczw1bkbs3zkclmwr28ds5q1wrzh525wb70x8v6fi";
};
meta = with lib; {
homepage = "https://github.com/iloveeclipse/plugins";
description = "Adds new tools to the context menu of text-based editors";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
autodetect-encoding = buildEclipsePlugin rec {
name = "autodetect-encoding-${version}";
version = "1.8.5.201801191359";
srcFeature = fetchurl {
url = "https://github.com/cypher256/eclipse-encoding-plugin/raw/master/eclipse.encoding.updatesite.snapshot/features/eclipse.encoding.plugin.feature_${version}.jar";
sha256 = "1m8ypsc1dwz0y6yhjgxsdi9813d38jllv7javgwvcd30g042a3kx";
};
srcPlugin = fetchurl {
url = "https://github.com/cypher256/eclipse-encoding-plugin/raw/master/eclipse.encoding.updatesite.snapshot/plugins/mergedoc.encoding_${version}.jar";
sha256 = "1n2rzybfcwp3ss2qi0fhd8vm38vdwav8j837lqiqlfcnvzwsk86m";
};
meta = with lib; {
homepage = "https://github.com/cypher256/eclipse-encoding-plugin";
description = "Show file encoding and line ending for the active editor in the eclipse status bar";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
bytecode-outline = buildEclipsePlugin rec {
name = "bytecode-outline-${version}";
version = "1.0.1.202006062100";
srcFeature = fetchurl {
url = "https://github.com/iloveeclipse/plugins/blob/latest/features/org.eclipse.jdt.bcoview.feature_${version}.jar";
sha256 = "0zbcph72lgv8cb5n4phcl3qsybc5q5yviwbv8yjv4v12m4l15wpk";
};
srcPlugin = fetchurl {
url = "https://github.com/iloveeclipse/plugins/blob/latest/plugins/org.eclipse.jdt.bcoview_${version}.jar";
sha256 = "1bx860k4haqcnhy8825kn4df0pyzd680qbnvjmxfrlxrqhr66fbb";
};
meta = with lib; {
homepage = "https://github.com/iloveeclipse/plugins";
description = "Shows disassembled bytecode of current java editor or class file";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.bsd2;
platforms = platforms.all;
};
};
cdt = buildEclipseUpdateSite rec {
name = "cdt-${version}";
# find current version at https://github.com/eclipse-cdt/cdt/releases
version = "11.4.0";
src = fetchzip {
stripRoot = false;
url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/tools/cdt/releases/${lib.versions.majorMinor version}/${name}/${name}.zip";
hash = "sha256-39AoB5cKRQMFpRaOlrTEsyEKZYVqdTp1tMtlaDjjZ84=";
};
meta = with lib; {
homepage = "https://eclipse.org/cdt/";
description = "C/C++ development tooling";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
maintainers = [ maintainers.bjornfor ];
};
};
checkstyle = buildEclipseUpdateSite rec {
name = "checkstyle-${version}";
version = "8.7.0.201801131309";
src = fetchzip {
stripRoot = false;
url = "mirror://sourceforge/project/eclipse-cs/Eclipse%20Checkstyle%20Plug-in/8.7.0/net.sf.eclipsecs-updatesite_${version}.zip";
sha256 = "07fymk705x4mwq7vh2i6frsf67jql4bzrkdzhb4n74zb0g1dib60";
};
meta = with lib; {
homepage = "https://eclipse-cs.sourceforge.net/";
description = "Checkstyle integration into the Eclipse IDE";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.lgpl21;
platforms = platforms.all;
};
};
color-theme = buildEclipsePlugin rec {
name = "color-theme-${version}";
version = "1.0.0.201410260308";
srcFeature = fetchurl {
url = "https://eclipse-color-theme.github.io/update/features/com.github.eclipsecolortheme.feature_${version}.jar";
sha256 = "128b9b1cib5ff0w1114ns5mrbrhj2kcm358l4dpnma1s8gklm8g2";
};
srcPlugin = fetchurl {
url = "https://eclipse-color-theme.github.io/update/plugins/com.github.eclipsecolortheme_${version}.jar";
sha256 = "0wz61909bhqwzpqwll27ia0cn3anyp81haqx3rj1iq42cbl42h0y";
};
meta = with lib; {
homepage = "http://eclipsecolorthemes.org/";
description = "Plugin to switch color themes conveniently and without side effects";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
cup = buildEclipsePlugin rec {
name = "cup-${version}";
version = "1.1.0.201604221613";
version_ = "1.0.0.201604221613";
srcFeature = fetchurl {
url = "http://www2.in.tum.de/projects/cup/eclipse/features/CupEclipsePluginFeature_${version}.jar";
sha256 = "13nnsf0cqg02z3af6xg45rhcgiffsibxbx6h1zahjv7igvqgkyna";
};
srcPlugins = [
(fetchurl {
url = "http://www2.in.tum.de/projects/cup/eclipse/plugins/CupReferencedLibraries_${version_}.jar";
sha256 = "0kif8kivrysprva1pxzajm88gi967qf7idhb6ga2xpvsdcris91j";
})
(fetchurl {
url = "http://www2.in.tum.de/projects/cup/eclipse/plugins/de.tum.in.www2.CupPlugin_${version}.jar";
sha256 = "022phbrsny3gb8npb6sxyqqxacx138q5bd7dq3gqxh3kprx5chbl";
})
];
propagatedBuildInputs = [ zest ];
meta = with lib; {
homepage = "http://www2.cs.tum.edu/projects/cup/eclipse.php";
description = "IDE for developing CUP based parsers";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
platforms = platforms.all;
maintainers = [ maintainers.romildo ];
};
};
drools = buildEclipseUpdateSite rec {
name = "drools-${version}";
version = "7.17.0.Final";
src = fetchzip {
url = "https://download.jboss.org/drools/release/${version}/droolsjbpm-tools-distribution-${version}.zip";
hash = "sha512-dWTS72R2VRgGnG6JafMwZ+wd+1e13pil0SAz2HDMXUmtgYa9iLLtma3SjcDJeWdOoblzWHRu7Ihblx3+Ogb2sQ==";
postFetch = ''
# update site is a couple levels deep, alongside some other irrelevant stuff
cd $out;
find . -type f -not -path ./binaries/org.drools.updatesite/\* -exec rm {} \;
rmdir sources;
mv binaries/org.drools.updatesite/* .;
rmdir binaries/org.drools.updatesite binaries;
'';
};
meta = with lib; {
homepage = "https://www.drools.org/";
description = "Drools is a Business Rules Management System (BRMS) solution";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
};
};
eclemma = buildEclipseUpdateSite rec {
name = "eclemma-${version}";
version = "2.3.2.201409141915";
src = fetchzip {
stripRoot = false;
url = "mirror://sourceforge/project/eclemma/01_EclEmma_Releases/2.3.2/eclemma-2.3.2.zip";
sha256 = "0w1kwcjh45p7msv5vpc8i6dsqwrnfmjama6vavpnxlji56jd3c43";
};
meta = with lib; {
homepage = "https://www.eclemma.org/";
description = "EclEmma is a free Java code coverage tool for Eclipse";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
findbugs = buildEclipsePlugin rec {
name = "findbugs-${version}";
version = "3.0.1.20150306-5afe4d1";
srcFeature = fetchurl {
url = "http://findbugs.cs.umd.edu/eclipse/features/edu.umd.cs.findbugs.plugin.eclipse_${version}.jar";
sha256 = "1m9fav2xlb9wrx2d00lpnh2sy0w5yzawynxm6xhhbfdzd0vpfr9v";
};
srcPlugin = fetchurl {
url = "http://findbugs.cs.umd.edu/eclipse/plugins/edu.umd.cs.findbugs.plugin.eclipse_${version}.jar";
sha256 = "10p3mrbp9wi6jhlmmc23qv7frh605a23pqsc7w96569bsfb5wa8q";
};
meta = with lib; {
homepage = "http://findbugs.sourceforge.net/";
description = "Plugin that uses static analysis to look for bugs in Java code";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
freemarker = buildEclipseUpdateSite rec {
name = "freemarker-${version}";
version = "1.5.305";
src = fetchzip {
url = "https://github.com/ddekany/jbosstools-freemarker/releases/download/v${version}/freemarker.site-${version}.zip";
sha256 = "1qrhi300vk07gi14r445wvy0bvghbjd6c4k7q09pqpaxv6raiczn";
stripRoot = false;
};
meta = with lib; {
homepage = "https://github.com/ddekany/jbosstools-freemarker";
description = "Plugin that provides an editor for Apache FreeMarker files";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
};
embed-cdt = buildEclipseUpdateSite rec {
name = "embed-cdt-${version}";
version = "6.3.1";
src = fetchzip {
stripRoot = true;
url = "https://github.com/eclipse-embed-cdt/eclipse-plugins/archive/v${version}.zip";
sha256 = "sha256-0wHRIls48NGDQzD+wuX79Thgiax+VVYVPJw2Z6NEzsg=";
};
meta = with lib; {
homepage = "https://github.com/eclipse-embed-cdt/eclipse-plugins";
description = "Embedded C/C++ Development Tools (formerly GNU MCU/ARM Eclipse)";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl20;
platforms = platforms.all;
maintainers = [ maintainers.bjornfor ];
};
};
gnuarmeclipse = embed-cdt; # backward compat alias, added 2022-11-04
jsonedit = buildEclipsePlugin rec {
name = "jsonedit-${version}";
version = "1.1.1";
srcFeature = fetchurl {
url = "https://boothen.github.io/Json-Eclipse-Plugin/features/jsonedit-feature_${version}.jar";
sha256 = "0zkg8d8x3l5jpfxi0mz9dn62wmy4fjgpwdikj280fvsklmcw5b86";
};
srcPlugins =
let
fetch =
{ n, h }:
fetchurl {
url = "https://boothen.github.io/Json-Eclipse-Plugin/plugins/jsonedit-${n}_${version}.jar";
sha256 = h;
};
in
map fetch [
{
n = "core";
h = "0svs0aswnhl26cqw6bmw30cisx4cr50kc5njg272sy5c1dqjm1zq";
}
{
n = "editor";
h = "1q62dinrbb18aywbvii4mlr7rxa20rdsxxd6grix9y8h9776q4l5";
}
{
n = "folding";
h = "1qh4ijfb1gl9xza5ydi87v1kyima3a9sh7lncwdy1way3pdhln1y";
}
{
n = "model";
h = "1pr6k2pdfdwx8jqs7gx7wzn3gxsql3sk6lnjha8m15lv4al6d4kj";
}
{
n = "outline";
h = "1jgr2g16j3id8v367jbgd6kx6g2w636fbzmd8jvkvkh7y1jgjqxm";
}
{
n = "preferences";
h = "027fhaqa5xbil6dmhvkbpha3pgw6dpmc2im3nlliyds57mdmdb1h";
}
{
n = "text";
h = "0clywylyidrxlqs0n816nhgjmk1c3xl7sn904ki4q050amfy0wb2";
}
];
propagatedBuildInputs = [ antlr-runtime_4_7 ];
meta = with lib; {
description = "Adds support for JSON files to Eclipse";
homepage = "https://github.com/boothen/Json-Eclipse-Plugin";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
jdt-codemining = buildEclipsePlugin rec {
name = "jdt-codemining-${version}";
version = "1.0.0.201806221018";
srcFeature = fetchurl {
url = "http://oss.opensagres.fr/jdt-codemining/snapshot/features/jdt-codemining-feature_${version}.jar";
sha256 = "1vy30rsb9xifn4r1r2n84d48g6riadzli1xvhfs1mf5pkm5ljwl6";
};
srcPlugin = fetchurl {
url = "http://oss.opensagres.fr/jdt-codemining/snapshot/plugins/org.eclipse.jdt.codemining_${version}.jar";
sha256 = "0qdzlqcjcm2i4mwhmcdml0am83z1dayrcmf37ji7vmw6iwdk1xmp";
};
meta = with lib; {
homepage = "https://github.com/angelozerr/jdt-codemining";
description = "Provides JDT Java CodeMining";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
rustdt = buildEclipseUpdateSite rec {
name = "rustdt-${version}";
version = "0.6.2";
owner = "RustDT";
repo = "rustdt.github.io";
rev = "5cbe753008c40555c493092a6f4ae1ffbff0b3ce";
src = fetchzip {
stripRoot = false;
url = "https://github.com/${owner}/${repo}/archive/${rev}.zip";
sha256 = "1xfj4j27d1h4bdf2v7f78zi8lz4zkkj7s9kskmsqx5jcs2d459yp";
postFetch = ''
mv "$out/${repo}-${rev}/releases/local-repo/"* "$out/"
'';
};
meta = with lib; {
homepage = "https://github.com/RustDT";
description = "Rust development tooling";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
scala = buildEclipseUpdateSite rec {
name = "scala-${version}";
version = "4.4.1.201605041056";
src = fetchzip {
url = "http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/base-20160504-1321.zip";
sha256 = "13xgx2rwlll0l4bs0g6gyvrx5gcc0125vzn501fdj0wv2fqxn5lw";
};
meta = with lib; {
homepage = "http://scala-ide.org/";
description = "Scala IDE for Eclipse";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.bsd3;
platforms = platforms.all;
};
};
spotbugs = buildEclipseUpdateSite rec {
name = "spotbugs-${version}";
version = "3.1.11";
src = fetchzip {
stripRoot = false;
url = "https://github.com/spotbugs/spotbugs/releases/download/${version}/eclipsePlugin.zip";
sha256 = "0aanqwx3gy1arpbkqd846381hiy6272lzwhfjl94x8jhfykpqqbj";
};
meta = with lib; {
homepage = "https://spotbugs.github.io/";
description = "Plugin that uses static analysis to look for bugs in Java code";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.lgpl21;
platforms = platforms.all;
};
};
testng = buildEclipsePlugin rec {
name = "testng-${version}";
version = "6.9.13.201609291640";
srcFeature = fetchurl {
url = "http://beust.com/eclipse-old/eclipse_${version}/features/org.testng.eclipse_${version}.jar";
sha256 = "02wzcysl7ga3wnvnwp6asl8d77wgc547c5qqawixw94lw6fn1a15";
};
srcPlugin = fetchurl {
url = "http://beust.com/eclipse-old/eclipse_${version}/plugins/org.testng.eclipse_${version}.jar";
sha256 = "1j4zw6392q3q6z3pcy803k3g0p220gk1x19fs99p0rmmdz83lc8d";
};
meta = with lib; {
homepage = "https://testng.org/doc/";
description = "Eclipse plugin for the TestNG testing framework";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
};
};
vrapper = buildEclipseUpdateSite rec {
name = "vrapper-${version}";
version = "0.72.0";
owner = "vrapper";
repo = "vrapper";
date = "20170311";
src = fetchzip {
stripRoot = false;
url = "https://github.com/${owner}/${repo}/releases/download/${version}/vrapper_${version}_${date}.zip";
sha256 = "0nyirf6km97q211cxfy01kidxac20m8ba3kk9xj73ykrhsk3cxjp";
};
meta = with lib; {
homepage = "https://github.com/vrapper/vrapper";
description = "Wrapper to provide a Vim-like input scheme for moving around and editing text";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl3;
platforms = platforms.all;
maintainers = [ maintainers.stumoss ];
};
};
yedit = buildEclipsePlugin rec {
name = "yedit-${version}";
version = "1.0.20.201509041456";
srcFeature = fetchurl {
url = "http://dadacoalition.org/yedit/features/org.dadacoalition.yedit.feature_${version}-RELEASE.jar";
sha256 = "0rps73y19gwlrdr8jjrg3rhcaaagghnmri8297inxc5q2dvg0mlk";
};
srcPlugin = fetchurl {
url = "http://dadacoalition.org/yedit/plugins/org.dadacoalition.yedit_${version}-RELEASE.jar";
sha256 = "1wpyw4z28ka60z36f8m71kz1giajcm26wb9bpv18sjiqwdgx9v0z";
};
meta = with lib; {
homepage = "https://github.com/oyse/yedit";
description = "YAML editor plugin for Eclipse";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.epl10;
platforms = platforms.all;
};
};
zest = buildEclipseUpdateSite rec {
name = "zest-${version}";
version = "3.9.101";
src = fetchurl {
url = "http://archive.eclipse.org/tools/gef/downloads/drops/${version}/R201408150207/GEF-${name}.zip";
sha256 = "01scn7cmcrjcp387spjm8ifgwrwwi77ypildandbisfvhj3qqs7m";
};
meta = with lib; {
homepage = "https://www.eclipse.org/gef/zest/";
description = "Eclipse Visualization Toolkit";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
platforms = platforms.all;
maintainers = [ maintainers.romildo ];
};
};
ivyde = buildEclipsePlugin rec {
name = "ivyde-${version}";
version = "2.2.0.final-201311091524-RELEASE";
srcFeature = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivyde-${version}/features/org.apache.ivyde.feature_${version}.jar";
hash = "sha256-iKe7oOPjy6th0HmKt6NXexOHN60EDpQe1r+n6K+uoyw=";
};
srcPlugin = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivyde-${version}/plugins/org.apache.ivyde.eclipse_${version}.jar";
hash = "sha256-lhwFwdMDwCIUrQjdWfe5ZSutCIsKtZSBT6FWthUipdk=";
};
meta = with lib; {
homepage = "https://ant.apache.org/ivy/ivyde/index.html";
description = "Plugin which integrates Apache Ivy's dependency management";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
maintainers = [ maintainers.r3dl3g ];
};
};
ivyderv = buildEclipsePlugin rec {
name = "ivyderv-${version}";
version = "2.2.0.final-201311091524-RELEASE";
srcFeature = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivyde-${version}/features/org.apache.ivyde.eclipse.resolvevisualizer.feature_${version}.jar";
hash = "sha256-PSH5NtE7hN2hHoHUhVK1CLkHN7YSDdTTqBP7711X4rU=";
};
srcPlugin = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivyde-${version}/plugins/org.apache.ivyde.eclipse.resolvevisualizer_${version}.jar";
hash = "sha256-qjTvn1j7viSfzLkWnYjyS9Pj2ExqsiFGLzot3+oB0Tw=";
};
meta = with lib; {
homepage = "https://ant.apache.org/ivy/ivyde/index.html";
description = "Graph viewer of the resolved dependencies";
longDescription = ''
Apache IvyDE Resolve Visualizer is an optional dependency of Apache IvyDE since
it requires additional plugins to be installed (Zest).
'';
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
maintainers = [ maintainers.r3dl3g ];
};
};
ivy = buildEclipsePlugin rec {
name = "ivy-${version}";
version = "2.5.0.final_20191020104435";
srcFeature = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivy-${version}/features/org.apache.ivy.eclipse.ant.feature_${version}.jar";
sha256 = "de6134171a0edf569bb9b4c3a91639d469f196e86804d218adfdd60a5d7fa133";
};
srcPlugin = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivy-${version}/plugins/org.apache.ivy.eclipse.ant_${version}.jar";
sha256 = "9e8ea20480cf73d0f0f3fb032d263c7536b24fd2eef71beb7d62af4e065f9ab5";
};
meta = with lib; {
homepage = "https://ant.apache.org/ivy/index.html";
description = "Popular dependency manager focusing on flexibility and simplicity";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
maintainers = [ maintainers.r3dl3g ];
};
};
ivyant = buildEclipsePlugin rec {
name = "ivyant-${version}";
version = "2.5.0.final_20191020104435";
srcFeature = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivy-${version}/features/org.apache.ivy.eclipse.ant.feature_${version}.jar";
sha256 = "de6134171a0edf569bb9b4c3a91639d469f196e86804d218adfdd60a5d7fa133";
};
srcPlugin = fetchurl {
url = "https://downloads.apache.org/ant/ivyde/updatesite/ivy-${version}/plugins/org.apache.ivy.eclipse.ant_${version}.jar";
sha256 = "9e8ea20480cf73d0f0f3fb032d263c7536b24fd2eef71beb7d62af4e065f9ab5";
};
meta = with lib; {
homepage = "https://ant.apache.org/ivy/ivyde/index.html";
description = "Ant Tasks integrated into Eclipse's Ant runtime";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
platforms = platforms.all;
maintainers = [ maintainers.r3dl3g ];
};
};
}

View File

@@ -0,0 +1,68 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure -p curl cacert libxml2 yq nix jq
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/3c7487575d9445185249a159046cc02ff364bff8.tar.gz
# ^
# |
# nixos-unstable ~ 2023-07-06 -----------------/
set -o errexit
set -o nounset
# scrape the downloads page for release info
curl -s -o eclipse-dl.html https://download.eclipse.org/eclipse/downloads/
trap "rm eclipse-dl.html" EXIT
dlquery() {
q=$1
xmllint --html eclipse-dl.html --xmlout 2>/dev/null | xq -r ".html.body.main.div.table[3].tr[1].td[0].a${q}";
}
# extract release info from download page HTML
platform_major=$(dlquery '."#text" | split(".") | .[0]' -r);
platform_minor=$(dlquery '."#text" | split(".") | .[1]' -r);
year=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[0:4]')
buildmonth=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[4:6]')
builddaytime=$(dlquery '."@href" | split("/") | .[] | select(. | startswith("R")) | split("-") | .[2] | .[6:12]')
timestamp="${year}${buildmonth}${builddaytime}";
# account for possible release-month vs. build-month mismatches
month=$buildmonth;
case "$buildmonth" in
'02'|'04') month='03' ;;
'05'|'07') month='06' ;;
'08'|'10') month='09' ;;
'11'|'01') month='12' ;;
esac
ECLIPSES_JSON=$(dirname $0)/eclipses.json;
t=$(mktemp);
# note: including platform_major, platform_minor, and version may seem redundant
# the first two are needed for the derivation itself; the third is necessary so
# that nixpkgs-update can see that the version changes as a result of this update
# script.
cat $ECLIPSES_JSON | jq ". + {platform_major: \"${platform_major}\",platform_minor: \"${platform_minor}\",version:\"${platform_major}.${platform_minor}\",year: \"${year}\",month: \"${month}\",buildmonth: \"${buildmonth}\",dayHourMinute: \"${builddaytime}\"}" > $t;
mv $t $ECLIPSES_JSON;
# prefetch new download hashes
for id in $(cat $ECLIPSES_JSON | jq -r '.eclipses | keys | .[]'); do
for arch in x86_64 aarch64; do
if [ $(cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.dropUrl") == "true" ]; then
url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops${platform_major}/R-${platform_major}.${platform_minor}-${timestamp}/eclipse-${id}-${platform_major}.${platform_minor}-linux-gtk-${arch}.tar.gz";
else
url="https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/technology/epp/downloads/release/${year}-${month}/R/eclipse-${id}-${year}-${month}-R-linux-gtk-${arch}.tar.gz";
fi
echo "prefetching ${id} ${arch}";
h=$(nix store prefetch-file --json "$url" | jq -r .hash);
t=$(mktemp);
cat $ECLIPSES_JSON | jq -r ".eclipses.${id}.hashes.${arch} = \"${h}\"" > $t;
mv $t $ECLIPSES_JSON;
done
done

View File

@@ -0,0 +1,92 @@
# Functions to build elisp files to locally configure emacs buffers.
# See https://github.com/shlevy/nix-buffer
{
lib,
writeText,
inherit-local,
}:
rec {
withPackages =
pkgs':
let
pkgs = builtins.filter (x: x != null) pkgs';
extras = map (x: x.emacsBufferSetup pkgs) (
builtins.filter (builtins.hasAttr "emacsBufferSetup") pkgs
);
in
writeText "dir-locals.el" ''
(require 'inherit-local "${inherit-local}/share/emacs/site-lisp/elpa/inherit-local-${inherit-local.version}/inherit-local.elc")
; Only set up nixpkgs buffer handling when we have some buffers active
(defvar nixpkgs--buffer-count 0)
(when (eq nixpkgs--buffer-count 0)
(make-variable-buffer-local 'nixpkgs--is-nixpkgs-buffer)
; When generating a new temporary buffer (one whose name starts with a space), do inherit-local inheritance and make it a nixpkgs buffer
(defun nixpkgs--around-generate (orig name &optional ibh)
(if (and nixpkgs--is-nixpkgs-buffer (eq (aref name 0) ?\s))
(let ((buf (funcall orig name ibh)))
(progn
(inherit-local-inherit-child buf)
(with-current-buffer buf
(setq nixpkgs--buffer-count (1+ nixpkgs--buffer-count))
(add-hook 'kill-buffer-hook 'nixpkgs--decrement-buffer-count nil t)))
buf)
(funcall orig name ibh)))
(advice-add 'generate-new-buffer :around #'nixpkgs--around-generate)
; When we have no more nixpkgs buffers, tear down the buffer handling
(defun nixpkgs--decrement-buffer-count ()
(setq nixpkgs--buffer-count (1- nixpkgs--buffer-count))
(when (eq nixpkgs--buffer-count 0)
(advice-remove 'generate-new-buffer #'nixpkgs--around-generate)
(fmakunbound 'nixpkgs--around-generate)
(fmakunbound 'nixpkgs--decrement-buffer-count))))
(setq nixpkgs--buffer-count (1+ nixpkgs--buffer-count))
(add-hook 'kill-buffer-hook 'nixpkgs--decrement-buffer-count nil t)
; Add packages to PATH and exec-path
(make-local-variable 'process-environment)
(put 'process-environment 'permanent-local t)
(inherit-local 'process-environment)
; setenv modifies in place, so copy the environment first
(setq process-environment (copy-tree process-environment))
(setenv "PATH" (concat "${lib.makeSearchPath "bin" pkgs}:" (getenv "PATH")))
(inherit-local-permanent exec-path (append '(${
builtins.concatStringsSep " " (map (p: "\"${p}/bin\"") pkgs)
}) exec-path))
(inherit-local-permanent eshell-path-env (concat "${lib.makeSearchPath "bin" pkgs}:" (if (boundp 'eshell-path-env) eshell-path-env (getenv "PATH"))))
(setq nixpkgs--is-nixpkgs-buffer t)
(inherit-local 'nixpkgs--is-nixpkgs-buffer)
${lib.concatStringsSep "\n" extras}
'';
# nix-buffer function for a project with a bunch of haskell packages
# in one directory
haskellMonoRepo =
{
project-root, # The monorepo root
haskellPackages, # The composed haskell packages set that contains all of the packages
}:
{ root }:
let
# The haskell paths.
haskell-paths = lib.filesystem.haskellPathsInDir project-root;
# Find the haskell package that the 'root' is in, if any.
haskell-path-parent =
let
filtered = builtins.filter (
name: lib.hasPrefix (toString (project-root + "/${name}")) (toString root)
) (builtins.attrNames haskell-paths);
in
if filtered == [ ] then null else builtins.head filtered;
# We're in the directory of a haskell package
is-haskell-package = haskell-path-parent != null;
haskell-package = haskellPackages.${haskell-path-parent};
# GHC environment with all needed deps for the haskell package
haskell-package-env = builtins.head haskell-package.env.nativeBuildInputs;
in
lib.optionalAttrs is-haskell-package (withPackages [ haskell-package-env ]);
}

View File

@@ -0,0 +1,59 @@
# builder for Emacs packages built for packages.el
{
lib,
stdenv,
emacs,
texinfo,
}:
let
genericBuild = import ./generic.nix {
inherit
lib
stdenv
emacs
texinfo
;
};
in
lib.extendMkDerivation {
constructDrv = genericBuild;
extendDrvArgs =
finalAttrs:
{
pname,
dontUnpack ? true,
meta ? { },
...
}@args:
{
elpa2nix = args.elpa2nix or ./elpa2nix.el;
inherit dontUnpack;
installPhase =
args.installPhase or ''
runHook preInstall
emacs --batch -Q -l "$elpa2nix" \
-f elpa2nix-install-package \
"$src" "$out/share/emacs/site-lisp/elpa" \
${if finalAttrs.turnCompilationWarningToError then "t" else "nil"} \
${if finalAttrs.ignoreCompilationError then "t" else "nil"}
runHook postInstall
'';
meta = {
homepage = args.src.meta.homepage or "https://elpa.gnu.org/packages/${pname}.html";
}
// meta;
};
}

View File

@@ -0,0 +1,45 @@
(require 'package)
(package-initialize)
;; TODO remove this patch when Emacs bug#77143 is fixed
;; see that bug for more info
(defun package--description-file (dir)
"Return package description file name for package DIR."
(concat (let ((subdir (file-name-nondirectory
(directory-file-name dir))))
(if (string-match "\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\|snapshot\\)[0-9]+\\)*\\)\\'" subdir)
(match-string 1 subdir) subdir))
"-pkg.el"))
(defun elpa2nix-install-package ()
(if (not noninteractive)
(error "`elpa2nix-install-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,archive ,elpa ,turn-compilation-warning-to-error ,ignore-compilation-error)
(progn (setq byte-compile-error-on-warn (string= turn-compilation-warning-to-error "t"))
(setq byte-compile-debug (string= ignore-compilation-error "nil"))
(setq package-user-dir elpa)
(elpa2nix-install-file archive)))))
(defun elpa2nix-install-from-buffer ()
"Install a package from the current buffer."
(let ((pkg-desc (if (derived-mode-p 'tar-mode)
(package-tar-file-info)
(package-buffer-info))))
;; Install the package itself.
(package-unpack pkg-desc)
pkg-desc))
(defun elpa2nix-install-file (file)
"Install a package from a file.
The file can either be a tar file or an Emacs Lisp file."
(let ((is-tar (string-match "\\.tar\\'" file)))
(with-temp-buffer
(if is-tar
(insert-file-contents-literally file)
(insert-file-contents file))
(when is-tar (tar-mode))
(elpa2nix-install-from-buffer))))
;; Allow installing package tarfiles larger than 10MB
(setq large-file-warning-threshold nil)

View File

@@ -0,0 +1,110 @@
# generic builder for Emacs packages
{
lib,
stdenv,
emacs,
texinfo,
...
}:
let
inherit (lib) optionalAttrs;
in
lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
extendDrvArgs =
finalAttrs:
{
buildInputs ? [ ],
nativeBuildInputs ? [ ],
packageRequires ? [ ],
propagatedBuildInputs ? [ ],
propagatedUserEnvPkgs ? [ ],
postInstall ? "",
meta ? { },
turnCompilationWarningToError ? false,
ignoreCompilationError ? false,
...
}@args:
{
name = args.name or "emacs-${finalAttrs.pname}-${finalAttrs.version}";
unpackCmd =
args.unpackCmd or ''
case "$curSrc" in
*.el)
# keep original source filename without the hash
local filename=$(basename "$curSrc")
filename="''${filename:33}"
cp $curSrc $filename
chmod +w $filename
sourceRoot="."
;;
*)
_defaultUnpack "$curSrc"
;;
esac
'';
inherit packageRequires;
buildInputs = [ emacs ] ++ buildInputs;
nativeBuildInputs = [
emacs
texinfo
]
++ nativeBuildInputs;
propagatedBuildInputs = finalAttrs.packageRequires ++ propagatedBuildInputs;
propagatedUserEnvPkgs = finalAttrs.packageRequires ++ propagatedUserEnvPkgs;
strictDeps = args.strictDeps or true;
__structuredAttrs = args.__structuredAttrs or true;
inherit turnCompilationWarningToError ignoreCompilationError;
meta = {
broken = false;
platforms = emacs.meta.platforms;
}
// optionalAttrs ((args.src.meta.homepage or "") != "") {
homepage = args.src.meta.homepage;
}
// meta;
}
// optionalAttrs (emacs.withNativeCompilation or false) {
addEmacsNativeLoadPath = args.addEmacsNativeLoadPath or true;
postInstall = ''
# Besides adding the output directory to the native load path, make sure
# the current package's elisp files are in the load path, otherwise
# (require 'file-b) from file-a.el in the same package will fail.
mkdir -p $out/share/emacs/native-lisp
addEmacsVars "$out"
# package-activate-all is used to activate packages. In other builder
# helpers, package-initialize is used for this purpose because
# package-activate-all is not available before Emacs 27.
find $out/share/emacs -type f -name '*.el' -not -name ".dir-locals.el" -print0 \
| xargs --verbose -0 -I {} -n 1 -P $NIX_BUILD_CORES sh -c \
"emacs \
--batch \
-f package-activate-all \
--eval '(setq native-comp-eln-load-path (cdr native-comp-eln-load-path))' \
--eval '(let ((default-directory \"$out/share/emacs/site-lisp\")) (normal-top-level-add-subdirs-to-load-path))' \
--eval '(setq large-file-warning-threshold nil)' \
--eval '(setq byte-compile-error-on-warn ${
if finalAttrs.turnCompilationWarningToError then "t" else "nil"
})' \
-f batch-native-compile {} \
|| exit ${if finalAttrs.ignoreCompilationError then "0" else "\\$?"}"
''
+ postInstall;
};
}

View File

@@ -0,0 +1,202 @@
# builder for Emacs packages built for packages.el
# using MELPA package-build.el
{
lib,
stdenv,
fetchFromGitHub,
emacs,
texinfo,
}:
let
genericBuild = import ./generic.nix {
inherit
lib
stdenv
emacs
texinfo
;
};
packageBuild = stdenv.mkDerivation {
name = "package-build";
src = fetchFromGitHub {
owner = "melpa";
repo = "package-build";
rev = "d1722503145facf96631ac118ec0213a73082b76";
hash = "sha256-utsZLm9IF9UkTwxFWvJmwA3Ox4tlMeNNTo+f/CqYJGA=";
};
prePatch = ''
substituteInPlace package-build.el \
--replace-fail '(format "--mtime=@%d" time)' '"--mtime=@0"'
'';
dontConfigure = true;
dontBuild = true;
installPhase = "
mkdir -p $out
cp -r * $out
";
};
in
lib.extendMkDerivation {
constructDrv = genericBuild;
extendDrvArgs =
finalAttrs:
{
/*
pname: Nix package name without special symbols and without version or
"emacs-" prefix.
*/
pname,
/*
ename: Original Emacs package name, possibly containing special symbols.
Default: pname
*/
ename ? pname,
/*
version: Either a stable version such as "1.2" or an unstable version.
An unstable version can use either Nix format (preferred) such as
"1.2-unstable-2024-06-01" or MELPA format such as "20240601.1230".
*/
version,
/*
commit: Optional package history commit.
Default: src.rev or "unknown"
This will be written into the generated package but it is not needed during
the build process.
*/
commit ? (finalAttrs.src.rev or "unknown"),
/*
files: Optional recipe property specifying the files used to build the package.
If null, do not set it in recipe, keeping the default upstream behaviour.
Default: null
*/
files ? null,
/*
recipe: Optional MELPA recipe.
Default: a minimally functional recipe
This can be a path of a recipe file, a string of the recipe content or an empty string.
The default value is used if it is an empty string.
*/
recipe ? "",
preUnpack ? "",
postUnpack ? "",
meta ? { },
...
}@args:
{
elpa2nix = args.elpa2nix or ./elpa2nix.el;
melpa2nix = args.melpa2nix or ./melpa2nix.el;
inherit
commit
ename
files
recipe
;
packageBuild = args.packageBuild or packageBuild;
melpaVersion =
args.melpaVersion or (
let
parsed =
lib.flip builtins.match version
# match <version>-unstable-YYYY-MM-DD format
"^.*-unstable-([[:digit:]]{4})-([[:digit:]]{2})-([[:digit:]]{2})$";
unstableVersionInNixFormat = parsed != null; # heuristics
date = builtins.concatStringsSep "" parsed;
time = "0"; # unstable version in nix format lacks this info
in
if unstableVersionInNixFormat then date + "." + time else finalAttrs.version
);
preUnpack = ''
mkdir -p "$NIX_BUILD_TOP/recipes"
recipeFile="$NIX_BUILD_TOP/recipes/$ename"
if [ -r "$recipe" ]; then
ln -s "$recipe" "$recipeFile"
nixInfoLog "link recipe"
elif [ -n "$recipe" ]; then
printf "%s" "$recipe" > "$recipeFile"
nixInfoLog "write recipe"
else
cat > "$recipeFile" <<'EOF'
(${finalAttrs.ename} :fetcher git :url "" ${
lib.optionalString (finalAttrs.files != null) ":files ${finalAttrs.files}"
})
EOF
nixInfoLog "use default recipe"
fi
nixInfoLog "recipe content:" "$(< $recipeFile)"
unset -v recipeFile
ln -s "$packageBuild" "$NIX_BUILD_TOP/package-build"
mkdir -p "$NIX_BUILD_TOP/packages"
''
+ preUnpack;
postUnpack = ''
mkdir -p "$NIX_BUILD_TOP/working"
ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$ename"
''
+ postUnpack;
buildPhase =
args.buildPhase or ''
runHook preBuild
# This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase.
if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then
foundMakefile=1
fi
pushd "$NIX_BUILD_TOP"
emacs --batch -Q \
-L "$NIX_BUILD_TOP/package-build" \
-l "$melpa2nix" \
-f melpa2nix-build-package \
$ename $melpaVersion $commit
popd
runHook postBuild
'';
installPhase =
args.installPhase or ''
runHook preInstall
archive="$NIX_BUILD_TOP/packages/$ename-$melpaVersion.el"
if [ ! -f "$archive" ]; then
archive="$NIX_BUILD_TOP/packages/$ename-$melpaVersion.tar"
fi
emacs --batch -Q \
-l "$elpa2nix" \
-f elpa2nix-install-package \
"$archive" "$out/share/emacs/site-lisp/elpa" \
${if finalAttrs.turnCompilationWarningToError then "t" else "nil"} \
${if finalAttrs.ignoreCompilationError then "t" else "nil"}
runHook postInstall
'';
meta = {
homepage = args.src.meta.homepage or "https://melpa.org/#/${pname}";
}
// meta;
};
}

View File

@@ -0,0 +1,27 @@
(require 'package-recipe)
(require 'package-build)
(setq package-build-working-dir (expand-file-name "working/"))
(setq package-build-archive-dir (expand-file-name "packages/"))
(setq package-build-recipes-dir (expand-file-name "recipes/"))
;; Allow installing package tarfiles larger than 10MB
(setq large-file-warning-threshold nil)
(defun melpa2nix-build-package-1 (rcp)
(let* ((default-directory (package-recipe--working-tree rcp)))
(unwind-protect
(let ((files (package-build-expand-files-spec rcp t)))
(if files
(funcall package-build-build-function rcp files)
(error "Unable to find files matching recipe patterns"))))))
(defun melpa2nix-build-package ()
(unless noninteractive
(error "`melpa2nix-build-package' is to be used only with -batch"))
(pcase command-line-args-left
(`(,package ,version ,commit)
(let ((recipe (package-recipe-lookup package)))
(setf (oref recipe commit) commit)
(setf (oref recipe version) version)
(melpa2nix-build-package-1 recipe)))))

View File

@@ -0,0 +1,6 @@
(defmacro mk-subdirs-expr (path)
`(setq load-path
(delete-dups (append '(,path)
',(let ((default-directory path))
(normal-top-level-add-subdirs-to-load-path))
load-path))))

View File

@@ -0,0 +1,44 @@
# trivial builder for Emacs packages
{ callPackage, lib, ... }@envargs:
lib.extendMkDerivation {
constructDrv = callPackage ./generic.nix envargs;
extendDrvArgs =
finalAttrs:
args:
{
buildPhase =
args.buildPhase or ''
runHook preBuild
# This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase.
if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then
foundMakefile=1
fi
emacs -l package -f package-initialize \
--eval "(setq byte-compile-debug ${if finalAttrs.ignoreCompilationError then "nil" else "t"})" \
--eval "(setq byte-compile-error-on-warn ${
if finalAttrs.turnCompilationWarningToError then "t" else "nil"
})" \
-L . --batch -f batch-byte-compile *.el
runHook postBuild
'';
installPhase =
args.installPhase or ''
runHook preInstall
LISPDIR=$out/share/emacs/site-lisp
install -d $LISPDIR
install *.el *.elc $LISPDIR
runHook postInstall
'';
};
}

View File

@@ -0,0 +1,27 @@
{
runCommand,
emacs,
git,
}:
runCommand "test-emacs-withPackages-wrapper"
{
nativeBuildInputs = [
(emacs.pkgs.withPackages (
epkgs: with epkgs; [
magit
flx-ido
]
))
git # needed by magit
];
}
''
emacs --batch --eval="(require 'magit)"
emacs --batch --eval="(require 'flx-ido)"
# transitive dependencies should be made available
# https://github.com/NixOS/nixpkgs/issues/388829
emacs --batch --eval="(require 'flx)"
touch $out
''

View File

@@ -0,0 +1,250 @@
/*
# Usage
`emacs.pkgs.withPackages` takes a single argument: a function from a package
set to a list of packages (the packages that will be available in
Emacs). For example,
```
emacs.pkgs.withPackages (epkgs: [ epkgs.evil epkgs.magit ])
```
All the packages in the list should come from the provided package
set. It is possible to add any package to the list, but the provided
set is guaranteed to have consistent dependencies and be built with
the correct version of Emacs.
# Overriding
`emacs.pkgs.withPackages` inherits the package set which contains it, so the
correct way to override the provided package set is to override the
set which contains `emacs.pkgs.withPackages`. For example, to override
`emacs.pkgs.emacs.pkgs.withPackages`,
```
let customEmacsPackages =
emacs.pkgs.overrideScope (self: super: {
# use a custom version of emacs
emacs = ...;
# use the unstable MELPA version of magit
magit = self.melpaPackages.magit;
});
in customEmacsPackages.withPackages (epkgs: [ epkgs.evil epkgs.magit ])
```
*/
{
lib,
lndir,
makeBinaryWrapper,
runCommand,
}:
self:
let
inherit (self) emacs;
withNativeCompilation = emacs.withNativeCompilation or false;
withTreeSitter = emacs.withTreeSitter or false;
in
packagesFun: # packages explicitly requested by the user
let
explicitRequires = if lib.isFunction packagesFun then packagesFun self else packagesFun;
in
runCommand (lib.appendToName "with-packages" emacs).name
{
inherit emacs explicitRequires;
nativeBuildInputs = [
emacs
lndir
makeBinaryWrapper
];
preferLocalBuild = true;
allowSubstitutes = false;
# Store all paths we want to add to emacs here, so that we only need to add
# one path to the load lists
deps =
runCommand "emacs-packages-deps"
(
{
inherit explicitRequires lndir emacs;
}
// lib.optionalAttrs withNativeCompilation {
inherit (emacs) LIBRARY_PATH;
}
)
''
findInputsOld() {
local pkg="$1"; shift
local var="$1"; shift
local propagatedBuildInputsFiles=("$@")
# TODO(@Ericson2314): Restore using associative array once Darwin
# nix-shell doesn't use impure bash. This should replace the O(n)
# case with an O(1) hash map lookup, assuming bash is implemented
# well :D.
local varSlice="$var[*]"
# ''${..-} to hack around old bash empty array problem
case " ''${!varSlice-} " in
*" $pkg "*) return 0 ;;
esac
unset -v varSlice
eval "$var"'+=("$pkg")'
if ! [ -e "$pkg" ]; then
echo "build input $pkg does not exist" >&2
exit 1
fi
local file
for file in "''${propagatedBuildInputsFiles[@]}"; do
file="$pkg/nix-support/$file"
[[ -f "$file" ]] || continue
local pkgNext
for pkgNext in $(< "$file"); do
findInputsOld "$pkgNext" "$var" "''${propagatedBuildInputsFiles[@]}"
done
done
}
mkdir -p $out/bin
mkdir -p $out/share/emacs/site-lisp
${lib.optionalString withNativeCompilation ''
mkdir -p $out/share/emacs/native-lisp
''}
${lib.optionalString withTreeSitter ''
mkdir -p $out/lib
''}
local requires
for pkg in $explicitRequires; do
findInputsOld $pkg requires propagated-user-env-packages
done
# requires now holds all requested packages and their transitive dependencies
linkPath() {
local pkg=$1
local origin_path=$2
local dest_path=$3
# Add the path to the search path list, but only if it exists
if [[ -d "$pkg/$origin_path" ]]; then
$lndir/bin/lndir -silent "$pkg/$origin_path" "$out/$dest_path"
fi
}
linkEmacsPackage() {
linkPath "$1" "bin" "bin"
linkPath "$1" "share/emacs/site-lisp" "share/emacs/site-lisp"
${lib.optionalString withNativeCompilation ''
linkPath "$1" "share/emacs/native-lisp" "share/emacs/native-lisp"
''}
${lib.optionalString withTreeSitter ''
linkPath "$1" "lib" "lib"
''}
}
# Iterate over the array of inputs (avoiding nix's own interpolation)
for pkg in "''${requires[@]}"; do
linkEmacsPackage $pkg
done
siteStart="$out/share/emacs/site-lisp/site-start.el"
siteStartByteCompiled="$siteStart"c
subdirs="$out/share/emacs/site-lisp/subdirs.el"
subdirsByteCompiled="$subdirs"c
# A dependency may have brought the original siteStart or subdirs, delete
# it and create our own
# Begin the new site-start.el by loading the original, which sets some
# NixOS-specific paths. Paths are searched in the reverse of the order
# they are specified in, so user and system profile paths are searched last.
#
# NOTE: Avoid displaying messages early at startup by binding
# inhibit-message to t. This would prevent the Emacs GUI from showing up
# prematurely. The messages would still be logged to the *Messages*
# buffer.
rm -f $siteStart $siteStartByteCompiled $subdirs $subdirsByteCompiled
cat >"$siteStart" <<EOF
;;; -*- lexical-binding: t -*-
(let ((inhibit-message t))
(load "$emacs/share/emacs/site-lisp/site-start"))
;; "$out/share/emacs/site-lisp" is added to load-path in wrapper.sh
;; "$out/share/emacs/native-lisp" is added to native-comp-eln-load-path in wrapper.sh
(add-to-list 'exec-path "$out/bin")
${lib.optionalString withTreeSitter ''
(add-to-list 'treesit-extra-load-path "$out/lib/")
''}
EOF
# Generate a subdirs.el that statically adds all subdirectories to load-path.
cat >"$subdirs" <<EOF
;;; -*- lexical-binding: t -*-
EOF
$emacs/bin/emacs \
--batch \
--load ${./mk-wrapper-subdirs.el} \
--eval "(prin1 (macroexpand-1 '(mk-subdirs-expr \"$out/share/emacs/site-lisp\")))" \
>> "$subdirs"
# Byte-compiling improves start-up time only slightly, but costs nothing.
$emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs"
${lib.optionalString withNativeCompilation ''
$emacs/bin/emacs --batch \
--eval "(add-to-list 'native-comp-eln-load-path \"$out/share/emacs/native-lisp/\")" \
-f batch-native-compile "$siteStart" "$subdirs"
''}
'';
inherit (emacs) meta;
}
''
mkdir -p "$out/bin"
# Wrap emacs and friends so they find our site-start.el before the original.
for prog in $emacs/bin/*; do # */
local progname=$(basename "$prog")
rm -f "$out/bin/$progname"
substitute ${./wrapper.sh} $out/bin/$progname \
--subst-var-by bash ${emacs.stdenv.shell} \
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \
--subst-var-by wrapperInvocationDirectory "$out/bin/" \
--subst-var-by wrapperInvocationName "$progname" \
--subst-var prog
chmod +x $out/bin/$progname
# Create a NOP binary wrapper for the pure sake of it becoming a
# non-shebang, actual binary. See the makeBinaryWrapper docs for rationale
# (summary: it allows you to use emacs as a shebang itself on Darwin,
# e.g. #!$ {emacs}/bin/emacs --script)
wrapProgramBinary $out/bin/$progname
done
# Wrap MacOS app
# this has to pick up resources and metadata
# to recognize it as an "app"
if [ -d "$emacs/Applications/Emacs.app" ]; then
mkdir -p $out/Applications/Emacs.app/Contents/MacOS
cp -r $emacs/Applications/Emacs.app/Contents/Info.plist \
$emacs/Applications/Emacs.app/Contents/PkgInfo \
$emacs/Applications/Emacs.app/Contents/Resources \
$out/Applications/Emacs.app/Contents
substitute ${./wrapper.sh} $out/Applications/Emacs.app/Contents/MacOS/Emacs \
--subst-var-by bash ${emacs.stdenv.shell} \
--subst-var-by wrapperSiteLisp "$deps/share/emacs/site-lisp" \
--subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \
--subst-var-by wrapperInvocationDirectory "$out/Applications/Emacs.app/Contents/MacOS/" \
--subst-var-by wrapperInvocationName "Emacs" \
--subst-var-by prog "$emacs/Applications/Emacs.app/Contents/MacOS/Emacs"
chmod +x $out/Applications/Emacs.app/Contents/MacOS/Emacs
wrapProgramBinary $out/Applications/Emacs.app/Contents/MacOS/Emacs
fi
mkdir -p $out/share
# Link icons and desktop files into place
for dir in applications icons info man; do
ln -s $emacs/share/$dir $out/share/$dir
done
''

View File

@@ -0,0 +1,56 @@
#!@bash@
IFS=:
newLoadPath=()
newNativeLoadPath=()
addedNewLoadPath=
addedNewNativeLoadPath=
if [[ -n $EMACSLOADPATH ]]
then
while read -rd: entry
do
if [[ -z $entry && -z $addedNewLoadPath ]]
then
newLoadPath+=(@wrapperSiteLisp@)
addedNewLoadPath=1
fi
newLoadPath+=("$entry")
done <<< "$EMACSLOADPATH:"
else
newLoadPath+=(@wrapperSiteLisp@)
newLoadPath+=("")
fi
# NOTE: Even though we treat EMACSNATIVELOADPATH like EMACSLOADPATH in
# this wrapper, empty elements in EMACSNATIVELOADPATH have no special
# meaning for Emacs. Only non-empty elements in EMACSNATIVELOADPATH
# will be prepended to native-comp-eln-load-path.
# https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el?id=3685387e609753293c4518be75e77c659c3b2d8d#n599
if [[ -n $EMACSNATIVELOADPATH ]]
then
while read -rd: entry
do
if [[ -z $entry && -z $addedNewNativeLoadPath ]]
then
newNativeLoadPath+=(@wrapperSiteLispNative@)
addedNewNativeLoadPath=1
fi
newNativeLoadPath+=("$entry")
done <<< "$EMACSNATIVELOADPATH:"
else
newNativeLoadPath+=(@wrapperSiteLispNative@)
newNativeLoadPath+=("")
fi
export EMACSLOADPATH="${newLoadPath[*]}"
export emacsWithPackages_siteLisp=@wrapperSiteLisp@
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
export emacsWithPackages_invocationDirectory=@wrapperInvocationDirectory@
export emacsWithPackages_invocationName=@wrapperInvocationName@
exec @prog@ "$@"

View File

@@ -0,0 +1,41 @@
{ lib, pkgs }:
lib.makeScope pkgs.newScope (
self:
let
inherit (self) callPackage;
inheritedArgs = {
inherit (pkgs.darwin) sigtool;
};
in
{
sources = import ./sources.nix {
inherit lib;
inherit (pkgs)
fetchFromGitHub
fetchzip
;
};
emacs30 = callPackage (self.sources.emacs30) inheritedArgs;
emacs30-gtk3 = self.emacs30.override {
withGTK3 = true;
};
emacs30-nox = self.emacs30.override {
noGui = true;
};
emacs30-pgtk = self.emacs30.override {
withPgtk = true;
};
emacs30-macport = callPackage (self.sources.emacs30-macport) (
inheritedArgs
// {
srcRepo = true;
}
);
}
)

View File

@@ -0,0 +1,302 @@
pkgs: lib: buildPackages:
self: super:
let
libExt = pkgs.stdenv.hostPlatform.extensions.sharedLibrary;
inherit (import ./lib-override-helper.nix pkgs lib)
addPackageRequires
addPackageRequiresIfOlder
ignoreCompilationError
ignoreCompilationErrorIfOlder
mkHome
mkHomeIfOlder
;
in
{
# keep-sorted start block=yes newline_separated=yes
# Compilation instructions for the Ada executables:
# https://www.nongnu.org/ada-mode/
ada-mode = super.ada-mode.overrideAttrs (
finalAttrs: previousAttrs: {
# 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-${finalAttrs.version}";
nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [
buildPackages.gnat
buildPackages.gprbuild
buildPackages.dos2unix
buildPackages.re2c
];
buildInputs = previousAttrs.buildInputs or [ ] ++ [ pkgs.gnatPackages.gnatcoll-xref ];
buildPhase = ''
runHook preBuild
./build.sh -j$NIX_BUILD_CORES
runHook postBuild
'';
postInstall =
previousAttrs.postInstall or ""
+ "\n"
+ ''
./install.sh "$out"
'';
meta = previousAttrs.meta // {
maintainers = [ lib.maintainers.sternenseemann ];
};
}
);
# native-compiler-error-empty-byte in old versions
ada-ref-man = ignoreCompilationErrorIfOlder super.ada-ref-man "2020.1.0.20201129.190419";
advice = null; # builtin
# elisp error in old versions
ampc = ignoreCompilationErrorIfOlder super.ampc "0.2.0.20240220.181558";
auctex = mkHome super.auctex;
auctex-cont-latexmk = mkHome super.auctex-cont-latexmk;
auctex-label-numbers = mkHome super.auctex-label-numbers;
cl-lib = null; # builtin
cl-print = null; # builtin
# missing optional dependencies https://codeberg.org/rahguzar/consult-hoogle/issues/4
consult-hoogle = addPackageRequiresIfOlder super.consult-hoogle [ self.consult ] "0.2.2";
# missing optional dependencies https://github.com/jacksonrayhamilton/context-coloring/issues/10
context-coloring = addPackageRequires super.context-coloring [ self.js2-mode ];
cpio-mode = ignoreCompilationError super.cpio-mode; # elisp error
# fixed in https://git.savannah.gnu.org/cgit/emacs/elpa.git/commit/?h=externals/dbus-codegen&id=cfc46758c6252a602eea3dbc179f8094ea2a1a85
dbus-codegen = ignoreCompilationErrorIfOlder super.dbus-codegen "0.1.0.20201127.221326"; # elisp error
debbugs = super.debbugs.overrideAttrs (old: {
preInstall =
old.preInstall or ""
+ "\n"
+ ''
tmp_src_dir=$(mktemp -d)
tar --extract --verbose --file $src --directory $tmp_src_dir --strip-components 1
EMACSLOADPATH=$tmp_src_dir/test:$EMACSLOADPATH
'';
});
ebdb = super.ebdb.overrideAttrs (
finalAttrs: previousAttrs:
let
applyOrgRoamMissingPatch = lib.versionOlder finalAttrs.version "0.8.22.0.20240205.070828";
in
{
dontUnpack = !applyOrgRoamMissingPatch;
patches =
if applyOrgRoamMissingPatch then
previousAttrs.patches or [ ]
++ [
(pkgs.fetchpatch {
name = "fix-comilation-error-about-missing-org-roam.patch";
url = "https://github.com/girzel/ebdb/commit/058f30a996eb9074feac8f94db4eb49e85ae08f1.patch";
hash = "sha256-UI72N3lCgro6bG75sWnbw9truREToQHEzZ1TeQAIMjo=";
})
]
else
previousAttrs.patches or null;
preBuild =
if applyOrgRoamMissingPatch then
previousAttrs.preBuild or ""
+ "\n"
+ ''
pushd ..
local content_directory=$ename-$version
src=$PWD/$content_directory.tar
tar --create --verbose --file=$src $content_directory
popd
''
else
previousAttrs.preBuild or null;
}
);
eglot = super.eglot.overrideAttrs (
finalAttrs: previousAttrs: {
postInstall =
previousAttrs.postInstall or ""
# old versions do not include an info manual
+ lib.optionalString (lib.versionAtLeast "1.17.0.20240829.5352" finalAttrs.version) ''
local info_file=eglot.info
pushd $out/share/emacs/site-lisp/elpa/eglot-*
# specify output info file to override the one defined in eglot.texi
makeinfo --output=$info_file eglot.texi
install-info $info_file dir
popd
'';
}
);
jinx = super.jinx.overrideAttrs (old: {
dontUnpack = false;
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.pkg-config ];
buildInputs = old.buildInputs or [ ] ++ [ pkgs.enchant2 ];
postBuild =
old.postBuild or ""
+ "\n"
+ ''
NIX_CFLAGS_COMPILE="$($PKG_CONFIG --cflags enchant-2) $NIX_CFLAGS_COMPILE"
$CC -shared -o jinx-mod${libExt} jinx-mod.c -lenchant-2
'';
postInstall =
old.postInstall or ""
+ "\n"
+ ''
outd=$out/share/emacs/site-lisp/elpa/jinx-*
install -m444 -t $outd jinx-mod${libExt}
rm $outd/jinx-mod.c $outd/emacs-module.h
'';
meta = old.meta // {
maintainers = [ lib.maintainers.DamienCassou ];
};
});
notes-mode = (mkHome super.notes-mode).overrideAttrs (old: {
dontUnpack = false;
buildInputs = old.buildInputs or [ ] ++ [ pkgs.perl ];
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.perl ];
preInstall =
old.preInstall or ""
+ "\n"
+ ''
patchShebangs --build mkconfig
pushd ..
local content_directory=$ename-$version
src=$PWD/$content_directory.tar
tar --create --verbose --file=$src $content_directory
popd
'';
postFixup =
old.postFixup or ""
+ "\n"
+ ''
patchShebangs --host --update $out/share/emacs/site-lisp/elpa/$ename-$version/mkconfig
'';
});
plz = super.plz.overrideAttrs (old: {
dontUnpack = false;
postPatch =
old.postPatch or ""
+ "\n"
+ ''
substituteInPlace plz.el \
--replace-fail 'plz-curl-program "curl"' 'plz-curl-program "${lib.getExe pkgs.curl}"'
'';
preInstall =
old.preInstall or ""
+ "\n"
+ ''
tar -cf "$ename-$version.tar" --transform "s,^,$ename-$version/," * .[!.]*
src="$ename-$version.tar"
'';
});
# https://sourceware.org/bugzilla/show_bug.cgi?id=32185
poke = addPackageRequires super.poke [ self.poke-mode ];
pq = super.pq.overrideAttrs (old: {
buildInputs = old.buildInputs or [ ] ++ [ pkgs.libpq ];
});
preview-auto = mkHome super.preview-auto;
preview-tailor = mkHome super.preview-tailor;
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73325
psgml = ignoreCompilationError super.psgml; # elisp error
# native-ice https://github.com/mattiase/relint/issues/15
relint = ignoreCompilationError super.relint;
# native compilation for tests/seq-tests.el never ends
# delete tests/seq-tests.el to workaround this
seq = super.seq.overrideAttrs (old: {
dontUnpack = false;
postUnpack =
old.postUnpack or ""
+ "\n"
+ ''
local content_directory=$(echo seq-*)
rm --verbose $content_directory/tests/seq-tests.el
src=$PWD/$content_directory.tar
tar --create --verbose --file=$src $content_directory
'';
});
shen-mode = ignoreCompilationErrorIfOlder super.shen-mode "0.1.0.20221221.82050"; # elisp error
# https://github.com/alphapapa/taxy.el/issues/3
taxy = super.taxy.overrideAttrs (old: {
dontUnpack = false;
postUnpack =
old.postUnpack or ""
+ "\n"
+ ''
local content_directory=$ename-$version
rm --verbose --recursive $content_directory/examples
src=$PWD/$content_directory.tar
tar --create --verbose --file=$src $content_directory
'';
});
tex-parens = mkHomeIfOlder super.tex-parens "0.4.0.20240630.70456";
timerfunctions = ignoreCompilationErrorIfOlder super.timerfunctions "1.4.2.0.20201129.225252";
tle = null; # builtin
# kv is required in triples-test.el
# Alternatively, we can delete that file. But adding a dependency is easier.
triples = addPackageRequires super.triples [ self.kv ];
wisitoken-grammar-mode = ignoreCompilationError super.wisitoken-grammar-mode; # elisp error
xeft = super.xeft.overrideAttrs (old: {
dontUnpack = false;
buildInputs = old.buildInputs or [ ] ++ [ pkgs.xapian ];
buildPhase = old.buildPhase or "" + ''
$CXX -shared -o xapian-lite${libExt} xapian-lite.cc -lxapian
'';
postInstall =
old.postInstall or ""
+ "\n"
+ ''
outd=$out/share/emacs/site-lisp/elpa/xeft-*
install -m444 -t $outd xapian-lite${libExt}
rm $outd/xapian-lite.cc $outd/emacs-module.h $outd/emacs-module-prelude.h $outd/demo.gif $outd/Makefile
'';
});
# native-ice https://github.com/mattiase/xr/issues/9
xr = ignoreCompilationError super.xr;
# keep-sorted end
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
/*
# Updating
To update the list of packages from ELPA,
1. Run `./update-elpa-devel`.
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.elpaDevelPackages
3. Run `git commit -m "elpa-devel-packages $(date -Idate)" -- elpa-devel-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 instantaneous and
formats commits for you.
*/
{
lib,
pkgs,
buildPackages,
}:
self:
let
inherit (import ./lib-override-helper.nix pkgs lib)
markBroken
;
# Use custom elpa url fetcher with fallback/uncompress
fetchurl = buildPackages.callPackage ./fetchelpa.nix { };
generateElpa = lib.makeOverridable (
{
generated ? ./elpa-devel-generated.nix,
}:
let
imported = import generated {
callPackage =
pkgs: args:
self.callPackage pkgs (
args
// {
inherit fetchurl;
}
);
};
super = imported;
commonOverrides = import ./elpa-common-overrides.nix pkgs lib buildPackages;
overrides = self: super: {
# keep-sorted start block=yes newline_separated=yes
# keep-sorted end
};
elpaDevelPackages =
let
super' = super // (commonOverrides self super);
in
super' // (overrides self super');
in
elpaDevelPackages
);
in
generateElpa { }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,87 @@
/*
# 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 instantaneous and
formats commits for you.
*/
{
lib,
pkgs,
buildPackages,
}:
self:
let
inherit (import ./lib-override-helper.nix pkgs lib)
ignoreCompilationError
markBroken
;
# 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 = imported;
commonOverrides = import ./elpa-common-overrides.nix pkgs lib buildPackages;
overrides = self: super: {
# keep-sorted start block=yes newline_separated=yes
# 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
vc-jj = ignoreCompilationError super.vc-jj; # native-ice
# keep-sorted end
};
elpaPackages =
let
super' = super // (commonOverrides self super);
in
super' // (overrides self super');
in
elpaPackages
);
in
generateElpa { }

View File

@@ -0,0 +1,25 @@
let
pkgs = import ../../../../.. { };
src = pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "emacs2nix";
rev = "9458961fc433a6c4cd91e7763f0aa1ef15f7b4aa";
hash = "sha256-NJVKrYSF/22hrUJNJ3/znbcfHi/FtTePQ8Xzfp2eKAk=";
fetchSubmodules = true;
};
in
pkgs.mkShell {
packages = [
pkgs.bash
pkgs.nixfmt
];
EMACS2NIX = src;
shellHook = ''
export PATH=$PATH:${src}
'';
}

View File

@@ -0,0 +1,25 @@
# 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,95 @@
pkgs: lib:
rec {
addPackageRequires =
pkg: packageRequires: addPackageRequiresWhen pkg packageRequires (finalAttrs: previousAttrs: true);
addPackageRequiresIfOlder =
pkg: packageRequires: version:
addPackageRequiresWhen pkg packageRequires (
finalAttrs: previousAttrs: lib.versionOlder finalAttrs.version version
);
addPackageRequiresWhen =
pkg: packageRequires: predicate:
pkg.overrideAttrs (
finalAttrs: previousAttrs: {
packageRequires =
if predicate finalAttrs previousAttrs then
previousAttrs.packageRequires or [ ] ++ packageRequires
else
previousAttrs.packageRequires or null;
}
);
buildWithGit =
pkg:
pkg.overrideAttrs (previousAttrs: {
nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [ pkgs.git ];
});
dontConfigure = pkg: pkg.overrideAttrs { dontConfigure = true; };
externalSrc =
pkg: epkg:
pkg.overrideAttrs (previousAttrs: {
inherit (epkg) src version;
propagatedUserEnvPkgs = previousAttrs.propagatedUserEnvPkgs or [ ] ++ [ epkg ];
});
fix-rtags = pkg: dontConfigure (externalSrc pkg pkgs.rtags);
fixRequireHelmCore =
pkg:
pkg.overrideAttrs (previousAttrs: {
postPatch =
previousAttrs.postPatch or ""
+ "\n"
+ ''
substituteInPlace $ename.el \
--replace-fail "(require 'helm)" "(require 'helm-core)"
'';
});
ignoreCompilationError = pkg: ignoreCompilationErrorWhen pkg (finalAttrs: previousAttrs: true);
ignoreCompilationErrorIfOlder =
pkg: version:
ignoreCompilationErrorWhen pkg (
finalAttrs: previousAttrs: lib.versionOlder finalAttrs.version version
);
ignoreCompilationErrorWhen =
pkg: predicate:
pkg.overrideAttrs (
finalAttrs: previousAttrs: {
ignoreCompilationError = predicate finalAttrs previousAttrs;
}
);
markBroken =
pkg:
pkg.overrideAttrs (previousAttrs: {
meta = previousAttrs.meta or { } // {
broken = true;
};
});
mkHome = pkg: mkHomeWhen pkg (finalAttrs: previousAttrs: true);
mkHomeIfOlder =
pkg: version:
mkHomeWhen pkg (finalAttrs: previousAttrs: lib.versionOlder finalAttrs.version version);
mkHomeWhen =
pkg: predicate:
pkg.overrideAttrs (
finalAttrs: previousAttrs: {
nativeBuildInputs =
if predicate finalAttrs previousAttrs then
previousAttrs.nativeBuildInputs or [ ] ++ [ pkgs.writableTmpDirAsHomeHook ]
else
previousAttrs.nativeBuildInputs or null;
}
);
}

View File

@@ -0,0 +1,170 @@
lib: self:
let
inherit (lib) elemAt;
matchForgeRepo = builtins.match "(.+)/(.+)";
fetchers = lib.mapAttrs (_: fetcher: self.callPackage fetcher { }) {
github =
{ fetchFromGitHub }:
{
repo ? null,
...
}:
{ sha256, commit, ... }:
let
m = matchForgeRepo repo;
in
assert m != null;
fetchFromGitHub {
owner = elemAt m 0;
repo = elemAt m 1;
rev = commit;
inherit sha256;
};
gitlab =
{ fetchFromGitLab }:
{
repo ? null,
...
}:
{ sha256, commit, ... }:
let
m = matchForgeRepo repo;
in
assert m != null;
fetchFromGitLab {
owner = elemAt m 0;
repo = elemAt m 1;
rev = commit;
inherit sha256;
};
git = (
{ fetchgit }:
{
url ? null,
...
}:
{ sha256, commit, ... }:
(fetchgit {
rev = commit;
inherit sha256 url;
}).overrideAttrs
(_: {
GIT_SSL_NO_VERIFY = true;
})
);
bitbucket =
{ fetchhg }:
{
repo ? null,
...
}:
{ sha256, commit, ... }:
fetchhg {
rev = commit;
url = "https://bitbucket.com/${repo}";
inherit sha256;
};
hg =
{ fetchhg }:
{
url ? null,
...
}:
{ sha256, commit, ... }:
fetchhg {
rev = commit;
inherit sha256 url;
};
sourcehut =
{ fetchzip }:
{
repo ? null,
...
}:
{ sha256, commit, ... }:
fetchzip {
url = "https://git.sr.ht/~${repo}/archive/${commit}.tar.gz";
inherit sha256;
};
codeberg =
{ fetchzip }:
{
repo ? null,
...
}:
{ sha256, commit, ... }:
fetchzip {
url = "https://codeberg.org/${repo}/archive/${commit}.tar.gz";
inherit sha256;
};
};
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 = error != null;
in
if hasSource then
lib.nameValuePair ename (
self.callPackage (
{ melpaBuild, fetchurl, ... }@pkgargs:
melpaBuild {
inherit pname ename;
inherit (sourceArgs) commit;
version = lib.optionalString (version != null) (
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 (sha256 == null || broken) then null else fetchers.${fetcher} args sourceArgs;
recipe =
if commit == null then
null
else
fetchurl {
name = pname + "-recipe";
url = "https://raw.githubusercontent.com/melpa/melpa/${commit}/recipes/${ename}";
inherit sha256;
};
packageRequires = lib.optionals (deps != null) (
map (dep: pkgargs.${dep} or self.${dep} or null) deps
);
meta = (sourceArgs.meta or { }) // {
inherit broken;
};
}
) { }
)
else
null;
}

View File

@@ -0,0 +1,67 @@
{ lib, pkgs }:
self:
let
inherit (self) callPackage;
in
lib.packagesFromDirectoryRecursive {
inherit callPackage;
directory = ./manual-packages;
}
// {
inherit (pkgs) emacspeak;
codeium = callPackage ./manual-packages/codeium {
inherit (pkgs) codeium;
};
eaf-browser = callPackage ./manual-packages/eaf-browser {
inherit (pkgs) aria2;
};
eaf-git = callPackage ./manual-packages/eaf-git {
inherit (pkgs) ripgrep;
};
elpaca = callPackage ./manual-packages/elpaca { inherit (pkgs) git; };
lsp-bridge = callPackage ./manual-packages/lsp-bridge {
inherit (pkgs)
basedpyright
git
go
gopls
python3
;
};
lua = callPackage ./manual-packages/lua { inherit (pkgs) lua; };
straight = callPackage ./manual-packages/straight { inherit (pkgs) git; };
structured-haskell-mode = self.shm;
texpresso = callPackage ./manual-packages/texpresso { inherit (pkgs) texpresso; };
tree-sitter-langs = callPackage ./manual-packages/tree-sitter-langs { final = self; };
zstd = callPackage ./manual-packages/zstd { inherit (pkgs) zstd; };
# From old emacsPackages (pre emacsPackagesNg)
cedille = callPackage ./manual-packages/cedille { inherit (pkgs) cedille; };
# camelCase aliases for some of the kebab-case expressions above
colorThemeSolarized = self.color-theme-solarized;
emacsSessionManagement = self.session-management-for-emacs;
rectMark = self.rect-mark;
sunriseCommander = self.sunrise-commander;
}
### Aliases
// lib.optionalAttrs pkgs.config.allowAliases {
agda-input = throw "emacsPackages.agda-input is contained in emacsPackages.agda2-mode, please use that instead."; # Added 2024-07-17
ess-R-object-popup = throw "emacsPackages.ess-R-object-popup was deleted, since the upstream repo looks abandoned."; # Added 2024-07-15
ghc-mod = throw "emacsPackages.ghc-mod was deleted because it is deprecated, use haskell-language-server instead."; # Added 2024-07-17
haskell-unicode-input-method = throw "emacsPackages.haskell-unicode-input-method is contained in emacsPackages.haskell-mode, please use that instead."; # Added 2024-07-17
matrix-client = throw "emacsPackages.matrix-client is deprecated in favor of emacsPackages.ement."; # Added 2024-08-17
perl-completion = throw "emacsPackages.perl-completion was removed, since it is broken."; # Added 2024-07-19
}

View File

@@ -0,0 +1,34 @@
{
lib,
melpaBuild,
fetchFromGitHub,
acm,
popon,
unstableGitUpdater,
}:
melpaBuild {
pname = "acm-terminal";
version = "0-unstable-2023-12-06";
src = fetchFromGitHub {
owner = "twlz0ne";
repo = "acm-terminal";
rev = "1851d8fa2a27d3fd8deeeb29cd21c3002b8351ba";
hash = "sha256-EYhFrOo0j0JSNTdcZCbyM0iLxaymUXi1u6jZy8lTOaY=";
};
packageRequires = [
acm
popon
];
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
homepage = "https://github.com/twlz0ne/acm-terminal";
description = "Patch for LSP bridge acm on Terminal";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ kira-bruneau ];
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
melpaBuild,
lsp-bridge,
yasnippet,
}:
melpaBuild {
pname = "acm";
version = lsp-bridge.version;
src = lsp-bridge.src;
packageRequires = [ yasnippet ];
files = ''("acm/*.el" "acm/icons")'';
meta = {
description = "Asynchronous Completion Menu";
homepage = "https://github.com/manateelazycat/lsp-bridge";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
fxttr
kira-bruneau
];
};
}

View File

@@ -0,0 +1,15 @@
{ melpaBuild, haskellPackages }:
let
Agda = haskellPackages.Agda;
in
melpaBuild {
pname = "agda2-mode";
inherit (Agda) src version;
files = ''("src/data/emacs-mode/*.el")'';
meta = {
inherit (Agda.meta) homepage license;
description = "Agda2-mode for Emacs extracted from Agda package";
};
}

View File

@@ -0,0 +1,43 @@
diff -Naur cask-source-0.9.0-old/bin/cask cask-source-0.9.0-new/bin/cask
--- cask-source-0.9.0-old/bin/cask 1969-12-31 21:00:01.000000000 -0300
+++ cask-source-0.9.0-new/bin/cask 2024-09-02 12:46:48.316364621 -0300
@@ -21,8 +21,6 @@
set -euo pipefail
CASK=$0
EMACS=${CASK_EMACS:-${EMACS:-emacs}}
-READLINK=${READLINK:-readlink}
-GREADLINK=${GREADLINK:-greadlink}
if [ "$#" -eq "0" ] ; then
subcommand=install
@@ -31,21 +29,10 @@
shift
fi
-set +eu
-SRCDIR__=$($READLINK -f "$CASK" 2>/dev/null)
-if [ -z "$SRCDIR__" ] ; then
- SRCDIR__=$($GREADLINK -f "$CASK" 2>/dev/null)
-fi
-set -eu
-if [ -z "$SRCDIR__" ]; then
- SRCDIR__=$(python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" "$CASK")
-fi
-SRCDIR_=$(dirname "$SRCDIR__")
-SRCDIR=$(dirname "$SRCDIR_")
case $subcommand in
emacs)
EMACS="$EMACS" \
- "$EMACS" -Q -L "$SRCDIR" -l "$SRCDIR/cask" \
+ "$EMACS" -Q -L "@lispdir@" -l "@lispdir@/cask" \
--eval "(cask--initialize (expand-file-name default-directory))" \
"$@"
;;
@@ -53,6 +40,6 @@
EMACSLOADPATH="$($CASK load-path)" PATH="$($CASK path)" EMACS="$EMACS" "$@"
;;
*)
- "$EMACS" -Q --script "$SRCDIR/cask-cli.el" -- $subcommand "$@"
+ "$EMACS" -Q --script "@lispdir@/cask-cli.el" -- $subcommand "$@"
;;
esac

View File

@@ -0,0 +1,85 @@
diff --git a/cask-bootstrap.el b/cask-bootstrap.el
--- a/cask-bootstrap.el
+++ b/cask-bootstrap.el
@@ -27,41 +27,18 @@
;;; Code:
-(require 'package)
+;; Add nix store paths for dependencies to the load-path.
+(let ((paths '(@loadPaths@)))
+ (dolist (path paths)
+ (push path load-path)))
-(defvar cask-directory)
+(let ((paths '(@nativeLoadPaths@)))
+ (dolist (path paths)
+ (push path native-comp-eln-load-path)))
-(defconst cask-bootstrap-dir
- (expand-file-name
- (locate-user-emacs-file
- (format ".cask/%s.%s/bootstrap" emacs-major-version emacs-minor-version)))
- "Path to Cask bootstrap directory.")
-
-;; Restore several package- variables and `load-path` after let-scope.
-(let (package-alist
- package-archive-contents
- package--initialized
- (load-path (add-to-list
- 'load-path (expand-file-name "package-build" cask-directory)))
- (package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
- ("melpa" . "https://melpa.org/packages/")))
- (package-user-dir cask-bootstrap-dir)
- (deps '(s f commander git epl shut-up cl-lib cl-generic eieio ansi)))
- (package-initialize)
- (setq package-archive-contents nil) ;; force refresh, cask#573, cask#559
- (unless (package-installed-p 'cl-lib)
- ;; package-build depends on cl-lib
- (unless package-archive-contents
- (package-refresh-contents))
- (package-install 'cl-lib))
- (require 'package-build)
+(let ((deps '(@depsMod@)))
(dolist (pkg deps)
- (unless (featurep pkg)
- (unless (package-installed-p pkg)
- (unless package-archive-contents
- (package-refresh-contents))
- (package-install pkg))
- (require pkg))))
+ (require pkg)))
(provide 'cask-bootstrap)
diff --git a/cask-cli.el b/cask-cli.el
--- a/cask-cli.el
+++ b/cask-cli.el
@@ -129,25 +129,8 @@ already is installed, it will not be installed again."
(cask-install (cask-cli--bundle))))
(defun cask-cli/upgrade-cask ()
- "Upgrade Cask itself and its dependencies.
-
-This command requires that Cask is installed using Git and that
-Git is available in `exec-path'."
- (unless (f-exists? (f-expand ".no-upgrade" cask-directory))
- (unwind-protect
- (progn
- (epl-change-package-dir cask-bootstrap-dir)
- (epl-initialize)
- (epl-add-archive "gnu" "https://elpa.gnu.org/packages/")
- (epl-add-archive "melpa" "https://melpa.org/packages/")
- (epl-refresh)
- (epl-upgrade))
- (epl-reset))
- (require 'git)
- (let ((git-repo cask-directory))
- (if (s-present? (git-run "status" "--porcelain"))
- (error "Cannot update Cask because of dirty tree")
- (git-pull)))))
+ "Disabled in Nixpkgs as this function requires that Cask is installed using Git."
+ (princ "Upgrade not available when installed via Nixpkgs.\n"))
(defun cask-cli/exec (&rest _args)
"Execute ARGS with correct `exec-path' and `load-path'.")

View File

@@ -0,0 +1,106 @@
{
lib,
ansi,
cl-generic,
cl-lib,
commander,
epl,
f,
fetchFromGitHub,
installShellFiles,
git,
melpaBuild,
package-build,
replaceVars,
s,
shut-up,
}:
let
formatLoadPath = x: ''"${x}/share/emacs/site-lisp/elpa/${x.ename}-${x.melpaVersion or x.version}"'';
formatNativeLoadPath = x: ''"${x}/share/emacs/native-lisp"'';
getAllDependenciesOfPkg =
pkg:
let
direct = builtins.filter (x: x != null) (pkg.packageRequires or [ ]);
indirect = builtins.concatLists (map getAllDependenciesOfPkg direct);
in
lib.unique (direct ++ indirect);
in
melpaBuild (
finalAttrs:
let
nixpkgDependencies = getAllDependenciesOfPkg finalAttrs.finalPackage;
loadPaths = builtins.concatStringsSep " " (map formatLoadPath nixpkgDependencies);
nativeLoadPaths = builtins.concatStringsSep " " (
map formatNativeLoadPath (nixpkgDependencies ++ [ (placeholder "out") ])
);
emacsBuiltinDeps = [
"cl-lib"
"eieio"
];
depsMod = builtins.concatStringsSep " " ((map (x: x.ename) nixpkgDependencies) ++ emacsBuiltinDeps);
in
{
pname = "cask";
version = "0.9.1";
src = fetchFromGitHub {
name = "cask-source-${finalAttrs.version}";
owner = "cask";
repo = "cask";
rev = "v${finalAttrs.version}";
hash = "sha256-/vinpQ51AuaTbXW4L4MnVonyfzTMvHUF4HViSPBKZxs=";
};
nativeBuildInputs = [ installShellFiles ];
patches = [
# Uses LISPDIR substitution var
./0000-cask-lispdir.diff
# Use Nix provided dependencies instead of letting Cask bootstrap itself
./0001-cask-bootstrap.diff
];
packageRequires = [
ansi
cl-generic
cl-lib
commander
epl
f
git
package-build
s
shut-up
];
postPatch = ''
# use melpaVersion so that it works for unstable releases too
substituteInPlace bin/cask \
--replace-fail @lispdir@ $out/share/emacs/site-lisp/elpa/$ename-$melpaVersion
# using `replaceVars` results in wrong result of `placeholder "out"`
substituteInPlace cask-bootstrap.el \
--replace-fail @depsMod@ '${depsMod}' \
--replace-fail @loadPaths@ '${loadPaths}' \
--replace-fail @nativeLoadPaths@ '${nativeLoadPaths}'
'';
postInstall = ''
installBin bin/cask
'';
meta = {
homepage = "https://github.com/cask/cask";
description = "Project management for Emacs";
longDescription = ''
Cask is a project management tool for Emacs that helps automate the
package development cycle; development, dependencies, testing, building,
packaging and more.
'';
license = lib.licenses.gpl3Plus;
mainProgram = "cask";
maintainers = [ ];
};
}
)

View File

@@ -0,0 +1,38 @@
{
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,18 @@
diff --git a/codeium.el b/codeium.el
index 669333e..4d5012d 100644
--- a/codeium.el
+++ b/codeium.el
@@ -353,12 +353,7 @@ If you set `codeium-port', it will be used instead and no process will be create
(pending-table (make-hash-table :test 'eql :weakness nil)) ; requestid that we are waiting for
)
-(codeium-def codeium-command-executable
- (expand-file-name
- (pcase system-type
- ('windows-nt "codeium_language_server.exe")
- (_ "codeium_language_server"))
- (expand-file-name "codeium" user-emacs-directory)))
+(codeium-def codeium-command-executable "@codeium@")
(codeium-def codeium-enterprise nil)
(codeium-def codeium-portal-url "https://www.codeium.com")

View File

@@ -0,0 +1,38 @@
{
lib,
codeium,
fetchFromGitHub,
melpaBuild,
replaceVars,
gitUpdater,
}:
melpaBuild {
pname = "codeium";
version = "1.6.13";
src = fetchFromGitHub {
owner = "Exafunction";
repo = "codeium.el";
rev = "1.6.13";
hash = "sha256-CjT21GhryO8/iM0Uzm/s/I32WqVo4M3tSlHC06iEDXA=";
};
patches = [
(replaceVars ./0000-set-codeium-command-executable.patch {
codeium = lib.getExe' codeium "codeium_language_server";
})
];
passthru.updateScript = gitUpdater { };
meta = {
description = "Free, ultrafast Copilot alternative for Emacs";
homepage = "https://github.com/Exafunction/codeium.el";
license = lib.licenses.mit;
maintainers = [ ];
inherit (codeium.meta) platforms;
sourceProvenance = [ lib.sourceTypes.fromSource ];
};
}

View File

@@ -0,0 +1,30 @@
{
lib,
fetchFromGitHub,
melpaBuild,
}:
melpaBuild {
pname = "color-theme-solarized";
ename = "solarized-theme";
version = "0-unstable-2023-02-09";
src = fetchFromGitHub {
owner = "sellout";
repo = "emacs-color-theme-solarized";
rev = "b186e5d62d0b83cbf5cf38f7eb7a199dea9a3ee3";
hash = "sha256-7E8r56dzfD06tsQEnqU5mWSbwz9x9QPbzken2J/fhlg=";
};
files = ''(:defaults (:exclude "color-theme-solarized-pkg.el"))'';
# https://github.com/NixOS/nixpkgs/issues/335408
ignoreCompilationError = true;
meta = {
homepage = "http://ethanschoonover.com/solarized";
description = "Precision colors for machines and people; Emacs implementation";
license = lib.licenses.mit;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,22 @@
{
lib,
fetchurl,
melpaBuild,
}:
melpaBuild {
pname = "control-lock";
version = "1.1.2";
src = fetchurl {
url = "https://raw.githubusercontent.com/emacsmirror/emacswiki.org/185fdc34fb1e02b43759ad933d3ee5646b0e78f8/control-lock.el";
hash = "sha256-JCrmS3FSGDHSR+eAR0X/uO0nAgd3TUmFxwEVH5+KV+4=";
};
meta = {
homepage = "https://www.emacswiki.org/emacs/control-lock.el";
description = "Like caps-lock, but for your control key";
license = lib.licenses.free;
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,55 @@
{
lib,
dash,
editorconfig,
f,
fetchFromGitHub,
jsonrpc,
nodejs,
s,
melpaBuild,
copilot-language-server,
}:
melpaBuild (finalAttrs: {
pname = "copilot";
version = "0.2.0";
src = fetchFromGitHub {
owner = "copilot-emacs";
repo = "copilot.el";
rev = "v${finalAttrs.version}";
sha256 = "sha256-hIA+qdWoOJI9/hqBUSHhmh+jjzDnPiZkIzszCPuQxd0=";
};
files = ''(:defaults "dist")'';
postPatch = ''
substituteInPlace copilot.el \
--replace-fail "defcustom copilot-server-executable \"copilot-language-server\"" \
"defcustom copilot-server-executable \"${lib.getExe copilot-language-server}\""
'';
packageRequires = [
dash
editorconfig
f
jsonrpc
s
];
propagatedUserEnvPkgs = [ nodejs ];
meta = {
description = "Unofficial copilot plugin for Emacs";
homepage = "https://github.com/copilot-emacs/copilot.el";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ bbigras ];
platforms = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
"x86_64-windows"
];
};
})

View File

@@ -0,0 +1,47 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Updater
unstableGitUpdater,
}:
melpaBuild {
pname = "eaf-airshare";
version = "0-unstable-2023-07-11";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-airshare";
rev = "71b4507ad5724babcf34da941a53c5a94bf7666a";
hash = "sha256-jpODlbg/luuCuDOayBqhVCF3vXww2FolYLniykeZr6E=";
};
files = ''
("*.el"
"*.py")
'';
passthru = {
updateScript = unstableGitUpdater { };
eafPythonDeps =
ps:
with ps;
[
qrcode
]
++ ps.qrcode.optional-dependencies.pil;
};
meta = {
description = "Share text by qr-code in Emacs";
homepage = "https://github.com/emacs-eaf/eaf-airshare";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
}

View File

@@ -0,0 +1,75 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Dependencies
aria2,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-browser";
version = "0-unstable-2025-06-14";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-browser";
rev = "120967319132f361a2b27f89ee54d1984aa23eaf";
hash = "sha256-DsPrctB1bSGBPQLI2LsnSUtqnzWpZRrWrVZM8lS9fms=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-UfQL7rN47nI1FyhgBlzH4QtyVCn0wGV3Rv5Y+aidRNE=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postPatch = ''
substituteInPlace buffer.py \
--replace-fail "aria2_args = [\"aria2c\"]" \
"aria2_args = [\"${lib.getExe aria2}\"]"
'';
files = ''
("*.el"
"*.py"
"easylist.txt"
"aria2-ng")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps =
ps: with ps; [
pysocks
];
};
meta = {
description = "Modern browser in Emacs";
homepage = "https://github.com/emacs-eaf/eaf-browser";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,69 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-camera";
version = "0-unstable-2025-03-09";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-camera";
rev = "264e34489c175d25a9611446ad82a1d1adbfb896";
hash = "sha256-tw4OA1Sbvj3eqm3B4Ou6Gxk3wegmS7wMy2/U+UGTCcY=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-MmNg4Qf1UhtUIpHjCcwk9MB59XGRhW9SzhO4yUcW1Ik=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postBuild = ''
npm run build
'';
files = ''
("*.el"
"*.py"
"*.js"
"src")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
cp -r dist $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps = ps: [ ];
};
meta = {
description = "Camera application for the EAF";
homepage = "https://github.com/emacs-eaf/eaf-camera";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,84 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Dependencies
fd,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-file-manager";
version = "0-unstable-2025-03-23";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-file-manager";
rev = "57f2e8a7f6282fbb4689b3fc8b99458ed3667dc6";
hash = "sha256-IET9b3nS/Z4dxqFVyNITVoMDo6E/+sm3E7cfO7pozRo=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-dzfw+CgoM1CulPoa0KEzUX9dlBiquX4BkYNwU3vMb+Q=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postPatch = ''
substituteInPlace buffer.py \
--replace-fail "shutil.which(\"fd\")" \
"shutil.which(\"${lib.getExe fd}\")" \
--replace-fail "return \"fd\"" \
"return \"${lib.getExe fd}\""
'';
postBuild = ''
npm run build
'';
files = ''
("*.el"
"*.py"
"*.js"
"src")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
cp -r dist $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps =
ps: with ps; [
pypinyin
pygments
exif
];
};
meta = {
description = "File manager application for the EAF";
homepage = "https://github.com/emacs-eaf/eaf-file-manager";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,89 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Dependencies
delta,
ripgrep,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-git";
version = "0-unstable-2025-07-10";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-git";
rev = "24c3887075630a21d0a53ddb95b01ef70694f03a";
hash = "sha256-ggxgwMTk46WDLKxrNkzX3pSO/yLoLTJVH08T4o70fEM=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-kbFnPZlFqoE1Q/KKVW5ZI4HPPWsIjXA/jne2jw7BeEc=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postPatch = ''
substituteInPlace eaf-git.el \
--replace-fail "(defcustom eaf-git-delta-executable \"delta\"" \
"(defcustom eaf-git-delta-executable \"${lib.getExe delta}\""
substituteInPlace buffer.py \
--replace-fail "command = \"rg '{}' {}" \
"command = \"${lib.getExe ripgrep} '{}' {}"
'';
postBuild = ''
npm run build
'';
files = ''
("*.el"
"*.py"
"*.js"
"src")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
cp -r dist $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps =
ps: with ps; [
charset-normalizer
giturlparse
pygit2
pygments
unidiff
];
};
meta = {
description = "Git client for the EAF";
homepage = "https://github.com/emacs-eaf/eaf-git";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,63 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-image-viewer";
version = "0-unstable-2023-06-30";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-image-viewer";
rev = "154685532ff42bd7ff4fe5a80e96e0d3d56b4ee0";
hash = "sha256-5MJibLr4UJOKl79PsDmXEZR+XFBx1xvcoykX4z/XbrI=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-d1DVOAhYtXEzRQcUWFJE0gbHnqPRCUGibSqc/Nf3dVE=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
files = ''
("*.el"
"*.py"
"*.html")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps = ps: [ ];
};
meta = {
description = "Image viewer application for the EAF";
homepage = "https://github.com/emacs-eaf/eaf-image-viewer";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,69 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-js-video-player";
version = "0-unstable-2025-07-26";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-js-video-player";
rev = "6e4e938c42b265e108a0474a22813322ff2db124";
hash = "sha256-tyovHnVX1kkom8W56GI/+PfaQSoCiB4OJj535Dbzah0=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-grLuq11Sgx6jYCDjWch1AYuL8d/NCsr9BmAPvEgrfG8=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postBuild = ''
npm run build
'';
files = ''
("*.el"
"*.py"
"*.js"
"src")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
cp -r dist $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps = ps: [ ];
};
meta = {
description = "EAF Video Player (JS) application";
homepage = "https://github.com/emacs-eaf/eaf-js-video-player";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,74 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# JavaScript dependency
nodejs,
fetchNpmDeps,
npmHooks,
# Updater
nix-update-script,
}:
melpaBuild (finalAttrs: {
pname = "eaf-map";
version = "0-unstable-2025-07-04";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-map";
rev = "667865a9422ec71e3518833e1a13806d4f03adfb";
hash = "sha256-UgHIzYu/K1NzTDvUn2JkEmiyDEBT9JDmlvp6xG7Nv5k=";
};
env.npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-npm-deps";
inherit (finalAttrs) src;
hash = "sha256-prxCFrKvC2dG9BgO3LIKDCFzjn9vFegpvuMy4Eg6Ghs=";
};
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
postBuild = ''
npm run build
'';
files = ''
("*.el"
"*.py"
"*.js"
"src")
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
touch node_modules/.nosearch
cp -r node_modules $LISPDIR/
cp -r dist $LISPDIR/
'';
passthru = {
updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
eafPythonDeps =
ps: with ps; [
numpy
pycurl
python-tsp
];
};
meta = {
description = "OpenStreetMap application for the EAF";
homepage = "https://github.com/emacs-eaf/eaf-map";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,45 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Updater
unstableGitUpdater,
}:
melpaBuild {
pname = "eaf-pdf-viewer";
version = "0-unstable-2025-07-26";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "eaf-pdf-viewer";
rev = "ff08a6b48faac2d231fb1cfe968cec7e41bbeb98";
hash = "sha256-7JAWgCECHnMGPH9GM8pi9lDzR+B4T6xgYQCor032zbM=";
};
files = ''
("*.el"
"*.py")
'';
passthru = {
updateScript = unstableGitUpdater { };
eafPythonDeps =
ps: with ps; [
packaging
pymupdf
];
};
meta = {
description = "Fastest PDF Viewer in Emacs";
homepage = "https://github.com/emacs-eaf/eaf-pdf-viewer";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
}

View File

@@ -0,0 +1,45 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Updater
unstableGitUpdater,
}:
melpaBuild {
pname = "eaf-pyqterminal";
version = "0-unstable-2025-05-05";
src = fetchFromGitHub {
owner = "mumu-lhl";
repo = "eaf-pyqterminal";
rev = "db947f136660adc4c3883b332f4465af82e4c9da";
hash = "sha256-0BH29XvBzJPgJBFSKHiKSLo/dpj5rixg7+u+LDpB5+U=";
};
files = ''
("*.el"
"*.py")
'';
passthru = {
updateScript = unstableGitUpdater { };
eafPythonDeps =
ps: with ps; [
pyte
psutil
];
};
meta = {
description = "Terminal written in PyQt6 for the EAF";
homepage = "https://github.com/mumu-lhl/eaf-pyqterminal";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
}

View File

@@ -0,0 +1,17 @@
{
emacs-application-framework,
}:
let
withApplications =
enabledApps:
emacs-application-framework.override {
inherit enabledApps;
};
in
{
inherit withApplications;
}

View File

@@ -0,0 +1,22 @@
{
lib,
melpaBuild,
fetchzip,
}:
melpaBuild rec {
pname = "ebuild-mode";
version = "1.78";
src = fetchzip {
url = "https://gitweb.gentoo.org/proj/ebuild-mode.git/snapshot/ebuild-mode-${version}.tar.bz2";
hash = "sha256-vpNjhW3U/b+A4O78vYKoMN0Gutd6fRcB4wb3dz1z2Cc=";
};
meta = {
homepage = "https://gitweb.gentoo.org/proj/ebuild-mode.git/";
description = "Major modes for Gentoo package files";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
melpaBuild,
fetchFromGitHub,
unstableGitUpdater,
}:
melpaBuild {
pname = "eglot-booster";
version = "0-unstable-2025-07-16";
src = fetchFromGitHub {
owner = "jdtsmith";
repo = "eglot-booster";
rev = "cab7803c4f0adc7fff9da6680f90110674bb7a22";
hash = "sha256-xUBQrQpw+JZxcqT1fy/8C2tjKwa7sLFHXamBm45Fa4Y=";
};
passthru.updateScript = unstableGitUpdater { };
meta = {
homepage = "https://github.com/jdtsmith/eglot-booster";
description = "Boost eglot using lsp-booster";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ mannerbund ];
};
}

View File

@@ -0,0 +1,32 @@
{
lib,
melpaBuild,
fetchFromGitHub,
gzip,
unstableGitUpdater,
}:
melpaBuild {
pname = "edraw";
version = "1.2.0-unstable-2025-02-21";
src = fetchFromGitHub {
owner = "misohena";
repo = "el-easydraw";
rev = "f6b0f43138693b73cb65327d28bd2a4ee1b6caa7";
hash = "sha256-IU+DMw8q1Si3CJ4FhJVkaRsjkh1Oc3psmbzdUgh0YMI=";
};
propagatedUserEnvPkgs = [ gzip ];
files = ''(:defaults "msg")'';
passthru.updateScript = unstableGitUpdater { tagPrefix = "v"; };
meta = {
homepage = "https://github.com/misohena/el-easydraw";
description = "Embedded drawing tool for Emacs";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ brahyerr ];
};
}

View File

@@ -0,0 +1,43 @@
{
lib,
fetchFromGitHub,
libffi,
melpaBuild,
pkg-config,
}:
melpaBuild {
pname = "elisp-ffi";
ename = "ffi";
version = "1.0.0-unstable-2017-05-18";
src = fetchFromGitHub {
owner = "skeeto";
repo = "elisp-ffi";
rev = "da37c516a0e59bdce63fb2dc006a231dee62a1d9";
hash = "sha256-StOezQEnNTjRmjY02ub5FRh59aL6gWfw+qgboz0wF94=";
};
files = ''(:defaults "ffi-glue")'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libffi ];
preBuild = ''
make CXX=$CXX
'';
meta = {
homepage = "https://github.com/skeeto/elisp-ffi";
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 = lib.licenses.unlicense;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,30 @@
{
melpaBuild,
fetchFromGitHub,
git,
unstableGitUpdater,
lib,
}:
melpaBuild {
pname = "elpaca";
version = "0-unstable-2025-02-16";
src = fetchFromGitHub {
owner = "progfolio";
repo = "elpaca";
rev = "07b3a653e2411f4d4b5902af1c9b3f159e07bec5";
hash = "sha256-+YJX2BJxH3D5u7YC/yJskZu0F4Nlat3ZROe+RCZGq9w=";
};
nativeBuildInputs = [ git ];
passthru.updateScript = unstableGitUpdater { };
meta = {
homepage = "https://github.com/progfolio/elpaca";
description = "Elisp package manager";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ abhisheksingh0x558 ];
};
}

View File

@@ -0,0 +1,129 @@
{
# Basic
stdenv,
lib,
melpaBuild,
fetchFromGitHub,
symlinkJoin,
# Python dependency
python3,
# Emacs dependencies
all-the-icons,
# Other dependencies
wmctrl,
xdotool,
# Updater
unstableGitUpdater,
# Sub-applications in the framework
enabledApps ? [ ],
}:
let
appPythonDeps = map (item: item.eafPythonDeps) enabledApps;
pythonPackageLists = [
(
ps: with ps; [
epc
lxml
pyqt6
pyqt6-sip
pyqt6-webengine
sexpdata
tld
]
)
]
++ appPythonDeps;
pythonPkgs = ps: builtins.concatLists (map (f: f ps) pythonPackageLists);
pythonEnv = python3.withPackages pythonPkgs;
wmctrlExe = lib.getExe wmctrl;
xdotoolExe = lib.optionalString (lib.meta.availableOn stdenv.hostPlatform xdotool) (
lib.getExe xdotool
);
appsDrv = symlinkJoin {
name = "emacs-application-framework-apps";
paths = enabledApps;
};
in
melpaBuild (finalAttrs: {
pname = "eaf";
version = "0-unstable-2025-08-22";
src = fetchFromGitHub {
owner = "emacs-eaf";
repo = "emacs-application-framework";
rev = "dc5f6e7fa21a15b5e05c7722c2b8f32158aeab82";
hash = "sha256-wWC5Ma9p/k0GLcGpPn7NO0KqkIXmEbaQc7TJ2ImMIr4=";
};
packageRequires = [
all-the-icons
];
postPatch = ''
substituteInPlace eaf.el \
--replace-fail "\"python.exe\" \"python3\"" \
"\"python.exe\" \"${pythonEnv.interpreter}\""
substituteInPlace eaf.el \
--replace-fail "(executable-find \"wmctrl\")" \
"(executable-find \"${wmctrlExe}\")" \
--replace-fail "(shell-command-to-string \"wmctrl -m\")" \
"(shell-command-to-string \"${wmctrlExe} -m\")" \
--replace-fail "\"wmctrl -i -a \$(wmctrl -lp | awk -vpid=\$PID '\$3==%s {print \$1; exit}')\"" \
"\"${wmctrlExe} -i -a \$(${wmctrlExe} -lp | awk -vpid=\$PID '\$3==%s {print \$1; exit}')\""
substituteInPlace eaf.el \
--replace-fail "(executable-find \"xdotool\")" \
"(executable-find \"${xdotoolExe}\")" \
--replace-fail "(shell-command-to-string \"xdotool getactivewindow getwindowname\")" \
"(shell-command-to-string \"${xdotoolExe} getactivewindow getwindowname\")"
'';
files = ''
("*.el"
"*.py"
"applications.json"
"core"
"extension")
'';
preInstall = ''
EMACSLOADPATH="$EMACSLOADPATH:core/"
'';
postInstall = ''
LISPDIR=$out/share/emacs/site-lisp/elpa/${finalAttrs.ename}-${finalAttrs.melpaVersion}
APPLISPDIR=${appsDrv}/share/emacs/site-lisp/elpa
if [ -d $APPLISPDIR ]; then
cp -r $APPLISPDIR/. \
$LISPDIR/app/
fi
NATDIR=$out/share/emacs/native-lisp
APPNATDIR=${appsDrv}/share/emacs/native-lisp
if [ -d $APPNATDIR ]; then
cp -r $APPNATDIR/. \
$NATDIR/
fi
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "Extensible framework of Emacs";
homepage = "https://github.com/emacs-eaf/emacs-application-framework";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
})

View File

@@ -0,0 +1,27 @@
{
lib,
fetchFromGitHub,
melpaBuild,
unstableGitUpdater,
}:
melpaBuild {
pname = "emacs-conflict";
version = "0-unstable-2022-11-21";
src = fetchFromGitHub {
owner = "ibizaman";
repo = "emacs-conflict";
rev = "9f236b93930f3ceb4cb0258cf935c99599191de3";
hash = "sha256-DIGvnotSQYIgHxGxtyCALHd8ZbrfkmdvjLXlkcqQ6v4=";
};
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
homepage = "https://github.com/ibizaman/emacs-conflict";
description = "Resolve conflicts happening when using file synchronization tools";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ ibizaman ];
};
}

View File

@@ -0,0 +1,34 @@
{
lib,
evil,
fetchFromGitHub,
markdown-mode,
melpaBuild,
unstableGitUpdater,
}:
melpaBuild {
pname = "evil-markdown";
version = "0-unstable-2021-07-21";
src = fetchFromGitHub {
owner = "Somelauw";
repo = "evil-markdown";
rev = "8e6cc68af83914b2fa9fd3a3b8472573dbcef477";
hash = "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=";
};
packageRequires = [
evil
markdown-mode
];
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
homepage = "https://github.com/Somelauw/evil-markdown";
description = "Integrates Emacs evil and markdown";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ leungbk ];
};
}

View File

@@ -0,0 +1,25 @@
{
lib,
fetchFromGitHub,
melpaBuild,
}:
melpaBuild {
pname = "font-lock-plus";
ename = "font-lock+";
version = "208-unstable-2022-04-02";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "font-lock-plus";
rev = "aa1c82d05c9222b09099a0ccd7468e955497940c";
hash = "sha256-er+knxqAejgKAtOnhqHfsGN286biHFdeMIUlbW7JyYw=";
};
meta = {
homepage = "https://github.com/emacsmirror/font-lock-plus";
description = "Enhancements to standard library font-lock.el";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
fetchFromGitHub,
melpaBuild,
unstableGitUpdater,
}:
melpaBuild {
pname = "git-undo";
version = "0-unstable-2022-08-07";
src = fetchFromGitHub {
owner = "jwiegley";
repo = "git-undo-el";
rev = "3d9c95fc40a362eae4b88e20ee21212d234a9ee6";
hash = "sha256-xwVCAdxnIRHrFNWvtlM3u6CShsUiGgl1CiBTsp2x7IM=";
};
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
homepage = "https://github.com/jwiegley/git-undo-el";
description = "Revert region to most recent Git-historical version";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ leungbk ];
};
}

View File

@@ -0,0 +1,26 @@
{
lib,
gn,
melpaBuild,
}:
melpaBuild {
pname = "gn-mode-from-sources";
ename = "gn-mode";
version = "0-unstable-${gn.version}";
inherit (gn) src;
files = ''("misc/emacs/gn-mode.el")'';
# Fixes the malformed header error
postPatch = ''
substituteInPlace misc/emacs/gn-mode.el \
--replace-fail ";;; gn-mode.el - " ";;; gn-mode.el --- "
'';
meta = {
inherit (gn.meta) homepage license;
maintainers = with lib.maintainers; [ rennsax ];
description = "Major mode for editing GN files; taken from GN sources";
};
}

View File

@@ -0,0 +1,24 @@
{
lib,
fetchFromGitHub,
melpaBuild,
}:
melpaBuild {
pname = "grid";
version = "0-unstable-2024-05-26";
src = fetchFromGitHub {
owner = "ichernyshovvv";
repo = "grid.el";
rev = "564eccf4e009955f1a6c268382d00e157d4eb302";
hash = "sha256-3QDw4W3FbFvb2zpkDHAo9BJKxs3LaehyvUVJPKqS9RE=";
};
meta = {
homepage = "https://github.com/ichernyshovvv/grid.el";
description = "Library to put text data into boxes and manipulate them";
license = lib.licenses.gpl3Plus;
maintainers = [ ];
};
}

View File

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

View File

@@ -0,0 +1,74 @@
{
# Basic
lib,
melpaBuild,
fetchFromGitHub,
# Python dependency
python3,
# Emacs dependencies
markdown-mode,
posframe,
# Updater
unstableGitUpdater,
}:
let
pythonPkgs =
ps: with ps; [
epc
inflect
pyqt6
pyqt6-sip
sexpdata
six
xlib
];
pythonEnv = python3.withPackages pythonPkgs;
in
melpaBuild {
pname = "holo-layer";
version = "0-unstable-2025-08-13";
src = fetchFromGitHub {
owner = "manateelazycat";
repo = "holo-layer";
rev = "6584d8057a264f199e0cf6e90095fa63d36e6049";
hash = "sha256-80uGyQltHBtrEtG/hkhHP5qbBfShw5BDyfR3GUHlhJk=";
};
packageRequires = [
markdown-mode
posframe
];
postPatch = ''
substituteInPlace holo-layer.el \
--replace-fail "\"python3\"" \
"\"${pythonEnv.interpreter}\""
'';
files = ''
("*.el"
"*.py"
"icon_cache"
"plugin"
"resources"
"swaymsg-treefetch")
'';
passthru.updateScript = unstableGitUpdater { };
meta = {
description = "Display and animation extension for Emacs";
homepage = "https://github.com/manateelazycat/holo-layer";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
thattemperature
];
};
}

View File

@@ -0,0 +1,23 @@
{
melpaBuild,
haskell-mode,
haskellPackages,
}:
let
inherit (haskellPackages) hsc3;
in
melpaBuild {
pname = "hsc3-mode";
ename = "hsc3";
inherit (hsc3) src version;
files = ''("emacs/*.el")'';
packageRequires = [ haskell-mode ];
meta = {
inherit (hsc3.meta) homepage license;
description = "Emacs mode for hsc3";
};
}

View File

@@ -0,0 +1,24 @@
{
lib,
fetchFromGitHub,
melpaBuild,
}:
melpaBuild {
pname = "icicles";
version = "0-unstable-2024-10-29";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "icicles";
rev = "1c817db03aa32ef92d99661abc5e83da3188ab56";
hash = "sha256-pH4FQuAnYf8eNiwiLl+OOOxzdecrncay6TcHjNG16sk=";
};
meta = {
homepage = "https://emacswiki.org/emacs/Icicles";
description = "Emacs library that enhances minibuffer completion";
license = lib.licenses.gpl2Plus;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
fetchFromGitHub,
melpaBuild,
prop-menu,
gitUpdater,
}:
let
version = "1.1";
in
melpaBuild {
pname = "idris2-mode";
inherit version;
src = fetchFromGitHub {
owner = "idris-community";
repo = "idris2-mode";
rev = version;
hash = "sha256-rTeVjkAw44Q35vjaERs4uoZRJ6XR3FKplEUCVPHhY7Q=";
};
packageRequires = [
prop-menu
];
passthru.updateScript = gitUpdater { };
meta = {
homepage = "https://github.com/idris-community/idris2-mode";
description = "Emacs mode for editing Idris 2 code";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ wuyoli ];
};
}

View File

@@ -0,0 +1,28 @@
{
lib,
melpaBuild,
fetchFromGitHub,
unstableGitUpdater,
}:
melpaBuild {
pname = "isearch-plus";
ename = "isearch+";
version = "3434-unstable-2024-10-13";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "isearch-plus";
rev = "48f8d57a51448dd3b81c93b5f55f5eaaeee1c3f7";
hash = "sha256-jbzar5Sj7WtHOjoSe+inU6+8q7LyvYJS2DqTfzD70AQ=";
};
passthru.updateScript = unstableGitUpdater { };
meta = {
homepage = "https://www.emacswiki.org/emacs/IsearchPlus";
description = "Extensions to isearch";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ leungbk ];
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
fetchFromGitHub,
melpaBuild,
unstableGitUpdater,
}:
melpaBuild {
pname = "isearch-prop";
version = "0-unstable-2024-10-13";
src = fetchFromGitHub {
owner = "emacsmirror";
repo = "isearch-prop";
rev = "7b32697c16541036abadbbb4d65dd67a4f1d2812";
hash = "sha256-NmFkbxiRFAqi1TaOFfmAOgIs1QZMKXkJfMmXL9fsV14=";
};
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
homepage = "https://www.emacswiki.org/emacs/IsearchPlus";
description = "Search text- or overlay-property contexts";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ leungbk ];
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
melpaBuild,
fetchurl,
}:
melpaBuild 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
'';
postPatch = ''
echo ";;; jam-mode.el ---" > tmp.el
cat jam-mode.el >> tmp.el
mv tmp.el jam-mode.el
'';
meta = {
description = "Emacs major mode for editing Jam files";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ qyliss ];
};
}

View File

@@ -0,0 +1,16 @@
{ melpaBuild, llvmPackages }:
melpaBuild {
pname = "llvm-mode";
inherit (llvmPackages.llvm) src version;
files = ''
("llvm/utils/emacs/*.el"
"llvm/utils/emacs/README")
'';
meta = {
inherit (llvmPackages.llvm.meta) homepage license;
description = "Major mode for the LLVM assembler language";
};
}

View File

@@ -0,0 +1,105 @@
{
lib,
python3,
melpaBuild,
fetchFromGitHub,
replaceVars,
acm,
markdown-mode,
basedpyright,
git,
go,
gopls,
tempel,
unstableGitUpdater,
writableTmpDirAsHomeHook,
}:
let
python = python3.withPackages (
ps: with ps; [
epc
orjson
packaging
paramiko
rapidfuzz
setuptools
sexpdata
six
watchdog
]
);
in
melpaBuild {
pname = "lsp-bridge";
version = "0-unstable-2025-06-28";
src = fetchFromGitHub {
owner = "manateelazycat";
repo = "lsp-bridge";
rev = "3b37a04bd1b6bbcdc2b0ad7a5c388ad027eb7a25";
hash = "sha256-0pjRihJapljd/9nR7G+FC+gCqD82YGITPK2mcJcI7ZI=";
};
patches = [
# Hardcode the python dependencies needed for lsp-bridge, so users
# don't have to modify their global environment
(replaceVars ./hardcode-dependencies.patch {
python = python.interpreter;
})
];
packageRequires = [
acm
markdown-mode
];
checkInputs = [
# Emacs packages
tempel
];
nativeCheckInputs = [
# Executables
basedpyright
git
go
gopls
python
writableTmpDirAsHomeHook
];
files = ''
("*.el"
"lsp_bridge.py"
"core"
"langserver"
"multiserver"
"resources")
'';
doCheck = true;
checkPhase = ''
runHook preCheck
mkfifo test.log
cat < test.log &
python -m test.test
runHook postCheck
'';
__darwinAllowLocalNetworking = true;
passthru.updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
meta = {
description = "Blazingly fast LSP client for Emacs";
homepage = "https://github.com/manateelazycat/lsp-bridge";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [
fxttr
kira-bruneau
];
};
}

View File

@@ -0,0 +1,27 @@
diff --git a/lsp-bridge.el b/lsp-bridge.el
index d3e2ff7..1b1d745 100644
--- a/lsp-bridge.el
+++ b/lsp-bridge.el
@@ -417,21 +417,7 @@ LSP-Bridge will enable completion inside string literals."
"Name of LSP-Bridge buffer."
:type 'string)
-(defcustom lsp-bridge-python-command (cond ((memq system-type '(cygwin windows-nt ms-dos))
- (cond ((executable-find "pypy3.exe")
- "pypy3.exe")
- ((executable-find "python3.exe")
- "python3.exe")
- ((executable-find "python.exe")
- "python.exe")))
- (t (cond ((executable-find "python-lsp-bridge")
- "python-lsp-bridge")
- ((executable-find "pypy3")
- "pypy3")
- ((executable-find "python3")
- "python3")
- ((executable-find "python")
- "python"))))
+(defcustom lsp-bridge-python-command "@python@"
"The Python interpreter used to run lsp_bridge.py."
:type 'string)

View File

@@ -0,0 +1,39 @@
{
lib,
fetchFromGitHub,
rustPlatform,
stdenv,
}:
let
libExt = stdenv.hostPlatform.extensions.sharedLibrary;
in
rustPlatform.buildRustPackage {
pname = "lspce-module";
version = "1.1.0-unstable-2024-12-15";
src = fetchFromGitHub {
owner = "zbelial";
repo = "lspce";
rev = "45f84ce102bb34e44c39e5f437107ba786973d6f";
hash = "sha256-DiqC7z1AQbXsSXc77AGRilWi3HfEg0YoHrXu54O3Clo=";
};
cargoHash = "sha256-ygFXKniCCOyXndPOTKoRbd4W1OR2CSA2jr7yxpwkw28=";
checkFlags = [
# flaky test
"--skip=msg::tests::serialize_request_with_null_params"
];
postInstall = ''
mv --verbose $out/lib/liblspce_module${libExt} $out/lib/lspce-module${libExt}
'';
meta = {
homepage = "https://github.com/zbelial/lspce";
description = "LSP Client for Emacs implemented as a module using Rust";
license = lib.licenses.gpl3Only;
maintainers = [ ];
};
}

View File

@@ -0,0 +1,29 @@
{
lib,
callPackage,
f,
markdown-mode,
melpaBuild,
yasnippet,
}:
let
lspce-module = callPackage ./module.nix { };
in
melpaBuild {
pname = "lspce";
inherit (lspce-module) version src meta;
packageRequires = [
f
markdown-mode
yasnippet
];
# to compile lspce.el, it needs lspce-module.so
files = ''(:defaults "${lib.getLib lspce-module}/lib/lspce-module.*")'';
passthru = {
inherit lspce-module;
};
}

View File

@@ -0,0 +1,39 @@
{
lib,
lua,
melpaBuild,
pkg-config,
fetchFromGitHub,
unstableGitUpdater,
}:
melpaBuild {
pname = "lua";
version = "0-unstable-2025-01-27";
src = fetchFromGitHub {
owner = "syohex";
repo = "emacs-lua";
rev = "501189b5fc069fcead8843b2b0ad510c08de1397";
hash = "sha256-psCrto12p03R9XxPtDYTMB5vcRVWj+Blq7D30nLsSbU=";
};
preBuild = ''
make LUA_VERSION=${lua.luaversion} CC=$CC LD=$CC
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ lua ];
files = ''(:defaults "lua-core.so")'';
passthru.updateScript = unstableGitUpdater { };
meta = with lib; {
homepage = "https://github.com/syohex/emacs-lua";
description = "Lua engine from Emacs Lisp";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ nagy ];
};
}

View File

@@ -0,0 +1,33 @@
{
lib,
elpaBuild,
mu,
}:
elpaBuild {
pname = "mu4e";
version = mu.mu4e.version;
src = mu.mu4e;
propagatedUserEnvPkgs = [ mu ];
dontUnpack = false;
# prepare a multi-file package tar archive according to info
# "(elisp) Multi-file Packages" for elpaBuild to install
postBuild = ''
local content_directory=$pname-$version
mkdir $content_directory
cp --verbose share/emacs/site-lisp/mu4e/*.el $content_directory/
rm --verbose --force $content_directory/mu4e-autoloads.el
cp --verbose share/info/* $content_directory/
src=$PWD/$content_directory.tar
tar --create --verbose --file=$src $content_directory
'';
meta = removeAttrs mu.meta [ "mainProgram" ] // {
description = "Full-featured e-mail client";
maintainers = mu.meta.maintainers ++ (with lib.maintainers; [ linj ]);
};
}

View File

@@ -0,0 +1,71 @@
{
lib,
stdenv,
melpaBuild,
fetchFromGitHub,
hydra,
ivy,
pkg-config,
tclap,
unstableGitUpdater,
xapian,
# Configurable options
# Include pre-configured hydras
withHydra ? false,
# Include Ivy integration
withIvy ? false,
}:
melpaBuild {
pname = "notdeft";
version = "0-unstable-2025-02-04";
src = fetchFromGitHub {
owner = "hasu";
repo = "notdeft";
rev = "de2b6a7666e9e5010184966f89a04241f221afe3";
hash = "sha256-B8aVRb8hyAKmHTTVCtDRcb2F0Rs5zhlqyfRe7IxH5jc=";
};
packageRequires = lib.optional withHydra hydra ++ lib.optional withIvy ivy;
postPatch = ''
substituteInPlace notdeft-xapian.el \
--replace-fail 'defcustom notdeft-xapian-program nil' \
"defcustom notdeft-xapian-program \"$out/bin/notdeft-xapian\""
'';
files = ''
(:defaults
${lib.optionalString withHydra ''"extras/notdeft-global-hydra.el"''}
${lib.optionalString withHydra ''"extras/notdeft-mode-hydra.el"''}
${lib.optionalString withIvy ''"extras/notdeft-ivy.el"''})
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [
tclap
xapian
];
preBuild = ''
$CXX -std=c++11 -o notdeft-xapian xapian/notdeft-xapian.cc -lxapian
'';
preInstall = ''
install -D --target-directory=$out/bin notdeft-xapian
'';
passthru = {
updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
};
meta = {
homepage = "https://tero.hasu.is/notdeft/";
description = "Fork of Deft that uses Xapian as a search engine";
maintainers = [ lib.maintainers.nessdoor ];
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,22 @@
{ melpaBuild, ott }:
melpaBuild {
pname = "ott-mode";
inherit (ott) src version;
files = ''("emacs/*.el")'';
postPatch = ''
pushd emacs
echo ";;; ott-mode.el ---" > tmp.el
cat ott-mode.el >> tmp.el
mv tmp.el ott-mode.el
popd
'';
meta = {
description = "Emacs ott mode (from ott sources)";
inherit (ott.meta) homepage license;
};
}

View File

@@ -0,0 +1,36 @@
{
lib,
melpaBuild,
fetchurl,
}:
let
pname = "pod-mode";
version = "1.04";
src = fetchurl {
url = "mirror://cpan/authors/id/F/FL/FLORA/pod-mode-${version}.tar.gz";
hash = "sha256-W4ejlTnBKOCQWysRzrXUQwV2gFHeFpbpKkapWT2cIPM=";
};
in
melpaBuild {
inherit pname version src;
melpaVersion = "1.4"; # upstream versions such as 1.04 are not supported
outputs = [
"out"
"doc"
];
postInstall = ''
mkdir -p ''${!outputDoc}/share/doc/pod-mode/
install -Dm644 -t ''${!outputDoc}/share/doc/pod-mode/ ChangeLog README
'';
meta = {
homepage = "https://metacpan.org/dist/pod-mode";
description = "Major mode for editing .pod-files";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ qyliss ];
};
}

View File

@@ -0,0 +1,29 @@
{
lib,
fetchFromGitHub,
melpaBuild,
js2-mode,
lsp-mode,
}:
melpaBuild {
pname = "prisma-mode";
version = "0-unstable-2021-12-07";
packageRequires = [
js2-mode
lsp-mode
];
src = fetchFromGitHub {
owner = "pimeys";
repo = "emacs-prisma-mode";
rev = "5283ca7403bcb21ca0cac8ecb063600752dfd9d4";
hash = "sha256-DJJfjbu27Gi7Nzsa1cdi8nIQowKH8ZxgQBwfXLB0Q/I=";
};
meta = {
description = "Major mode for Prisma Schema Language";
license = lib.licenses.gpl2Only;
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
melpaBuild,
fetchurl,
}:
melpaBuild {
pname = "prolog-mode";
ename = "prolog";
version = "1.28";
src = fetchurl {
url = "https://bruda.ca/_media/emacs/prolog.el";
hash = "sha256-ZzIDFQWPq1vI9z3btgsHgn0axN6uRQn9Tt8TnqGybOk=";
};
postPatch = ''
substituteInPlace prolog.el \
--replace-fail ";; prolog.el ---" ";;; prolog.el ---"
'';
meta = {
homepage = "https://bruda.ca/emacs/prolog_mode_for_emacs/";
description = "Prolog mode for Emacs";
license = lib.licenses.gpl2Plus;
};
}

View File

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

View File

@@ -0,0 +1,31 @@
{
melpaBuild,
fetchzip,
lib,
}:
melpaBuild rec {
pname = "session-management-for-emacs";
ename = "session";
version = "2.2a";
melpaVersion = "2.2"; # default value derived from version is not valid for Emacs
src = fetchzip {
url = "mirror://sourceforge/emacs-session/session-${version}.tar.gz";
hash = "sha256-lc6NIX+lx97qCs5JqG7x0iVE6ki09Gy7DEQuPW2c+7s=";
};
# https://github.com/NixOS/nixpkgs/issues/335421
ignoreCompilationError = true;
meta = {
/*
installation: add to your ~/.emacs
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
*/
description = "Small session management for emacs";
homepage = "https://emacs-session.sourceforge.net/";
license = lib.licenses.gpl2;
};
}

View File

@@ -0,0 +1,30 @@
{
melpaBuild,
fetchFromGitHub,
git,
unstableGitUpdater,
lib,
}:
melpaBuild {
pname = "straight";
version = "0-unstable-2025-01-30";
src = fetchFromGitHub {
owner = "radian-software";
repo = "straight.el";
rev = "44a866f28f3ded6bcd8bc79ddc73b8b5044de835";
hash = "sha256-riKagjhCn5NyTerw1WqGOn37TZNfmhPb7DS49TXw1CA=";
};
nativeBuildInputs = [ git ];
passthru.updateScript = unstableGitUpdater { };
meta = {
homepage = "https://github.com/radian-software/straight.el";
description = "Next-generation, purely functional package manager for the Emacs hacker";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ abhisheksingh0x558 ];
};
}

View File

@@ -0,0 +1,26 @@
{
lib,
melpaBuild,
fetchFromGitHub,
}:
melpaBuild {
pname = "sunrise-commander";
ename = "sunrise";
version = "0-unstable-2021-09-27";
src = fetchFromGitHub {
owner = "sunrise-commander";
repo = "sunrise-commander";
rev = "16e6df7e86c7a383fb4400fae94af32baf9cb24e";
hash = "sha256-D36qiRi5OTZrBtJ/bD/javAWizZ8NLlC/YP4rdLCSsw=";
};
meta = {
homepage = "https://github.com/sunrise-commander/sunrise-commander/";
description = "Orthodox (two-pane) file manager for Emacs";
license = lib.licenses.gpl3Plus;
maintainers = [ ];
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,22 @@
{
lib,
fetchurl,
melpaBuild,
}:
melpaBuild {
pname = "sv-kalender";
version = "1.11";
src = fetchurl {
url = "https://raw.githubusercontent.com/emacsmirror/emacswiki.org/ec4fa36bdba5d2c5c4f5e0400a70768c10e969e8/sv-kalender.el";
hash = "sha256-VXz3pO6N94XM8FzLSAoYrj3NEh4wp0UiuG6ad8M7nVU=";
};
meta = {
homepage = "https://www.emacswiki.org/emacs/sv-kalender.el";
description = "Swedish calendar for Emacs";
license = lib.licenses.gpl3Plus;
maintainers = [ lib.maintainers.rycee ];
};
}

View File

@@ -0,0 +1,18 @@
{
lib,
melpaBuild,
texpresso,
}:
melpaBuild {
pname = "texpresso";
version = texpresso.version;
src = texpresso.src;
files = ''("emacs/*.el")'';
meta = {
inherit (texpresso.meta) homepage license;
description = "Emacs mode for TeXpresso";
maintainers = [ lib.maintainers.alexarice ];
};
}

View File

@@ -0,0 +1,33 @@
[
"tree-sitter-bash",
"tree-sitter-c",
"tree-sitter-c-sharp",
"tree-sitter-cpp",
"tree-sitter-css",
"tree-sitter-elixir",
"tree-sitter-elm",
"tree-sitter-go",
"tree-sitter-haskell",
"tree-sitter-hcl",
"tree-sitter-html",
"tree-sitter-janet-simple",
"tree-sitter-java",
"tree-sitter-javascript",
"tree-sitter-jsdoc",
"tree-sitter-json",
"tree-sitter-julia",
"tree-sitter-nix",
"tree-sitter-ocaml",
"tree-sitter-perl",
"tree-sitter-pgn",
"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-yaml",
"tree-sitter-zig"
]

View File

@@ -0,0 +1,57 @@
{
lib,
stdenv,
melpaStablePackages,
runCommand,
tree-sitter-grammars,
plugins ? map (g: tree-sitter-grammars.${g}) (lib.importJSON ./default-grammars.json),
final,
}:
let
inherit (melpaStablePackages) tree-sitter-langs;
langName = g: lib.removeSuffix "-grammar" (lib.removePrefix "tree-sitter-" g.pname);
soName = g: langName g + stdenv.hostPlatform.extensions.sharedLibrary;
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)
);
siteDir = "$out/share/emacs/site-lisp/elpa/${tree-sitter-langs.pname}-${tree-sitter-langs.version}";
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\""
'';
postInstall =
old.postInstall or ""
+ lib.concatStringsSep "\n" (
map (g: ''
if [[ -d "${g}/queries" ]]; then
mkdir -p ${siteDir}/queries/${langName g}/
for f in ${g}/queries/*; do
ln -sfn "$f" ${siteDir}/queries/${langName g}/
done
fi
'') plugins
);
passthru = old.passthru or { } // {
inherit plugins;
withPlugins = fn: final.tree-sitter-langs.override { plugins = fn tree-sitter-grammars; };
};
})

View File

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

Some files were not shown because too many files have changed in this diff Show More