about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/emacs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
commitf34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch)
tree32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/build-support/emacs
parent003ab91dd67b093890db1dd0bab564345db6e496 (diff)
parent7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff)
downloadnixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/build-support/emacs')
-rw-r--r--nixpkgs/pkgs/build-support/emacs/elpa.nix24
-rw-r--r--nixpkgs/pkgs/build-support/emacs/generic.nix56
-rw-r--r--nixpkgs/pkgs/build-support/emacs/melpa.nix61
-rw-r--r--nixpkgs/pkgs/build-support/emacs/trivial.nix2
4 files changed, 70 insertions, 73 deletions
diff --git a/nixpkgs/pkgs/build-support/emacs/elpa.nix b/nixpkgs/pkgs/build-support/emacs/elpa.nix
index f7027dc499d8..a43578fd3936 100644
--- a/nixpkgs/pkgs/build-support/emacs/elpa.nix
+++ b/nixpkgs/pkgs/build-support/emacs/elpa.nix
@@ -2,7 +2,11 @@
 
 { lib, stdenv, emacs, texinfo, writeText, gcc }:
 
-with lib;
+let
+  handledArgs = [ "files" "fileSpecs" "meta" ];
+  genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; };
+
+in
 
 { pname
 , version
@@ -11,15 +15,7 @@ with lib;
 , ...
 }@args:
 
-let
-
-  defaultMeta = {
-    homepage = args.src.meta.homepage or "https://elpa.gnu.org/packages/${pname}.html";
-  };
-
-in
-
-import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
+genericBuild ({
 
   dontUnpack = true;
 
@@ -33,9 +29,9 @@ import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
     runHook postInstall
   '';
 
-  meta = defaultMeta // meta;
+  meta = {
+    homepage = args.src.meta.homepage or "https://elpa.gnu.org/packages/${pname}.html";
+  } // meta;
 }
 
-// removeAttrs args [ "files" "fileSpecs"
-                      "meta"
-                    ])
+// removeAttrs args handledArgs)
diff --git a/nixpkgs/pkgs/build-support/emacs/generic.nix b/nixpkgs/pkgs/build-support/emacs/generic.nix
index 291f45d513b7..bdf1cd4e50f3 100644
--- a/nixpkgs/pkgs/build-support/emacs/generic.nix
+++ b/nixpkgs/pkgs/build-support/emacs/generic.nix
@@ -2,6 +2,26 @@
 
 { lib, stdenv, emacs, texinfo, writeText, gcc, ... }:
 
+let
+  inherit (lib) optionalAttrs getLib;
+  handledArgs = [ "buildInputs" "packageRequires" "meta" ];
+
+  setupHook = writeText "setup-hook.sh" ''
+    source ${./emacs-funcs.sh}
+
+    if [[ ! -v emacsHookDone ]]; then
+      emacsHookDone=1
+
+      # If this is for a wrapper derivation, emacs and the dependencies are all
+      # run-time dependencies. If this is for precompiling packages into bytecode,
+      # emacs is a compile-time dependency of the package.
+      addEnvHooks "$hostOffset" addEmacsVars
+      addEnvHooks "$targetOffset" addEmacsVars
+    fi
+  '';
+
+in
+
 { pname
 , version
 , buildInputs ? []
@@ -10,15 +30,6 @@
 , ...
 }@args:
 
-let
-  defaultMeta = {
-    broken = false;
-    platforms = emacs.meta.platforms;
-  } // lib.optionalAttrs ((args.src.meta.homepage or "") != "") {
-    homepage = args.src.meta.homepage;
-  };
-in
-
 stdenv.mkDerivation (finalAttrs: ({
   name = "emacs-${pname}-${finalAttrs.version}";
 
@@ -42,28 +53,21 @@ stdenv.mkDerivation (finalAttrs: ({
   propagatedBuildInputs = packageRequires;
   propagatedUserEnvPkgs = packageRequires;
 
-  setupHook = writeText "setup-hook.sh" ''
-    source ${./emacs-funcs.sh}
-
-    if [[ ! -v emacsHookDone ]]; then
-      emacsHookDone=1
-
-      # If this is for a wrapper derivation, emacs and the dependencies are all
-      # run-time dependencies. If this is for precompiling packages into bytecode,
-      # emacs is a compile-time dependency of the package.
-      addEnvHooks "$hostOffset" addEmacsVars
-      addEnvHooks "$targetOffset" addEmacsVars
-    fi
-  '';
+  inherit setupHook;
 
   doCheck = false;
 
-  meta = defaultMeta // meta;
+  meta = {
+    broken = false;
+    platforms = emacs.meta.platforms;
+  } // optionalAttrs ((args.src.meta.homepage or "") != "") {
+    homepage = args.src.meta.homepage;
+  } // meta;
 }
 
-// lib.optionalAttrs (emacs.withNativeCompilation or false) {
+// optionalAttrs (emacs.withNativeCompilation or false) {
 
-  LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib";
+  LIBRARY_PATH = "${getLib stdenv.cc.libc}/lib";
 
   nativeBuildInputs = [ gcc ];
 
@@ -83,4 +87,4 @@ stdenv.mkDerivation (finalAttrs: ({
   '';
 }
 
-// removeAttrs args [ "buildInputs" "packageRequires" "meta" ]))
+// removeAttrs args handledArgs))
diff --git a/nixpkgs/pkgs/build-support/emacs/melpa.nix b/nixpkgs/pkgs/build-support/emacs/melpa.nix
index 85bc8aa37b3a..178f532d0871 100644
--- a/nixpkgs/pkgs/build-support/emacs/melpa.nix
+++ b/nixpkgs/pkgs/build-support/emacs/melpa.nix
@@ -3,37 +3,8 @@
 
 { lib, stdenv, fetchFromGitHub, emacs, texinfo, writeText, gcc }:
 
-with lib;
-
-{ /*
-    pname: Nix package name without special symbols and without version or
-    "emacs-" prefix.
-  */
-  pname
-  /*
-    ename: Original Emacs package name, possibly containing special symbols.
-  */
-, ename ? null
-, version
-, recipe
-, meta ? {}
-, ...
-}@args:
-
 let
-
-  defaultMeta = {
-    homepage = args.src.meta.homepage or "https://melpa.org/#/${pname}";
-  };
-
-in
-
-import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
-
-  ename =
-    if ename == null
-    then pname
-    else ename;
+  genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; };
 
   packageBuild = stdenv.mkDerivation {
     name = "package-build";
@@ -55,9 +26,35 @@ import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
     ";
   };
 
+in
+
+{ /*
+    pname: Nix package name without special symbols and without version or
+    "emacs-" prefix.
+  */
+  pname
+  /*
+    ename: Original Emacs package name, possibly containing special symbols.
+  */
+, ename ? null
+, version
+, recipe
+, meta ? {}
+, ...
+}@args:
+
+genericBuild ({
+
+  ename =
+    if ename == null
+    then pname
+    else ename;
+
   elpa2nix = ./elpa2nix.el;
   melpa2nix = ./melpa2nix.el;
 
+  inherit packageBuild;
+
   preUnpack = ''
     mkdir -p "$NIX_BUILD_TOP/recipes"
     if [ -n "$recipe" ]; then
@@ -104,7 +101,9 @@ import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; } ({
     runHook postInstall
   '';
 
-  meta = defaultMeta // meta;
+  meta = {
+    homepage = args.src.meta.homepage or "https://melpa.org/#/${pname}";
+  } // meta;
 }
 
 // removeAttrs args [ "meta" ])
diff --git a/nixpkgs/pkgs/build-support/emacs/trivial.nix b/nixpkgs/pkgs/build-support/emacs/trivial.nix
index abe4d761c6b5..11c28c0133e4 100644
--- a/nixpkgs/pkgs/build-support/emacs/trivial.nix
+++ b/nixpkgs/pkgs/build-support/emacs/trivial.nix
@@ -2,8 +2,6 @@
 
 { callPackage, lib, ... }@envargs:
 
-with lib;
-
 args:
 
 callPackage ./generic.nix envargs ({