The Nix build previously fetched Go modules from goproxy.cn and Python build deps from PyPI during the build phase, relying on network leaking into the sandbox. This is non-reproducible and breaks whenever the sandbox resolver is unreachable (e.g. pc13v's loopback dnsmasq). Go: - Vendor all three modules (frontend/apiserver, frontend/xcecli, autoscaler/providers/baidu/src/bcctool) and commit vendor/ trees. - tools/go_build now builds with GOFLAGS=-mod=vendor and GOPROXY=off instead of GOPROXY=https://goproxy.cn. Python (xceadmin): - Add setuptools + wheel to xce.nix nativeBuildInputs. - meson-build.sh installs with pip --no-build-isolation --no-index --no-deps so no PyPI access happens at build time. xceadmin install script: - Invoke meson-install.sh via find_program('bash') instead of relying on its #!/usr/bin/env bash shebang, which fails in the Nix install sandbox (no /usr/bin/env -> 'could not be run'). Cleanup: - Drop now-unneeded cacert and impureEnvVars=[HOME] from xce.nix and xcecli.nix (they only existed to enable the impure network fetch). Docs: - README build guide: drop '--option sandbox false' from nix build / nix bundle commands, note the build is now hermetic, and document the go mod vendor + git add vendor/ maintenance workflow. Verified: nix build .#xcecore, .#xcecore_debug, .#xcecli, and .#xce all succeed with the sandbox enabled.
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
pkgs,
|
|
myCommitId,
|
|
myDirtyFingerprint,
|
|
...
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "xcecli";
|
|
version = "0.0.1";
|
|
|
|
src = ./..;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
meson
|
|
ninja
|
|
go
|
|
# cacert removed: Go build is now offline (vendored, GOPROXY=off) --
|
|
# see nixSupport/xce.nix and tools/go_build.
|
|
which
|
|
findutils
|
|
];
|
|
|
|
build-system = [ pkgs.meson ];
|
|
|
|
# impureEnvVars = [ "HOME" ] removed: offline vendored Go build needs no
|
|
# host env; tools/go_build sets its own HOME. See nixSupport/xce.nix.
|
|
|
|
# See xce.nix for why build_time is computed here (build phase) rather
|
|
# than at flake-evaluation time.
|
|
preConfigure = ''
|
|
buildTime="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
if [ -z "$buildTime" ]; then
|
|
echo "xcecli.nix: date -u produced an empty build time -- the -Dbuild_time= meson option would not reach the binary" >&2
|
|
exit 1
|
|
fi
|
|
mesonFlagsArray+=("-Dbuild_time=$buildTime")
|
|
'';
|
|
|
|
mesonFlags = [
|
|
"-Dcomponent=xcecli"
|
|
("-Dcommit_id=" + myCommitId)
|
|
# dirty-content-fingerprint task 2.2: eval-time, plain mesonFlags entry
|
|
# -- mirrors -Dcommit_id= above, NOT the preConfigure/mesonFlagsArray
|
|
# build-phase mechanism reserved for build_time (see preConfigure above).
|
|
("-Ddirty_fingerprint=" + myDirtyFingerprint)
|
|
];
|
|
}
|