blob: 30114ba8c68f764431d3b53b5b540c627f3bfbd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
{ config, lib, pkgs, ... }:
let
bashProfileContent = pkgs.writeText "bash_profile" ''
# Written once by home-manager (modules/home/bash-profile.nix) so login
# shells actually source ~/.bashrc — NixOS and other Linux distros don't
# ship a ~/.bash_profile that does this by default. Only created if it
# didn't already exist; home-manager never touches it again after that,
# so it's yours to edit.
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
'';
in
{
home.activation.bashProfile = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
BASH_PROFILE=${lib.escapeShellArg "${config.home.homeDirectory}/.bash_profile"}
if [ ! -e "$BASH_PROFILE" ]; then
$DRY_RUN_CMD ${pkgs.coreutils}/bin/install -m 644 ${bashProfileContent} "$BASH_PROFILE"
fi
'';
}
|