Skip to content

Commit 729b5cb

Browse files
committed
Derivation: m clean-up
1 parent d699071 commit 729b5cb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Nix/Effects/Derivation.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ parsePath p = case Store.parsePath "/nix/store" (Text.encodeUtf8 p) of
9494
Right path -> return path
9595

9696
writeDerivation :: (Framed e m, MonadStore m) => Derivation -> m Store.StorePath
97-
writeDerivation (drv@Derivation {inputs, name}) = do
97+
writeDerivation drv@Derivation{inputs, name} = do
9898
let (inputSrcs, inputDrvs) = inputs
99-
references <- Set.fromList <$> (mapM parsePath $ Set.toList $ inputSrcs `Set.union` (Set.fromList $ Map.keys inputDrvs))
99+
references <- fmap Set.fromList $ mapM parsePath $ Set.toList $ Set.union inputSrcs $ Set.fromList $ Map.keys inputDrvs
100100
path <- addTextToStore (Text.append name ".drv") (unparseDrv drv) (S.fromList $ Set.toList references) False
101101
parsePath $ Text.pack $ unStorePath path
102102

@@ -112,10 +112,10 @@ hashDerivationModulo (Derivation {
112112
$ "fixed:out"
113113
<> (if hashMode == Recursive then ":r" else "")
114114
<> ":" <> (Store.algoName @hashType)
115-
<> ":" <> (Store.encodeInBase Store.Base16 digest)
115+
<> ":" <> Store.encodeInBase Store.Base16 digest
116116
<> ":" <> path
117117
outputsList -> throwError $ ErrorCall $ "This is weird. A fixed output drv should only have one output named 'out'. Got " <> show outputsList
118-
hashDerivationModulo drv@(Derivation {inputs = (inputSrcs, inputDrvs)}) = do
118+
hashDerivationModulo drv@Derivation{inputs = (inputSrcs, inputDrvs)} = do
119119
cache <- gets snd
120120
inputsModulo <- Map.fromList <$> forM (Map.toList inputDrvs) (\(path, outs) ->
121121
case MS.lookup path cache of
@@ -128,7 +128,7 @@ hashDerivationModulo drv@(Derivation {inputs = (inputSrcs, inputDrvs)}) = do
128128
return $ Store.hash @'Store.SHA256 $ Text.encodeUtf8 $ unparseDrv (drv {inputs = (inputSrcs, inputsModulo)})
129129

130130
unparseDrv :: Derivation -> Text
131-
unparseDrv (Derivation {..}) = Text.append "Derive" $ parens
131+
unparseDrv Derivation{..} = Text.append "Derive" $ parens
132132
[ -- outputs: [("out", "/nix/store/.....-out", "", ""), ...]
133133
list $ flip fmap (Map.toList outputs) (\(outputName, outputPath) ->
134134
let prefix = if hashMode == Recursive then "r:" else "" in

0 commit comments

Comments
 (0)