summary refs log tree commit diff
path: root/pkgs/build-support/emacs/melpa.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/emacs/melpa.nix')
-rw-r--r--pkgs/build-support/emacs/melpa.nix40
1 files changed, 20 insertions, 20 deletions
diff --git a/pkgs/build-support/emacs/melpa.nix b/pkgs/build-support/emacs/melpa.nix
index 8fd2a00b50a..3b8a23d8c2a 100644
--- a/pkgs/build-support/emacs/melpa.nix
+++ b/pkgs/build-support/emacs/melpa.nix
@@ -28,8 +28,6 @@ let
     sha256 = "1biwg2pqmmdz5iwqbjdszljazqymvgyyjcnc255nr6qz8mhnx67j";
   };
 
-  fname = "${pname}-${version}";
-
   targets = concatStringsSep " " (if files == null then fileSpecs else files);
 
   defaultMeta = {
@@ -41,31 +39,33 @@ in
 import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
   inherit packageBuild;
 
-  buildPhase = ''
-    runHook preBuild
+  buildPhase =
+    if recipeFile == null
+      then ''
+        runHook preBuild
 
-    emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-    ${if recipeFile == null
-      then
-      ''
-      -f melpa2nix-build-package \
-      ${pname} ${version} ${targets}
-      ''
-      else
+        export archive=$(emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
+            -f melpa2nix-build-package \
+            ${pname} ${version} ${targets})
+
+        runHook postBuild
       ''
-      -f melpa2nix-build-package-from-recipe \
-      ${pname} ${version} ${recipeFile}
-      ''}
+      else ''
+        runHook preBuild
 
-    runHook postBuild
-  '';
+        export archive=$(emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
+            -f melpa2nix-build-package-from-recipe \
+            ${recipeFile} ${version})
+
+        runHook postBuild
+      '';
 
   installPhase = ''
     runHook preInstall
 
-    emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \
-      -f melpa2nix-install-package \
-      ${fname}.* $out/share/emacs/site-lisp/elpa
+    emacs --batch -Q -l ${./elpa2nix.el} \
+        -f elpa2nix-install-package \
+        "$archive" "$out/share/emacs/site-lisp/elpa"
 
     runHook postInstall
   '';