chore(nix): add minio to shell.nix
This commit is contained in:
parent
da1bf86d5e
commit
a8b96a6f95
29
shell.nix
29
shell.nix
@ -19,7 +19,7 @@ let
|
||||
'';
|
||||
|
||||
override = oldAttrs: {
|
||||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; [ nodejs-13_x postgresql openldap google-chrome exiftool memcached ]) ++ (with pkgs.haskellPackages; [ stack yesod-bin hlint cabal-install weeder profiteur ]);
|
||||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (with pkgs; [ nodejs-13_x postgresql openldap google-chrome exiftool memcached minio minio-client ]) ++ (with pkgs.haskellPackages; [ stack yesod-bin hlint cabal-install weeder profiteur ]);
|
||||
shellHook = ''
|
||||
export PROMPT_INFO="${oldAttrs.name}"
|
||||
|
||||
@ -31,6 +31,7 @@ let
|
||||
type cleanup_widget_memcached &>/dev/null && cleanup_widget_memcached
|
||||
type cleanup_session_memcached &>/dev/null && cleanup_session_memcached
|
||||
type cleanup_cache_memcached &>/dev/null && cleanup_cache_memcached
|
||||
type cleanup_minio &>/dev/null && cleanup_minio
|
||||
set +x
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ let
|
||||
memcached_pid=$?
|
||||
|
||||
cleanup_session_memcached() {
|
||||
[[ -n "memcached_pid" ]] && kill memcached_pid
|
||||
[[ -n "$memcached_pid" ]] && kill $memcached_pid
|
||||
}
|
||||
|
||||
export MEMCACHED_HOST=localhost MEMCACHED_PORT=11212
|
||||
@ -103,6 +104,30 @@ let
|
||||
set +xe
|
||||
fi
|
||||
|
||||
if [[ -z "$UPLOAD_S3_URL" ]]; then
|
||||
set -xe
|
||||
|
||||
cleanup_minio() {
|
||||
[[ -n "$minio_pid" ]] && kill $minio_pid
|
||||
[[ -n "$minio_dir" ]] && rm -rvf ''${minio_dir}
|
||||
[[ -n "MINIO_LOGFILE" ]] && rm -rvf ''${MINIO_LOGFILE}
|
||||
}
|
||||
|
||||
minio_dir=$(mktemp -d)
|
||||
export MINIO_LOGFILE=$(mktemp --tmpdir minio.XXXXXX.log)
|
||||
|
||||
minio server --address localhost:9000 ''${minio_dir} &>''${MINIO_LOGFILE} &
|
||||
minio_pid=$?
|
||||
|
||||
sleep 1
|
||||
|
||||
export UPLOAD_S3_URL=http://localhost:9000
|
||||
export UPLOAD_S3_KEY_ID=$(${pkgs.jq}/bin/jq -r '.credential.accessKey' ''${minio_dir}/.minio.sys/config/config.json)
|
||||
export UPLOAD_S3_KEY=$(${pkgs.jq}/bin/jq -r '.credential.secretKey' ''${minio_dir}/.minio.sys/config/config.json)
|
||||
|
||||
set +xe
|
||||
fi
|
||||
|
||||
if [ -n "$ZSH_VERSION" ]; then
|
||||
autoload -U +X compinit && compinit
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
|
||||
Loading…
Reference in New Issue
Block a user