cmd/nix-tool: disable binary cache for chroot store

This commit is contained in:
Ophestra 2025-07-20 14:16:00 +09:00
parent 5f8b5bcb3d
commit 0d5e7f61fc
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
2 changed files with 19 additions and 1 deletions

View File

@ -39,7 +39,14 @@ func main() {
var extraArgs []string
flagStore = strings.TrimSpace(flagStore)
if flagStore != string(os.PathSeparator) {
extraArgs = append(extraArgs, "--store", flagStore)
extraArgs = append(extraArgs,
"--store", flagStore,
// do not use any binary cache
nix.FlagOption, nix.OptionBuildUseSubstitutes, nix.ValueFalse,
nix.FlagOption, nix.OptionSubstituters, "",
nix.FlagOption, nix.OptionTrustedSubstituters, "",
nix.FlagOption, nix.OptionTrustedPublicKeys, "",
)
}
var stderr io.Writer

View File

@ -91,6 +91,17 @@ const (
// Certain commands wont have to evaluate when invoked for the second time with a particular version of a flake.
// Intermediate results are not cached.
OptionEvalCache = "eval-cache"
// OptionBuildUseSubstitutes if set to true (default), Nix will use binary substitutes if available.
// This option can be disabled to force building from source.
OptionBuildUseSubstitutes = "build-use-substitutes"
// OptionSubstituters a list of URLs of Nix stores to be used as substituters, separated by whitespace.
// A substituter is an additional store from which Nix can obtain store objects instead of building them.
OptionSubstituters = "substituters"
// OptionTrustedSubstituters a list of Nix store URLs, separated by whitespace.
//These are not used by default, but users of the Nix daemon can enable them by specifying substituters.
OptionTrustedSubstituters = "trusted-substituters"
// OptionTrustedPublicKeys a whitespace-separated list of public keys.
OptionTrustedPublicKeys = "trusted-public-keys"
ValueTrue = "true"
ValueFalse = "false"