File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ import Cabal2Nix.Util
32
32
33
33
import Text.PrettyPrint.ANSI.Leijen (hPutDoc , Doc )
34
34
import System.IO
35
- import Data.List (isSuffixOf )
35
+ import Data.List (isSuffixOf , isInfixOf )
36
36
import Control.Applicative ((<|>) )
37
37
38
38
import Distribution.Nixpkgs.Fetch
@@ -164,7 +164,19 @@ stackexpr args =
164
164
do evalue <- decodeFileEither (stackFile args)
165
165
case evalue of
166
166
Left e -> error (show e)
167
- Right value -> stack2nix args =<< resolveSnapshot value
167
+ Right value -> stack2nix args
168
+ =<< cleanupStack <$> resolveSnapshot value
169
+ where cleanupStack :: Stack -> Stack
170
+ cleanupStack (Stack r ps es)
171
+ = Stack r (cleanupPkg <$> (ps ++ [Local e | e <- es, looksLikePath e]))
172
+ (cleanupExtraDep <$> [e | e <- es, not (looksLikePath e)])
173
+ -- drop trailing slashes. Nix doesn't like them much;
174
+ -- stack doesn't seem to care.
175
+ cleanupPkg (Local p) | " /" `isSuffixOf` p = Local (take (length p - 1 ) p)
176
+ cleanupPkg x = x
177
+ cleanupExtraDep = id
178
+ looksLikePath :: String -> Bool
179
+ looksLikePath = isInfixOf " /"
168
180
169
181
stack2nix :: Args -> Stack -> IO NExpr
170
182
stack2nix args stack@ (Stack resolver _ _) =
You can’t perform that action at this time.
0 commit comments