Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set LANG and LOCALE_ARCHIVE for nix shell #2719

Merged
merged 2 commits into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,24 @@ let
''
echo "
Commands:
* nix flake update --update-input <iohkNix|haskellNix> - update imput
* nix flake update --update-input <iohkNix|haskellNix> - update input
* cardano-cli - used for key generation and other operations tasks
* wb - cluster workbench
* start-cluster - start a local development cluster
* stop-cluster - stop a local development cluster

"
'';
# Test cases will assume a UTF-8 locale and provide text in this character encoding.
# So force the character encoding to UTF-8 and provide locale data.
setLocale =
''
export LANG="en_US.UTF-8"
'' + lib.optionalString haveGlibcLocales ''
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"
'';

haveGlibcLocales = pkgs.glibcLocales != null && stdenv.hostPlatform.libc == "glibc";

# This provides a development environment that can be used with nix-shell or
# lorri. See https://input-output-hk.github.io/haskell.nix/user-guide/development/
Expand Down Expand Up @@ -81,7 +91,7 @@ let
tmux
pkgs.git
pkgs.hlint
]
] ++ lib.optional haveGlibcLocales pkgs.glibcLocales
## Workbench's main script is called directly in dev mode.
++ lib.optionals (!workbenchDevMode)
[
Expand Down Expand Up @@ -113,6 +123,8 @@ let
''}
unset NIX_ENFORCE_PURITY

${setLocale}

${lib.optionalString autoStartCluster ''
echo "workbench: starting cluster (because 'autoStartCluster' is true):"
start-cluster
Expand Down Expand Up @@ -152,6 +164,8 @@ let
# Socket path default to first node launched by "start-cluster":
export CARDANO_NODE_SOCKET_PATH=$(wb backend get-node-socket-path ${cluster.stateDir})

${setLocale}

# Unless using specific network:
${lib.optionalString (__hasAttr "network" customConfig) ''
export CARDANO_NODE_SOCKET_PATH="$PWD/state-node-${customConfig.network}/node.socket"
Expand Down