diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-06-04 22:34:28 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-06-07 23:26:31 -0300 |
commit | 5d68e9014cf30d00218d9a03e21d67d696115a41 (patch) | |
tree | c3faa8cb3f1039ddc86e63cf90eb7de9846ad17e /pkgs/build-support | |
parent | e5e43e6beb418dbd2900fb692b1e8e6585f2cbcb (diff) |
build-support/emacs: synchronize with emacs' modified attributes
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/emacs/generic.nix | 17 | ||||
-rw-r--r-- | pkgs/build-support/emacs/wrapper.nix | 41 |
2 files changed, 20 insertions, 38 deletions
diff --git a/pkgs/build-support/emacs/generic.nix b/pkgs/build-support/emacs/generic.nix index e3d1505dde879..add8fb5525f99 100644 --- a/pkgs/build-support/emacs/generic.nix +++ b/pkgs/build-support/emacs/generic.nix @@ -2,32 +2,25 @@ { lib, stdenv, emacs, texinfo, writeText, gcc, ... }: -with lib; - { pname , version ? null - , buildInputs ? [] , packageRequires ? [] - , meta ? {} - , ... }@args: let - defaultMeta = { broken = false; platforms = emacs.meta.platforms; - } // optionalAttrs ((args.src.meta.homepage or "") != "") { + } // lib.optionalAttrs ((args.src.meta.homepage or "") != "") { homepage = args.src.meta.homepage; }; - in stdenv.mkDerivation ({ - name = "emacs-${pname}${optionalString (version != null) "-${version}"}"; + name = "emacs-${pname}${lib.optionalString (version != null) "-${version}"}"; unpackCmd = '' case "$curSrc" in @@ -68,7 +61,7 @@ stdenv.mkDerivation ({ meta = defaultMeta // meta; } -// lib.optionalAttrs (emacs.nativeComp or false) { +// lib.optionalAttrs (emacs.withNativeCompilation or false) { LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib"; @@ -90,6 +83,4 @@ stdenv.mkDerivation ({ ''; } -// removeAttrs args [ "buildInputs" "packageRequires" - "meta" - ]) +// removeAttrs args [ "buildInputs" "packageRequires" "meta" ]) diff --git a/pkgs/build-support/emacs/wrapper.nix b/pkgs/build-support/emacs/wrapper.nix index bd7702ebb9162..4c30a06571220 100644 --- a/pkgs/build-support/emacs/wrapper.nix +++ b/pkgs/build-support/emacs/wrapper.nix @@ -32,34 +32,25 @@ in customEmacsPackages.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) */ -{ lib, lndir, makeWrapper, runCommand, gcc }: self: - -with lib; - +{ lib, lndir, makeWrapper, runCommand, gcc }: +self: let - inherit (self) emacs; - - nativeComp = emacs.nativeComp or false; - - treeSitter = emacs.treeSitter or false; - + withNativeCompilation = emacs.withNativeCompilation or false; + withTreeSitter = emacs.withTreeSitter or false; in - packagesFun: # packages explicitly requested by the user - let explicitRequires = if lib.isFunction packagesFun - then packagesFun self + then packagesFun self else packagesFun; in - runCommand - (appendToName "with-packages" emacs).name + (lib.appendToName "with-packages" emacs).name { - nativeBuildInputs = [ emacs lndir makeWrapper ]; inherit emacs explicitRequires; + nativeBuildInputs = [ emacs lndir makeWrapper ]; preferLocalBuild = true; allowSubstitutes = false; @@ -69,8 +60,8 @@ runCommand deps = runCommand "emacs-packages-deps" ({ inherit explicitRequires lndir emacs; - nativeBuildInputs = lib.optional nativeComp gcc; - } // lib.optionalAttrs nativeComp { + nativeBuildInputs = lib.optional withNativeCompilation gcc; + } // lib.optionalAttrs withNativeCompilation { inherit (emacs) LIBRARY_PATH; }) '' @@ -110,10 +101,10 @@ runCommand } mkdir -p $out/bin mkdir -p $out/share/emacs/site-lisp - ${optionalString nativeComp '' + ${lib.optionalString withNativeCompilation '' mkdir -p $out/share/emacs/native-lisp ''} - ${optionalString treeSitter '' + ${lib.optionalString withTreeSitter '' mkdir -p $out/lib ''} @@ -137,10 +128,10 @@ runCommand linkEmacsPackage() { linkPath "$1" "bin" "bin" linkPath "$1" "share/emacs/site-lisp" "share/emacs/site-lisp" - ${optionalString nativeComp '' + ${lib.optionalString withNativeCompilation '' linkPath "$1" "share/emacs/native-lisp" "share/emacs/native-lisp" ''} - ${optionalString treeSitter '' + ${lib.optionalString withTreeSitter '' linkPath "$1" "lib" "lib" ''} } @@ -171,10 +162,10 @@ runCommand (load-file "$emacs/share/emacs/site-lisp/site-start.el")) (add-to-list 'load-path "$out/share/emacs/site-lisp") (add-to-list 'exec-path "$out/bin") - ${optionalString nativeComp '' + ${lib.optionalString withNativeCompilation '' (add-to-list 'native-comp-eln-load-path "$out/share/emacs/native-lisp/") ''} - ${optionalString treeSitter '' + ${lib.optionalString withTreeSitter '' (add-to-list 'treesit-extra-load-path "$out/lib/") ''} EOF @@ -189,7 +180,7 @@ runCommand # Byte-compiling improves start-up time only slightly, but costs nothing. $emacs/bin/emacs --batch -f batch-byte-compile "$siteStart" "$subdirs" - ${optionalString nativeComp '' + ${lib.optionalString withNativeCompilation '' $emacs/bin/emacs --batch \ --eval "(add-to-list 'native-comp-eln-load-path \"$out/share/emacs/native-lisp/\")" \ -f batch-native-compile "$siteStart" "$subdirs" |