@@ -56,13 +56,18 @@ fetch f = runMaybeT . fetchers where
5656 , (True, "bzr")
5757 ]
5858
59+ -- | Remove '/' from the end of the path. Nix doesn't accept paths that
60+ -- end in a slash.
61+ stripSlashSuffix :: String -> String
62+ stripSlashSuffix = reverse . dropWhile (== '/') . reverse
63+
5964 fetchLocal :: Source -> MaybeT IO (DerivationSource, a)
6065 fetchLocal src = do
6166 let path = stripPrefix "file://" $ sourceUrl src
6267 existsFile <- liftIO $ doesFileExist path
6368 existsDir <- liftIO $ doesDirectoryExist path
6469 guard $ existsDir || existsFile
65− let path' | '/' `elem` path = path
70+ let path' | '/' `elem` path = stripSlashSuffix path
6671 | otherwise = "./" ++ path
6772 process (DerivationSource "" path' "" "", path') <|> localArchive path'
6873