@@ -12,9 +12,9 @@ import System.Process
12type Attribute = String
12type Attribute = String
13type Path = [Attribute]
13type Path = [Attribute]
15−readNixpkgAttributeSet :: IO (Set Attribute)
15+readNixpkgAttributeSet :: FilePath -> IO (Set Attribute)
16−readNixpkgAttributeSet = do
16+readNixpkgAttributeSet nixpkgs = do
17− buf <- readProcess "nix-env" ["-qaP", "--json", "-f<nixpkgs>"] ""
17+ buf <- readProcess "nix-env" ["-qaP", "--json", "-f"++nixpkgs] ""
18 let pkgmap :: Either String (Map Attribute JSON.Object)
18 let pkgmap :: Either String (Map Attribute JSON.Object)
19 pkgmap = JSON.eitherDecodeStrict (UTF8.toRep (UTF8.fromString buf))
19 pkgmap = JSON.eitherDecodeStrict (UTF8.toRep (UTF8.fromString buf))
20 either fail (return . Map.keysSet) pkgmap
20 either fail (return . Map.keysSet) pkgmap
@@ -34,5 +34,5 @@ attributeSet2PackageMap pkgset = foldr (uncurry insertAttribute) Map.empty pkgli
34 insertAttribute :: Attribute -> Path -> PackageMap -> PackageMap
34 insertAttribute :: Attribute -> Path -> PackageMap -> PackageMap
35 insertAttribute attr = Map.insertWith Set.union attr . Set.singleton
35 insertAttribute attr = Map.insertWith Set.union attr . Set.singleton
37−readNixpkgPackageMap :: IO PackageMap
37+readNixpkgPackageMap :: FilePath -> IO PackageMap
38−readNixpkgPackageMap = fmap attributeSet2PackageMap readNixpkgAttributeSet
38+readNixpkgPackageMap nixpkgs = fmap attributeSet2PackageMap (readNixpkgAttributeSet nixpkgs)