FG42/nix/fg42.nix

101 lines
2.1 KiB
Nix

# Fg42 - Emacs Editor for advance users
#
# Copyright (c) 2010-2023 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,
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 = (x: if hasAttr x emacsPackages
then getAttr x emacsPackages
else getAttr x ourPackages);
epkgs = (map getEpkg elispPkgs);
in stdenv.mkDerivation (final: rec{
pname = "fg42";
version = "4.0.0";
src = srcDir;
outputs = [ "out" ];
FG42_USE_NIX = true;
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
'';
# scripts = symlinkJoin {
# name = "fg42_scripts";
# paths = [
# editor
# wm
# ];
# };
#nativeBuildInputs = deps;
buildInputs = epkgs ++ [
ripgrep
git
texinfo
vazir-fonts
fira-code
nerdfonts
#scripts
];
# depsTargetTarget = [
# pkgs.emacs
# ];
})