Kieran's opinionated (and probably slightly dumb) nix config

feat: allow sourcing .env files

dunkirk.sh a9b8ab72 8dd2ae10

verified
+15
+15
modules/home/system/shell.nix
··· 1057 1057 alias -g NUL='>/dev/null 2>&1' 1058 1058 alias -g J='| jq' 1059 1059 1060 + # Override source to handle .env files safely 1061 + function source() { 1062 + if [[ "$1" == *.env ]]; then 1063 + [[ ! -f "$1" ]] && { echo "File not found: $1" >&2; return 1; } 1064 + while IFS= read -r line || [[ -n "$line" ]]; do 1065 + [[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue 1066 + if [[ "$line" =~ ^([a-zA-Z_][a-zA-Z0-9_]*)=(.*)$ ]]; then 1067 + export "''${match[1]}=''${match[2]}" 1068 + fi 1069 + done < "$1" 1070 + else 1071 + builtin source "$@" 1072 + fi 1073 + } 1074 + 1060 1075 # OSC 52 clipboard (works over SSH) 1061 1076 function osc52copy() { 1062 1077 local data=$(cat "$@" | base64 | tr -d '\n')