mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
07a0031029
Emacs packages are commonly distributed as single .el files. This unpackCmd handles them correctly and sets up sourceRoot. Other sources are treated in the default manner.
58 lines
1 KiB
Nix
58 lines
1 KiB
Nix
# generic builder for Emacs packages
|
|
|
|
{ lib, stdenv, emacs, texinfo }:
|
|
|
|
with lib;
|
|
|
|
{ pname
|
|
, version ? null
|
|
|
|
, buildInputs ? []
|
|
, packageRequires ? []
|
|
|
|
, meta ? {}
|
|
|
|
, ...
|
|
}@args:
|
|
|
|
let
|
|
|
|
defaultMeta = {
|
|
broken = false;
|
|
platforms = emacs.meta.platforms;
|
|
} // optionalAttrs ((args.src.meta.homepage or "") != "") {
|
|
homepage = args.src.meta.homepage;
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
|
name = "emacs-${pname}${optionalString (version != null) "-${version}"}";
|
|
|
|
unpackCmd = ''
|
|
case "$curSrc" in
|
|
*.el)
|
|
cp $curSrc $pname.el
|
|
chmod +w $pname.el
|
|
sourceRoot="."
|
|
;;
|
|
*)
|
|
_defaultUnpack "$curSrc"
|
|
;;
|
|
esac
|
|
'';
|
|
|
|
buildInputs = [emacs texinfo] ++ packageRequires ++ buildInputs;
|
|
propagatedBuildInputs = packageRequires;
|
|
propagatedUserEnvPkgs = packageRequires;
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
doCheck = false;
|
|
|
|
meta = defaultMeta // meta;
|
|
}
|
|
|
|
// removeAttrs args [ "buildInputs" "packageRequires"
|
|
"meta"
|
|
])
|