From 69bda6c84d88c96ece9e119ff3cf04905963b2e2 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Thu, 28 Aug 2025 03:10:09 +0800 Subject: [PATCH 1/2] Revert "emacs: replace `fetchFromSavannah` with mirror; adjust build" This reverts commit a019344338d84d8e6a79ab0a5a1ede443234e331. This commit needs some fixes. Compared to adding fixes, I think it is more clear and easier to read to revert it first and re-apply this commit together with fixes as a whole. --- pkgs/applications/editors/emacs/default.nix | 2 +- pkgs/applications/editors/emacs/make-emacs.nix | 14 +++++++++----- pkgs/applications/editors/emacs/sources.nix | 10 +++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/default.nix index e36142b300dd..cc604b222f32 100644 --- a/pkgs/applications/editors/emacs/default.nix +++ b/pkgs/applications/editors/emacs/default.nix @@ -13,7 +13,7 @@ lib.makeScope pkgs.newScope ( inherit lib; inherit (pkgs) fetchFromBitbucket - fetchurl + fetchFromSavannah ; }; diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index be728c1a3a1a..e088d9610b70 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -69,6 +69,7 @@ # Boolean flags withNativeCompilation ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, noGui ? false, + srcRepo ? true, withAcl ? false, withAlsaLib ? false, withAthena ? false, @@ -199,11 +200,9 @@ mkDerivation (finalAttrs: { ]; postPatch = lib.concatStringsSep "\n" [ - - # See: https://github.com/NixOS/nixpkgs/issues/170426 - '' - find . -type f \( -name "*.elc" -o -name "*loaddefs.el" \) -exec rm {} \; - '' + (lib.optionalString srcRepo '' + rm -fr .git + '') # Add the name of the wrapped gvfsd # This used to be carried as a patch but it often got out of sync with @@ -248,6 +247,11 @@ mkDerivation (finalAttrs: { nativeBuildInputs = [ makeWrapper pkg-config + ] + ++ lib.optionals (variant == "macport") [ + texinfo + ] + ++ lib.optionals srcRepo [ autoreconfHook texinfo ] diff --git a/pkgs/applications/editors/emacs/sources.nix b/pkgs/applications/editors/emacs/sources.nix index 38864a90e221..c706d8ecc276 100644 --- a/pkgs/applications/editors/emacs/sources.nix +++ b/pkgs/applications/editors/emacs/sources.nix @@ -1,7 +1,7 @@ { lib, fetchFromBitbucket, - fetchurl, + fetchFromSavannah, }: let @@ -26,9 +26,9 @@ let src = { "mainline" = ( - fetchurl { - url = "mirror://gnu/emacs/emacs-${rev}.tar.xz"; - inherit hash; + fetchFromSavannah { + repo = "emacs"; + inherit rev hash; } ); "macport" = ( @@ -108,7 +108,7 @@ in version = "30.2"; variant = "mainline"; rev = "30.2"; - hash = "sha256-s/NvGKbdJxVxM3AWYlfeL64B+dOM/oeM7Zsebe1b79k="; + hash = "sha256-3Lfb3HqdlXqSnwJfxe7npa4GGR9djldy8bKRpkQCdSA="; patches = fetchpatch: [ (builtins.path { name = "inhibit-lexical-cookie-warning-67916.patch"; From 4a2ad8134b8b40f198c71f7d8d84467d250cd714 Mon Sep 17 00:00:00 2001 From: Jasi Date: Thu, 28 Aug 2025 03:27:51 +0800 Subject: [PATCH 2/2] emacs: replace fetchFromSavannah with mirror This commit re-apply a019344338d84d8e6a79ab0a5a1ede443234e331 with fixes and minor improvements. Refs: #427024 #435964 Co-authored-by: Lin Jian --- pkgs/applications/editors/emacs/default.nix | 2 +- pkgs/applications/editors/emacs/make-emacs.nix | 7 ++++++- pkgs/applications/editors/emacs/sources.nix | 12 ++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/default.nix index cc604b222f32..1ac714c15575 100644 --- a/pkgs/applications/editors/emacs/default.nix +++ b/pkgs/applications/editors/emacs/default.nix @@ -13,7 +13,7 @@ lib.makeScope pkgs.newScope ( inherit lib; inherit (pkgs) fetchFromBitbucket - fetchFromSavannah + fetchzip ; }; diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index e088d9610b70..b9f75464c793 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -69,7 +69,7 @@ # Boolean flags withNativeCompilation ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, noGui ? false, - srcRepo ? true, + srcRepo ? false, withAcl ? false, withAlsaLib ? false, withAthena ? false, @@ -204,6 +204,11 @@ mkDerivation (finalAttrs: { rm -fr .git '') + # See: https://github.com/NixOS/nixpkgs/issues/170426 + (lib.optionalString (!srcRepo) '' + find . -type f \( -name "*.elc" -o -name "*loaddefs.el" \) -exec rm {} \; + '') + # Add the name of the wrapped gvfsd # This used to be carried as a patch but it often got out of sync with # upstream and was hard to maintain for emacs-overlay. diff --git a/pkgs/applications/editors/emacs/sources.nix b/pkgs/applications/editors/emacs/sources.nix index c706d8ecc276..d3fb3da3b599 100644 --- a/pkgs/applications/editors/emacs/sources.nix +++ b/pkgs/applications/editors/emacs/sources.nix @@ -1,7 +1,7 @@ { lib, fetchFromBitbucket, - fetchFromSavannah, + fetchzip, }: let @@ -26,9 +26,9 @@ let src = { "mainline" = ( - fetchFromSavannah { - repo = "emacs"; - inherit rev hash; + fetchzip { + url = "mirror://gnu/emacs/${rev}.tar.xz"; + inherit hash; } ); "macport" = ( @@ -107,8 +107,8 @@ in pname = "emacs"; version = "30.2"; variant = "mainline"; - rev = "30.2"; - hash = "sha256-3Lfb3HqdlXqSnwJfxe7npa4GGR9djldy8bKRpkQCdSA="; + rev = "emacs-30.2"; + hash = "sha256-W2eZ+cNQhi/fMeRkwOqSKU7Vzvp43WUOpiwaLLNEXtg="; patches = fetchpatch: [ (builtins.path { name = "inhibit-lexical-cookie-warning-67916.patch";