Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3742338
D4903.id15843.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4903.id15843.diff
View Options
diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix
--- a/nix/dev-shell.nix
+++ b/nix/dev-shell.nix
@@ -98,21 +98,9 @@
JAVA_HOME = openjdk8.passthru.home;
# shell commands to be ran upon entering shell
- shellHook = let
- socket = "mysql.sock";
- in ''
- if [[ "$OSTYPE" == 'linux'* ]]; then
- export MYSQL_UNIX_PORT=''${XDG_RUNTIME_DIR:-/run/user/$UID}/${socket}
- export ANDROID_SDK_ROOT=''${ANDROID_SDK_ROOT:-$HOME/Android/Sdk}
- fi
-
- if [[ "$OSTYPE" == 'darwin'* ]]; then
- # Many commands for cocoapods expect the native BSD versions of commands
- export PATH=/usr/bin:$PATH
- MARIADB_DIR=''${XDG_DATA_HOME:-$HOME/.local/share}/MariaDB
- export MYSQL_UNIX_PORT="$MARIADB_DIR"/${socket}
- export ANDROID_SDK_ROOT=''${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}
- fi
+ shellHook = ''
+ # Set development environment variable defaults
+ source "${../scripts/source_development_defaults.sh}"
# Provide decent bash prompt
source "${better-prompt}/bin/better-prompt"
diff --git a/scripts/source_development_defaults.sh b/scripts/source_development_defaults.sh
new file mode 100644
--- /dev/null
+++ b/scripts/source_development_defaults.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+if [[ "$OSTYPE" == 'linux'* ]]; then
+ export MYSQL_UNIX_PORT=${XDG_RUNTIME_DIR:-/run/user/$UID}/mysql.sock
+ export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-$HOME/Android/Sdk}
+fi
+
+if [[ "$OSTYPE" == 'darwin'* ]]; then
+ # Many commands for cocoapods expect the native BSD versions of commands
+ export PATH="/usr/bin:$PATH"
+ MARIADB_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/MariaDB
+ export MYSQL_UNIX_PORT="$MARIADB_DIR"/mysql.sock
+ export ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}
+fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 1:11 PM (15 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2850379
Default Alt Text
D4903.id15843.diff (1 KB)
Attached To
Mode
D4903: [Nix] Factor out dev env variable logic to another file
Attached
Detach File
Event Timeline
Log In to Comment