11{-|
22Description : Metadata about Nix store paths.
33-}
4- module System.Nix.StorePathMetadata where
4+ module System.Nix.StorePathMetadata
5+ ( Metadata (.. )
6+ , StorePathTrust (.. )
7+ ) where
58
6- import System.Nix.StorePath ( StorePath
7- , ContentAddressableAddress
8- )
9- import System.Nix.Hash ( SomeNamedDigest )
10- import Data.Time ( UTCTime )
11- import System.Nix.Signature ( NarSignature )
9+ import Data.Time (UTCTime )
1210
13- -- | Metadata about a 'StorePath'
14- data StorePathMetadata = StorePathMetadata
11+ import System.Nix.Hash (SomeNamedDigest )
12+ import System.Nix.Signature (NarSignature )
13+ import System.Nix.StorePath (ContentAddressableAddress )
14+
15+ -- | Metadata (typically about a 'StorePath')
16+ data Metadata a = Metadata
1517 { -- | The path this metadata is about
16- path :: ! StorePath
18+ path :: ! a
1719 , -- | The path to the derivation file that built this path, if any
1820 -- and known.
19- deriverPath :: ! (Maybe StorePath )
21+ deriverPath :: ! (Maybe a )
2022 , -- TODO should this be optional?
2123 -- | The hash of the nar serialization of the path.
2224 narHash :: ! SomeNamedDigest
2325 , -- | The paths that this path directly references
24- references :: ! (HashSet StorePath )
26+ references :: ! (HashSet a )
2527 , -- | When was this path registered valid in the store?
2628 registrationTime :: ! UTCTime
2729 , -- | The size of the nar serialization of the path, in bytes.
@@ -38,7 +40,7 @@ data StorePathMetadata = StorePathMetadata
3840 -- There is no guarantee from this type alone that this address
3941 -- is actually correct for this store path.
4042 contentAddressableAddress :: ! (Maybe ContentAddressableAddress )
41- }
43+ } deriving ( Eq , Generic , Ord , Show )
4244
4345-- | How much do we trust the path, based on its provenance?
4446data StorePathTrust
@@ -47,4 +49,4 @@ data StorePathTrust
4749 | -- | It was built elsewhere (and substituted or similar) and so
4850 -- is less trusted
4951 BuiltElsewhere
50- deriving (Show , Eq , Ord )
52+ deriving (Eq , Enum , Generic , Ord , Show )
0 commit comments