@@ -56,13 +56,18 @@ fetch f = runMaybeT . fetchers where
56 , (True, "bzr")
56 , (True, "bzr")
59+ -- | Remove '/' from the end of the path. Nix doesn't accept paths that
61+ stripSlashSuffix :: String -> String
62+ stripSlashSuffix = reverse . dropWhile (== '/') . reverse
59 fetchLocal :: Source -> MaybeT IO (DerivationSource, a)
64 fetchLocal :: Source -> MaybeT IO (DerivationSource, a)
60 fetchLocal src = do
65 fetchLocal src = do
61 let path = stripPrefix "file://" $ sourceUrl src
66 let path = stripPrefix "file://" $ sourceUrl src
62 existsFile <- liftIO $ doesFileExist path
67 existsFile <- liftIO $ doesFileExist path
63 existsDir <- liftIO $ doesDirectoryExist path
68 existsDir <- liftIO $ doesDirectoryExist path
64 guard $ existsDir || existsFile
69 guard $ existsDir || existsFile
65− let path' | '/' `elem` path = path
70+ let path' | '/' `elem` path = stripSlashSuffix path
66 | otherwise = "./" ++ path
71 | otherwise = "./" ++ path
67 process (DerivationSource "" path' "" "", path') <|> localArchive path'
72 process (DerivationSource "" path' "" "", path') <|> localArchive path'