{ config, lib, pkgs, ... }: with lib; { options = { environment.binbash.enable = mkOption { default = true; type = types.bool; description = '' Include a /bin/bash in the system. ''; }; environment.binbash.bash = mkOption { type = types.package; default = pkgs.bashInteractive; defaultText = literalExpression "pkgs.bashInteractive"; example = literalExpression "pkgs.bash"; description = lib.mdDoc '' The bash implementation that will be present in `/bin/bash` after enabling this option. ''; }; }; config = { system.activationScripts.binbash = if config.environment.binbash.enable then '' mkdir -m 0755 -p /bin ln -sfn ${config.environment.binbash.bash}/bin/bash /bin/.bash.tmp mv /bin/.bash.tmp /bin/bash # atomically replace /usr/bin/env '' else '' rm -f /bin/bash ''; }; }