Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/b4f63df08cd5ef74fc33f684b86166f4 to your computer and use it in GitHub Desktop.
Save ivan/b4f63df08cd5ef74fc33f684b86166f4 to your computer and use it in GitHub Desktop.
nixpkgs: zsh: don't load the annoying newuser module
From c22f21a459fcf72843ed904b4f3a02edc417478a Mon Sep 17 00:00:00 2001
From: Ivan Kozik <ivan@ludios.org>
Date: Sat, 24 Aug 2019 14:58:00 +0000
Subject: [PATCH] zsh: don't load the annoying newuser module
---
pkgs/shells/zsh/default.nix | 4 ++
pkgs/shells/zsh/dont-load-newuser.patch | 51 +++++++++++++++++++++++++
2 files changed, 55 insertions(+)
create mode 100644 pkgs/shells/zsh/dont-load-newuser.patch
diff --git a/pkgs/shells/zsh/default.nix b/pkgs/shells/zsh/default.nix
index 71f526525e4..6dab3eff5e6 100644
--- a/pkgs/shells/zsh/default.nix
+++ b/pkgs/shells/zsh/default.nix
@@ -18,6 +18,10 @@ stdenv.mkDerivation {
sha256 = "09yyaadq738zlrnlh1hd3ycj1mv3q5hh4xl1ank70mjnqm6bbi6w";
};
+ patches = [
+ ./dont-load-newuser.patch
+ ];
+
buildInputs = [ ncurses pcre ];
configureFlags = [
diff --git a/pkgs/shells/zsh/dont-load-newuser.patch b/pkgs/shells/zsh/dont-load-newuser.patch
new file mode 100644
index 00000000000..9acf31d2a00
--- /dev/null
+++ b/pkgs/shells/zsh/dont-load-newuser.patch
@@ -0,0 +1,51 @@
+From f96963f6315d96e0d95aa6195a9b305f759d86be Mon Sep 17 00:00:00 2001
+From: Ivan Kozik <ivan@ludios.org>
+Date: Sat, 24 Aug 2019 14:54:18 +0000
+Subject: [PATCH] Patch out the very annoying newuser routine
+
+This is the Z Shell configuration function for new users,
+zsh-newuser-install.
+You are seeing this message because you have no zsh startup files
+(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
+~). This function can help you with a few settings that should
+make your use of the shell easier.
+
+You can:
+
+(q) Quit and do nothing. The function will be run again next time.
+
+(0) Exit, creating the file ~/.zshrc containing just a comment.
+ That will prevent this function being run again.
+
+(1) Continue to the main menu.
+
+--- Type one of the keys in parentheses ---
+---
+ Src/init.c | 11 -----------
+ 1 file changed, 11 deletions(-)
+
+diff --git a/Src/init.c b/Src/init.c
+index 445cd3937..5acb08317 100644
+--- a/Src/init.c
++++ b/Src/init.c
+@@ -1310,17 +1310,6 @@ run_init_scripts(void)
+
+ if (isset(RCS) && unset(PRIVILEGED))
+ {
+- if (interact) {
+- /*
+- * Always attempt to load the newuser module to perform
+- * checks for new zsh users. Don't care if we can't load it.
+- */
+- if (!load_module("zsh/newuser", NULL, 1)) {
+- /* Unload it immediately. */
+- unload_named_module("zsh/newuser", "zsh", 1);
+- }
+- }
+-
+ sourcehome(".zshenv");
+ }
+ if (islogin) {
+--
+2.22.0
+
--
2.31.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment