Skip to content

Commit 9ffdd9c

Browse files
committed
move ValidPath to separate file to avoid name clashes
1 parent 9482161 commit 9ffdd9c

File tree

3 files changed

+57
-32
lines changed

3 files changed

+57
-32
lines changed

hnix-store-core/hnix-store-core.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ library
2727
, System.Nix.ReadonlyStore
2828
, System.Nix.Store
2929
, System.Nix.Util
30+
, System.Nix.ValidPath
3031
build-depends: base >=4.10
3132
, base16-bytestring
3233
, bytestring

hnix-store-core/src/System/Nix/Path.hs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module System.Nix.Path
1212
, pathToText
1313
, PathSet
1414
, SubstitutablePathInfo(..)
15-
, ValidPathInfo(..)
1615
, PathName(..)
1716
, filePathPart
1817
, pathName
@@ -80,37 +79,6 @@ data SubstitutablePathInfo = SubstitutablePathInfo
8079
narSize :: !Integer
8180
} deriving (Eq, Ord, Show)
8281

83-
-- | Information about @Path@
84-
data ValidPathInfo = ValidPathInfo
85-
{ -- | Path itself
86-
path :: !Path
87-
, -- | The .drv which led to this 'Path'.
88-
deriverVP :: !(Maybe Path)
89-
, -- | NAR hash
90-
narHash :: !Text
91-
, -- | The references of the 'Path'
92-
referencesVP :: !PathSet
93-
, -- | Registration time should be time_t
94-
registrationTime :: !Integer
95-
, -- | The size of the uncompressed NAR serialization of this
96-
-- 'Path'.
97-
narSizeVP :: !Integer
98-
, -- | Whether the path is ultimately trusted, that is, it's a
99-
-- derivation output that was built locally.
100-
ultimate :: !Bool
101-
, -- | Signatures
102-
sigs :: ![Text]
103-
, -- | Content-addressed
104-
-- Store path is computed from a cryptographic hash
105-
-- of the contents of the path, plus some other bits of data like
106-
-- the "name" part of the path.
107-
--
108-
-- ‘ca’ has one of the following forms:
109-
-- * ‘text:sha256:<sha256 hash of file contents>’ (paths by makeTextPath() / addTextToStore())
110-
-- * ‘fixed:<r?>:<ht>:<h>’ (paths by makeFixedOutputPath() / addToStore())
111-
ca :: !Text
112-
} deriving (Eq, Ord, Show)
113-
11482
-- | A valid filename or directory name
11583
newtype FilePathPart = FilePathPart { unFilePathPart :: BSC.ByteString }
11684
deriving (Eq, Ord, Show)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{-|
2+
Description : Types and effects for interacting with the Nix store.
3+
Maintainer : Shea Levy <[email protected]>
4+
-}
5+
{-# LANGUAGE DataKinds #-}
6+
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
7+
module System.Nix.ValidPath
8+
( ValidPath(..)
9+
) where
10+
11+
import System.Nix.Hash (Digest(..),
12+
HashAlgorithm(Truncated, SHA256))
13+
import System.Nix.Path (Path(..), PathSet)
14+
import qualified Data.ByteString as BS
15+
import qualified Data.ByteString.Char8 as BSC
16+
import Data.Hashable (Hashable (..), hashPtrWithSalt)
17+
import Data.HashMap.Strict (HashMap)
18+
import Data.HashSet (HashSet)
19+
import Data.Map.Strict (Map)
20+
import Data.Text (Text)
21+
import Data.Time (UTCTime)
22+
import qualified Data.Text as T
23+
import System.IO.Unsafe (unsafeDupablePerformIO)
24+
import Text.Regex.Base.RegexLike (makeRegex, matchTest)
25+
import Text.Regex.TDFA.Text (Regex)
26+
27+
-- | Information about @Path@
28+
data ValidPath = ValidPath
29+
{ -- | Path itself
30+
path :: !Path
31+
, -- | The .drv which led to this 'Path'.
32+
deriver :: !(Maybe Path)
33+
, -- | NAR hash
34+
narHash :: !Text
35+
, -- | The references of the 'Path'
36+
references :: !PathSet
37+
, -- | Registration time
38+
registrationTime :: !UTCTime
39+
, -- | The size of the uncompressed NAR serialization of this
40+
-- 'Path'.
41+
narSize :: !Integer
42+
, -- | Whether the path is ultimately trusted, that is, it's a
43+
-- derivation output that was built locally.
44+
ultimate :: !Bool
45+
, -- | Signatures
46+
sigs :: ![Text]
47+
, -- | Content-addressed
48+
-- Store path is computed from a cryptographic hash
49+
-- of the contents of the path, plus some other bits of data like
50+
-- the "name" part of the path.
51+
--
52+
-- ‘ca’ has one of the following forms:
53+
-- * ‘text:sha256:<sha256 hash of file contents>’ (paths by makeTextPath() / addTextToStore())
54+
-- * ‘fixed:<r?>:<ht>:<h>’ (paths by makeFixedOutputPath() / addToStore())
55+
ca :: !Text
56+
} deriving (Eq, Ord, Show)

0 commit comments

Comments
 (0)