mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-30 14:15:55 +00:00
android: change nix config logic (#888)
This commit is contained in:
@@ -4,17 +4,12 @@ set -eu
|
||||
|
||||
u="$USER"
|
||||
tmp=$(mktemp -d -t)
|
||||
conf="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
commands="nix git gradle unzip curl"
|
||||
|
||||
nix_setup() {
|
||||
nix_install() {
|
||||
# Pre-setup nix
|
||||
[ ! -d /nix ] && sudo sh -c "mkdir -p /nix && chown -R $u /nix"
|
||||
|
||||
[ ! -d "$conf/nix" ] && mkdir -p "$conf/nix"
|
||||
|
||||
printf "sandbox = true\nmax-jobs = auto\nexperimental-features = nix-command flakes\nextra-substituters = https://cache.zw3rk.com\ntrusted-public-keys = loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" > "$conf/nix/nix.conf"
|
||||
|
||||
# Install nix
|
||||
curl -L https://nixos.org/nix/install -o "$tmp/nix-install"
|
||||
chmod +x "$tmp/nix-install" && "$tmp/nix-install" --no-daemon
|
||||
@@ -22,6 +17,11 @@ nix_setup() {
|
||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
||||
}
|
||||
|
||||
nix_setup() {
|
||||
printf "sandbox = true\nmax-jobs = auto\nexperimental-features = nix-command flakes\nextra-substituters = https://cache.zw3rk.com\ntrusted-public-keys = loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=" > "$tmp/nix.conf"
|
||||
export NIX_CONF_DIR="$tmp/nix.conf"
|
||||
}
|
||||
|
||||
git_setup() {
|
||||
# Clone simplex
|
||||
git clone https://github.com/simplex-chat/simplex-chat "$tmp/simplex-chat"
|
||||
@@ -34,22 +34,22 @@ git_setup() {
|
||||
}
|
||||
|
||||
checks() {
|
||||
for i in $commands; do
|
||||
case $i in
|
||||
nix)
|
||||
if ! command -v "$i" > /dev/null 2>&1 || [ ! -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
nix_setup
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if ! command -v "$i" > /dev/null 2>&1; then
|
||||
commands_failed="$i $commands_failed"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
set +u
|
||||
for i in $commands; do
|
||||
case $i in
|
||||
nix)
|
||||
if ! command -v "$i" > /dev/null 2>&1 || [ ! -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
nix_install
|
||||
fi
|
||||
nix_setup
|
||||
;;
|
||||
*)
|
||||
if ! command -v "$i" > /dev/null 2>&1; then
|
||||
commands_failed="$i $commands_failed"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$commands_failed" ]; then
|
||||
commands_failed=${commands_failed% *}
|
||||
|
||||
Reference in New Issue
Block a user