tangled
alpha
login
or
join now
dunkirk.sh
/
dots
3
fork
atom
Kieran's opinionated (and probably slightly dumb) nix config
3
fork
atom
overview
issues
pulls
pipelines
feat: allow sourcing .env files
dunkirk.sh
1 month ago
a9b8ab72
8dd2ae10
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+15
1 changed file
expand all
collapse all
unified
split
modules
home
system
shell.nix
+15
modules/home/system/shell.nix
···
1057
1057
alias -g NUL='>/dev/null 2>&1'
1058
1058
alias -g J='| jq'
1059
1059
1060
1060
+
# Override source to handle .env files safely
1061
1061
+
function source() {
1062
1062
+
if [[ "$1" == *.env ]]; then
1063
1063
+
[[ ! -f "$1" ]] && { echo "File not found: $1" >&2; return 1; }
1064
1064
+
while IFS= read -r line || [[ -n "$line" ]]; do
1065
1065
+
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
1066
1066
+
if [[ "$line" =~ ^([a-zA-Z_][a-zA-Z0-9_]*)=(.*)$ ]]; then
1067
1067
+
export "''${match[1]}=''${match[2]}"
1068
1068
+
fi
1069
1069
+
done < "$1"
1070
1070
+
else
1071
1071
+
builtin source "$@"
1072
1072
+
fi
1073
1073
+
}
1074
1074
+
1060
1075
# OSC 52 clipboard (works over SSH)
1061
1076
function osc52copy() {
1062
1077
local data=$(cat "$@" | base64 | tr -d '\n')