Skip to content

Commit ec29e02

Browse files
authored
Merge pull request #17 from haskell-nix/derivation-restructuring
Expand Derivation data type
2 parents 7a9fcdb + 007a210 commit ec29e02

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@ Description : Derivation types
33
Maintainer : srk <[email protected]>
44
|-}
55

6-
module System.Nix.Derivation (
7-
BasicDerivation(..)
8-
) where
6+
module System.Nix.Derivation where
97

108

119
import Data.Text (Text)
1210
import Data.HashMap.Strict (HashMap)
11+
import Data.HashSet (HashSet)
1312
import System.Nix.Path
1413

15-
data BasicDerivation = BasicDerivation
16-
{ -- | Derivation outputs
17-
outputs :: !(HashMap Text Path)
18-
, -- | Inputs that are sources
19-
inputSrcs :: !PathSet
20-
, -- | Platform
21-
platform :: !Text
22-
, -- | Path to builder
23-
builder :: !Path
24-
, -- | Arguments
25-
args :: ![Text]
26-
, -- | Environment
27-
env :: ![HashMap Text Text]
14+
type OutputName = Text
15+
16+
newtype DerivationInputs = DerivationInputs
17+
{ _unDerivationInputs :: HashMap Path (HashSet OutputName)
18+
} deriving (Eq, Ord, Show)
19+
20+
data Derivation = Derivation
21+
{ _derivationInputs :: DerivationInputs
22+
, _derivationOutputs :: !(HashMap OutputName Path)
23+
-- | Inputs that are sources
24+
, _derivationInputSrcs :: !PathSet
25+
, _derivationPlatform :: !Text
26+
-- | Path to builder
27+
, _derivationBuilder :: !Path
28+
, _derivationArgs :: ![Text]
29+
, _derivationEnv :: ![HashMap Text Text]
2830
} deriving (Eq, Ord, Show)

0 commit comments

Comments
 (0)