Skip to content

Commit 4afb052

Browse files
authored
add Nix derivation workaround (#91)
1 parent 44f94c3 commit 4afb052

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scripts/build_nim.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/usr/bin/env bash
2-
# used in Travis CI and AppVeyor scripts
3-
4-
# Copyright (c) 2018-2020 Status Research & Development GmbH. Licensed under
2+
# Copyright (c) 2018-2024 Status Research & Development GmbH. Licensed under
53
# either of:
64
# - Apache License, version 2.0
75
# - MIT license
86
# at your option. This file may not be copied, modified, or distributed except
97
# according to those terms.
108

11-
set -e
9+
set -eo pipefail
1210

1311
# NIM_COMMIT could be a (partial) commit hash, a tag, a branch name, etc. Empty by default.
1412
NIM_COMMIT_HASH="" # full hash for NIM_COMMIT, retrieved in "nim_needs_rebuilding()"
@@ -121,7 +119,14 @@ build_nim() {
121119
# Otherwise, when updating from pre-v2.0.10 to v2.0.10 or later,
122120
# https://github.com/nim-lang/Nim/issues/24173 occurs. Simulates
123121
# https://github.com/nim-lang/Nim/pull/24189 as a workaround.
124-
rm -rf dist/checksums
122+
#
123+
# When building Nimbus from a Nix derivation which adds this as part of
124+
# a preBuild phase, do not use this hack, because it's both unnecessary
125+
# and prevents Nim from building.
126+
NIX_BUILD_TOP="${NIX_BUILD_TOP:-}"
127+
if [[ "${NIX_BUILD_TOP}" != "/build" ]]; then
128+
rm -rf dist/checksums
129+
fi
125130

126131
if grep -q skipIntegrityCheck koch.nim; then
127132
# Run Nim buildchain, with matching dependency versions

0 commit comments

Comments
 (0)