mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
bash: remove unnecessary shebang and executable bit for dotfiles (#2599)
This commit is contained in:
parent
89bdef7994
commit
c2f151258a
3 changed files with 13 additions and 6 deletions
|
@ -6,6 +6,13 @@ let
|
|||
|
||||
cfg = config.programs.bash;
|
||||
|
||||
writeBashScript = name: text: pkgs.writeTextFile {
|
||||
inherit name text;
|
||||
checkPhase = ''
|
||||
${pkgs.stdenv.shell} -n $out
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -178,7 +185,7 @@ in
|
|||
}
|
||||
));
|
||||
in mkIf cfg.enable {
|
||||
home.file.".bash_profile".source = pkgs.writeShellScript "bash_profile" ''
|
||||
home.file.".bash_profile".source = writeBashScript "bash_profile" ''
|
||||
# include .profile if it exists
|
||||
[[ -f ~/.profile ]] && . ~/.profile
|
||||
|
||||
|
@ -186,7 +193,7 @@ in
|
|||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
'';
|
||||
|
||||
home.file.".profile".source = pkgs.writeShellScript "profile" ''
|
||||
home.file.".profile".source = writeBashScript "profile" ''
|
||||
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
|
||||
|
||||
${sessionVarsStr}
|
||||
|
@ -194,7 +201,7 @@ in
|
|||
${cfg.profileExtra}
|
||||
'';
|
||||
|
||||
home.file.".bashrc".source = pkgs.writeShellScript "bashrc" ''
|
||||
home.file.".bashrc".source = writeBashScript "bashrc" ''
|
||||
${cfg.bashrcExtra}
|
||||
|
||||
# Commands that should be applied only for interactive shells.
|
||||
|
@ -210,7 +217,7 @@ in
|
|||
'';
|
||||
|
||||
home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") {
|
||||
source = pkgs.writeShellScript "bash_logout" cfg.logoutExtra;
|
||||
source = writeBashScript "bash_logout" cfg.logoutExtra;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ with lib;
|
|||
assertFileContent \
|
||||
home-files/.bash_logout \
|
||||
${
|
||||
pkgs.writeShellScript "logout-expected" ''
|
||||
builtins.toFile "logout-expected" ''
|
||||
clear-console
|
||||
''
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ with lib;
|
|||
assertFileContent \
|
||||
home-files/.profile \
|
||||
${
|
||||
pkgs.writeShellScript "session-variables-expected" ''
|
||||
builtins.toFile "session-variables-expected" ''
|
||||
. "/home/hm-user/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
|
||||
export V1="v1"
|
||||
|
|
Loading…
Reference in a new issue