FG42/nix/fg42.nix

96 lines
2.0 KiB
Nix

# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{
stdenv,
elispPkgs,
srcDir,
emacsPackagesFor,
emacsPackages,
ourPackages,
writeScriptBin,
symlinkJoin,
# This is a set of system tools required for FG42
# to work.
emacs,
ripgrep,
git,
texinfo,
vazir-fonts,
fira-code,
nerdfonts,
}:
with builtins;
let
getEpkg = epkgs: x:
if hasAttr x epkgs
then getAttr x epkgs
else getAttr x ourPackages;
epkgSet = emacsPackagesFor emacs;
#epkgs = (map getEpkg elispPkgs);
emacsBundle = epkgSet.emacsWithPackages (epkgs:
(map (getEpkg epkgs) elispPkgs)
);
in stdenv.mkDerivation (final: rec{
pname = "fg42";
version = "4.0.0";
src = srcDir;
outputs = [ "out" ];
buildPhase = ''
mkdir -p $out/fg42
mkdir -p $out/bin/
cp -rv ${src}/core $out/fg42/
cp -rv ${src}/share $out/
runHook preBuild
cd $out/fg42
emacs -L . --batch -f batch-byte-compile *.el
cd -
cp -v ${src}/fg42-config.el $out/fg42/
runHook postBuild
'';
installPhase = ''
runHook preInstall
# LISPDIR=$out/share/emacs/site-lisp
# install -d $LISPDIR
# install *.el *.elc $LISPDIR
emacs --batch -l package --eval "(package-generate-autoloads \"${pname}\" \"$out/fg42\")"
runHook postInstall
'';
propagatedUserEnvPkgs = [
emacsBundle
ripgrep
git
texinfo
vazir-fonts
fira-code
nerdfonts
];
buildInputs = propagatedUserEnvPkgs;
emacsInUse = emacsBundle;
})