nix-graph 1.0.0.0 → 1.0.1.0
raw patch · 5 files changed
+31/−11 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Nix.Graph: Derivation :: FilePath -> Text -> [FilePath] -> Bool -> Derivation
+ Nix.Graph: [derivationBuilt] :: Derivation -> Bool
+ Nix.Graph: [derivationInputDrvs] :: Derivation -> [FilePath]
+ Nix.Graph: [derivationPath] :: Derivation -> FilePath
+ Nix.Graph: [derivationSystem] :: Derivation -> Text
+ Nix.Graph: buildFull :: MonadIO m => Config -> [FilePath] -> m (AdjacencyMap Derivation)
+ Nix.Graph: data Derivation
+ Nix.Graph.Internal: [derivationSystem] :: Derivation -> Text
+ Nix.Graph.Internal: buildFull :: MonadIO m => Config -> [FilePath] -> m (AdjacencyMap Derivation)
- Nix.Graph.Internal: Derivation :: FilePath -> [FilePath] -> Bool -> Derivation
+ Nix.Graph.Internal: Derivation :: FilePath -> Text -> [FilePath] -> Bool -> Derivation
Files
- CHANGELOG.md +6/−1
- LICENSE +1/−1
- nix-graph.cabal +2/−2
- src/Nix/Graph.hs +2/−0
- src/Nix/Graph/Internal.hs +20/−7
CHANGELOG.md view
@@ -7,11 +7,16 @@ ## [Unreleased] +## [1.0.1.0] - 2022-02-09+### Added+- New function `buildFull` to get back the nix graph of Derivations instead of FilePaths.+ ## [1.0.0.0] - 2021-05-27 Initial release -[Unreleased]: [https://github.com/awakesecurity/nix-graph/compare/v1.0.0.0...HEAD]+[Unreleased]: [https://github.com/awakesecurity/nix-graph/compare/v1.0.1.0...HEAD]+[1.0.1.0]: https://github.com/awakesecurity/nix-graph/releases/tag/v1.0.1.0 [1.0.0.0]: https://github.com/awakesecurity/nix-graph/releases/tag/v1.0.0.0 [changelog]: https://keepachangelog.com/en/1.0.0/
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2021, Arista Networks+Copyright (c) 2022, Arista Networks All rights reserved. Redistribution and use in source and binary forms, with or without
nix-graph.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: nix-graph-version: 1.0.0.0+version: 1.0.1.0 synopsis: Reify the Nix build graph into a Haskell graph data structure description: Reify the Nix build graph into a Haskell graph data structure category: Nix, Graphs@@ -9,7 +9,7 @@ maintainer: Arista Networks <opensource@awakesecurity.com> homepage: https://github.com/awakesecurity/nix-graph license: BSD-3-Clause-copyright: 2021 Arista Networks+copyright: 2022 Arista Networks tested-with: GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.4 license-file: LICENSE
src/Nix/Graph.hs view
@@ -1,7 +1,9 @@ module Nix.Graph ( Config (..),+ Derivation (..), Exclude (..), build,+ buildFull, ) where import Nix.Graph.Internal
src/Nix/Graph/Internal.hs view
@@ -18,6 +18,7 @@ import Data.Attoparsec.Text ((<?>)) import Data.Hashable (Hashable) import Data.Set (Set)+import Data.Text (Text) import GHC.Generics (Generic) import Numeric.Natural (Natural) import System.Exit (ExitCode (..))@@ -48,6 +49,7 @@ data Derivation = Derivation { derivationPath :: FilePath+ , derivationSystem :: Text , derivationInputDrvs :: [FilePath] , derivationBuilt :: Bool }@@ -75,8 +77,10 @@ let derivationInputDrvs = Map.keys (Nix.Derivation.inputDrvs drv) - pure Derivation{derivationPath, derivationBuilt, derivationInputDrvs}+ let derivationSystem = Nix.Derivation.platform drv + pure Derivation{derivationPath, derivationBuilt, derivationSystem, derivationInputDrvs}+ buildAdjacencyMap :: MonadIO m => Eq k =>@@ -165,15 +169,15 @@ deriving stock (Eq) -- | Build graph of dependencies-build ::+buildFull :: MonadIO m => -- | Configure how the graph is built Config -> -- | Derivations to build graph from [FilePath] ->- m (AdjacencyMap FilePath)-build _ [] = pure (AdjacencyMap.empty)-build Config{exclude, maxFiles} roots = liftIO $ do+ m (AdjacencyMap Derivation)+buildFull _ [] = pure (AdjacencyMap.empty)+buildFull Config{exclude, maxFiles} roots = liftIO $ do tSem <- STM.atomically $ TSem.newTSem (toInteger maxFiles) process :: [FilePath] -> IO [Derivation] <- do@@ -202,6 +206,15 @@ adjacencySets <- buildAdjacencyMap getInputDrvs rootDrvs - let adjacencyMap = AdjacencyMap.fromAdjacencySets adjacencySets+ pure (AdjacencyMap.fromAdjacencySets adjacencySets) - pure (AdjacencyMap.gmap derivationPath adjacencyMap)+-- | Build graph of dependencies as FilePaths+build ::+ MonadIO m =>+ -- | Configure how the graph is built+ Config ->+ -- | Derivations to build graph from+ [FilePath] ->+ m (AdjacencyMap FilePath)+build cfg roots =+ AdjacencyMap.gmap derivationPath <$> buildFull cfg roots