2019-04-04 11:33:38 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
# Installs nix on a fresh machine
|
|
|
|
set -exuo pipefail
|
|
|
|
|
2019-04-04 14:03:56 +03:00
|
|
|
## Functions ##
|
|
|
|
|
|
|
|
step() {
|
|
|
|
echo "step: $*" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
## Main ##
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
step "Installing Nix"
|
|
|
|
|
2019-04-04 11:33:38 +03:00
|
|
|
sudo mkdir -p /nix
|
|
|
|
sudo chown "$(id -u):$(id -g)" /nix
|
|
|
|
curl -sfL https://nixos.org/nix/install | bash
|
2019-04-04 14:03:56 +03:00
|
|
|
|
|
|
|
# shellcheck source=../dev-env/lib/ensure-nix
|
|
|
|
source dev-env/lib/ensure-nix
|
|
|
|
|
2019-04-04 15:47:32 +03:00
|
|
|
export NIX_CONF_DIR=$PWD/dev-env/etc
|
|
|
|
|
2019-04-04 14:03:56 +03:00
|
|
|
step "Building dev-env dependencies"
|
|
|
|
nix-build nix -A tools -A cached
|