diff options
author | Jan Malakhovski <oxij@oxij.org> | 2014-01-20 23:57:04 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2015-03-03 16:02:15 +0000 |
commit | e4a4e109ba49f3868f63a61e514c4846a1cd0b9a (patch) | |
tree | 66eea07b9a477857ed69dbd44bd153dbd78d1007 /pkgs/build-support | |
parent | a444eff3f29c292ffb62700572cbd4c9cdb3718b (diff) | |
download | nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar.gz nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar.bz2 nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar.lz nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar.xz nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.tar.zst nixlib-e4a4e109ba49f3868f63a61e514c4846a1cd0b9a.zip |
refactor Emacs packages'/modes' builders
This simplifies melpa builder by merging with it my old emacs modes builder, adds better instructions and support for overrides in emacs-packages.nix, and renames some emacs-related stuff in all-packages.nix for sanity reasons. I declare this backwards compatible since direct uses of emacsPackages in configuration.nix are very unlikely.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/emacs/generic.nix | 41 | ||||
-rw-r--r-- | pkgs/build-support/emacs/melpa.nix | 63 | ||||
-rw-r--r-- | pkgs/build-support/emacs/trivial.nix | 34 |
3 files changed, 88 insertions, 50 deletions
diff --git a/pkgs/build-support/emacs/generic.nix b/pkgs/build-support/emacs/generic.nix new file mode 100644 index 000000000000..be81e93e32ae --- /dev/null +++ b/pkgs/build-support/emacs/generic.nix @@ -0,0 +1,41 @@ +# 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; + }; +in + +stdenv.mkDerivation ({ + name = "emacs-${pname}${optionalString (version != null) "-${version}"}"; + + buildInputs = [emacs texinfo] ++ packageRequires ++ buildInputs; + propagatedBuildInputs = packageRequires; + propagatedUserEnvPkgs = packageRequires; + + setupHook = ./setup-hook.sh; + + doCheck = false; + + meta = defaultMeta // meta; +} + +// removeAttrs args [ "buildInputs" "packageRequires" + "meta" + ]) diff --git a/pkgs/build-support/emacs/melpa.nix b/pkgs/build-support/emacs/melpa.nix index 11cb14f93db4..607a1b4a5ef6 100644 --- a/pkgs/build-support/emacs/melpa.nix +++ b/pkgs/build-support/emacs/melpa.nix @@ -1,14 +1,12 @@ -# generic builder for Emacs packages +# builder for Emacs packages built for packages.el +# using MELPA package-build.el -{ stdenv, fetchurl, emacs, texinfo -, extension ? (self : super : {}) -}: +{ lib, stdenv, fetchurl, emacs, texinfo }: + +with lib; { pname , version -, src -, packageRequires ? [] -, extraBuildInputs ? [] , files ? null , fileSpecs ? [ "*.el" "*.el.in" "dir" @@ -18,19 +16,12 @@ , meta ? {} -, preUnpack ? "", postUnpack ? "" -, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? "" -, configureFlags ? [], preConfigure ? "", postConfigure ? "" -, buildPhase ? "", preBuild ? "", postBuild ? "" -, preInstall ? "", postInstall ? "" -, doCheck ? false, checkPhase ? "", preCheck ? "", postCheck ? "" -, preFixup ? "", postFixup ? "" -}: +, ... +}@args: let - inherit (stdenv.lib) concatStringsSep optionalAttrs; - packageBuild = fetchurl { + packageBuild = fetchurl { url = https://raw.githubusercontent.com/milkypostman/melpa/12a862e5c5c62ce627dab83d7cf2cca6e8b56c47/package-build.el; sha256 = "1nviyyprypz7nmam9rwli4yv3kxh170glfbznryrp4czxkrjjdhk"; }; @@ -40,23 +31,13 @@ let targets = concatStringsSep " " (if files == null then fileSpecs else files); defaultMeta = { - broken = false; homepage = "http://melpa.org/#/${pname}"; - platforms = emacs.meta.platforms; }; in -stdenv.mkDerivation ({ - name = "emacs-${fname}"; - - inherit src packageBuild; - - buildInputs = [emacs texinfo] ++ packageRequires ++ extraBuildInputs; - propagatedBuildInputs = packageRequires; - propagatedUserEnvPkgs = packageRequires; - - setupHook = ./setup-hook.sh; +import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ + inherit packageBuild; buildPhase = '' runHook preBuild @@ -81,24 +62,6 @@ stdenv.mkDerivation ({ meta = defaultMeta // meta; } -// optionalAttrs (preUnpack != "") { inherit preUnpack; } -// optionalAttrs (postUnpack != "") { inherit postUnpack; } -// optionalAttrs (configureFlags != []) { inherit configureFlags; } -// optionalAttrs (patches != []) { inherit patches; } -// optionalAttrs (patchPhase != "") { inherit patchPhase; } -// optionalAttrs (prePatch != "") { inherit prePatch; } -// optionalAttrs (postPatch != "") { inherit postPatch; } -// optionalAttrs (preConfigure != "") { inherit preConfigure; } -// optionalAttrs (postConfigure != "") { inherit postConfigure; } -// optionalAttrs (buildPhase != "") { inherit buildPhase; } -// optionalAttrs (preBuild != "") { inherit preBuild; } -// optionalAttrs (postBuild != "") { inherit postBuild; } -// optionalAttrs (doCheck) { inherit doCheck; } -// optionalAttrs (checkPhase != "") { inherit checkPhase; } -// optionalAttrs (preCheck != "") { inherit preCheck; } -// optionalAttrs (postCheck != "") { inherit postCheck; } -// optionalAttrs (preInstall != "") { inherit preInstall; } -// optionalAttrs (postInstall != "") { inherit postInstall; } -// optionalAttrs (preFixup != "") { inherit preFixup; } -// optionalAttrs (postFixup != "") { inherit postFixup; } -) +// removeAttrs args [ "files" "fileSpecs" + "meta" + ]) diff --git a/pkgs/build-support/emacs/trivial.nix b/pkgs/build-support/emacs/trivial.nix new file mode 100644 index 000000000000..9c97e8bf9514 --- /dev/null +++ b/pkgs/build-support/emacs/trivial.nix @@ -0,0 +1,34 @@ +# trivial builder for Emacs packages + +{ lib, ... }@envargs: + +with lib; + +args: + +import ./generic.nix envargs ({ + #preConfigure = '' + # export LISPDIR=$out/share/emacs/site-lisp + # export VERSION_SPECIFIC_LISPDIR=$out/share/emacs/site-lisp + #''; + + buildPhase = '' + eval "$preBuild" + + emacs -L . --batch -f batch-byte-compile *.el + + eval "$postBuild" + ''; + + installPhase = '' + eval "$preInstall" + + LISPDIR=$out/share/emacs/site-lisp + install -d $LISPDIR + install *.el *.elc $LISPDIR + + eval "$postInstall" + ''; +} + +// args) |