// SPDX-FileCopyrightText: 2023 Luke Granger-Brown // // SPDX-License-Identifier: Apache-2.0 package nixbuild type State int const ( // Does this path (or path(s)) exist on the target already? StateCheckingOnTarget State = iota StateDoneAlreadyExisted StateResolvingOnTarget StateDoneResolvedOnTarget // Does this path exist in any configured resolvers? StateCheckingResolvers StateFetchingReferencesFromResolvers StateFetchingFromResolver StateDoneFromResolver // If we don't have the derivation for this path, fetch it. // This state only matters if we only have the path and not the derivation. StateLookingUpDerivation StateChoosingBuilder StateResolvingReferencesOnBuilder StateCopyingReferencesToBuilder StateBuildingDerivation StateCopying StateDoneBuilt StateFailed ) func (s State) String() string { return map[State]string{ StateCheckingOnTarget: "checking if already on target", StateDoneAlreadyExisted: "done (already on target)", StateResolvingOnTarget: "resolving on target", StateDoneResolvedOnTarget: "done (resolved on target)", StateCheckingResolvers: "checking if present on any resolvers", StateFetchingReferencesFromResolvers: "copying references from resolvers", StateFetchingFromResolver: "copying from resolver", StateDoneFromResolver: "done (copied from resolver)", StateLookingUpDerivation: "looking up derivation", StateChoosingBuilder: "picking a builder", StateResolvingReferencesOnBuilder: "resolving build-time references on builder", StateCopyingReferencesToBuilder: "copying build-time references to builder", StateBuildingDerivation: "building", StateCopying: "copying from builder", StateDoneBuilt: "done (built)", StateFailed: "failed :(", }[s] } func (s State) Terminal() bool { switch s { case StateDoneAlreadyExisted, StateDoneResolvedOnTarget, StateDoneFromResolver, StateDoneBuilt, StateFailed: return true } return false }