|
| 1 | +{-| |
| 2 | +Description : Metadata about Nix store paths. |
| 3 | +-} |
| 4 | +module System.Nix.StorePathMetadata where |
| 5 | + |
| 6 | +import System.Nix.StorePath (StorePath, StorePathSet, ContentAddressableAddress) |
| 7 | +import System.Nix.Hash (SomeNamedDigest) |
| 8 | +import Data.Set (Set) |
| 9 | +import Data.Time (UTCTime) |
| 10 | +import Data.Word (Word64) |
| 11 | +import System.Nix.Signature (NarSignature) |
| 12 | + |
| 13 | +-- | Metadata about a 'StorePath' in @storeDir@. |
| 14 | +data StorePathMetadata storeDir = StorePathMetadata |
| 15 | + { -- | The path this metadata is about |
| 16 | + path :: !(StorePath storeDir) |
| 17 | + , -- | The path to the derivation file that built this path, if any |
| 18 | + -- and known. |
| 19 | + deriverPath :: !(Maybe (StorePath storeDir)) |
| 20 | + , -- TODO should this be optional? |
| 21 | + -- | The hash of the nar serialization of the path. |
| 22 | + narHash :: !SomeNamedDigest |
| 23 | + , -- | The paths that this path directly references |
| 24 | + references :: !(StorePathSet storeDir) |
| 25 | + , -- | When was this path registered valid in the store? |
| 26 | + registrationTime :: !UTCTime |
| 27 | + , -- | The size of the nar serialization of the path, in bytes. |
| 28 | + narBytes :: !(Maybe Word64) |
| 29 | + , -- | How much we trust this path. |
| 30 | + trust :: !StorePathTrust |
| 31 | + , -- | A set of cryptographic attestations of this path's validity. |
| 32 | + -- |
| 33 | + -- There is no guarantee from this type alone that these |
| 34 | + -- signatures are valid. |
| 35 | + sigs :: !(Set NarSignature) |
| 36 | + , -- | Whether and how this store path is content-addressable. |
| 37 | + -- |
| 38 | + -- There is no guarantee from this type alone that this address |
| 39 | + -- is actually correct for this store path. |
| 40 | + contentAddressableAddress :: !(Maybe ContentAddressableAddress) |
| 41 | + } |
| 42 | + |
| 43 | +-- | How much do we trust the path, based on its provenance? |
| 44 | +data StorePathTrust |
| 45 | + = -- | It was built locally and thus ultimately trusted |
| 46 | + BuiltLocally |
| 47 | + | -- | It was built elsewhere (and substituted or similar) and so |
| 48 | + -- is less trusted |
| 49 | + BuiltElsewhere |
0 commit comments