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