aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home/bash-profile.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home/bash-profile.nix')
-rw-r--r--modules/home/bash-profile.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/home/bash-profile.nix b/modules/home/bash-profile.nix
new file mode 100644
index 0000000..30114ba
--- /dev/null
+++ b/modules/home/bash-profile.nix
@@ -0,0 +1,21 @@
1{ config, lib, pkgs, ... }:
2let
3 bashProfileContent = pkgs.writeText "bash_profile" ''
4 # Written once by home-manager (modules/home/bash-profile.nix) so login
5 # shells actually source ~/.bashrc — NixOS and other Linux distros don't
6 # ship a ~/.bash_profile that does this by default. Only created if it
7 # didn't already exist; home-manager never touches it again after that,
8 # so it's yours to edit.
9 if [ -f "$HOME/.bashrc" ]; then
10 . "$HOME/.bashrc"
11 fi
12 '';
13in
14{
15 home.activation.bashProfile = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
16 BASH_PROFILE=${lib.escapeShellArg "${config.home.homeDirectory}/.bash_profile"}
17 if [ ! -e "$BASH_PROFILE" ]; then
18 $DRY_RUN_CMD ${pkgs.coreutils}/bin/install -m 644 ${bashProfileContent} "$BASH_PROFILE"
19 fi
20 '';
21}