Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/e193a3ab3c3a608fb9b1d7b34c9623b5 to your computer and use it in GitHub Desktop.
Save ivan/e193a3ab3c3a608fb9b1d7b34c9623b5 to your computer and use it in GitHub Desktop.
nixpkgs patch to make NixOS also create a /bin/bash, for compatibility with everyone's bad shebang lines
From ec04e3f0df7615cd3fd05155636c52fc0e8469b7 Mon Sep 17 00:00:00 2001
From: Ivan Kozik <ivan@ludios.org>
Date: Sat, 22 Apr 2023 17:06:58 +0000
Subject: [PATCH] nixos/environment: also create a /bin/bash
---
nixos/modules/config/shells-environment.nix | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index bc6583442edf..1e315cbad88e 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -217,6 +217,9 @@ in
mkdir -m 0755 -p /bin
ln -sfn "${cfg.binsh}" /bin/.sh.tmp
mv /bin/.sh.tmp /bin/sh # atomically replace /bin/sh
+
+ ln -sfn "${pkgs.bashInteractive}/bin/bash" /bin/.bash.tmp
+ mv /bin/.bash.tmp /bin/bash # atomically replace /bin/bash
'';
};
--
2.39.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment