@@ -18,6 +18,7 @@ module Obelisk.Command.Thunk
1818 , ThunkRev (..)
1919 , ThunkSource (..)
2020 , ThunkUpdateConfig (..)
21+ , attrCacheFileName
2122 , createThunk
2223 , createThunkWithLatest
2324 , getLatestRev
@@ -231,6 +232,9 @@ readThunk thunkDir = do
231232 False -> return $ return Nothing
232233 False -> liftIO $ fmap ThunkData_Packed <$> readPackedThunk thunkDir
233234
235+attrCacheFileName :: FilePath
236+attrCacheFileName = ".attr-cache"
237+
234238data ThunkType = ThunkType
235239 { _thunkType_loader :: FilePath
236240 , _thunkType_json :: FilePath
@@ -243,7 +247,7 @@ gitHubThunkType :: ThunkType
243247gitHubThunkType = ThunkType
244248 { _thunkType_loader = "default.nix"
245249 , _thunkType_json = "github.json"
246− , _thunkType_optional = Set.fromList [".attr-cache"]
250+ , _thunkType_optional = Set.fromList [attrCacheFileName]
247251 , _thunkType_loaderVersions = gitHubStandaloneLoaders
248252 , _thunkType_parser = parseThunkPtr $ \v ->
249253 ThunkSource_GitHub <$> parseGitHubSource v <|> ThunkSource_Git <$> parseGitSource v
@@ -253,7 +257,7 @@ gitThunkType :: ThunkType
253257gitThunkType = ThunkType
254258 { _thunkType_loader = "default.nix"
255259 , _thunkType_json = "git.json"
256− , _thunkType_optional = Set.fromList [".attr-cache"]
260+ , _thunkType_optional = Set.fromList [attrCacheFileName]
257261 , _thunkType_loaderVersions = plainGitStandaloneLoaders
258262 , _thunkType_parser = parseThunkPtr $ fmap ThunkSource_Git . parseGitSource
259263 }
@@ -400,7 +404,7 @@ encodeThunkPtrData (ThunkPtr rev src) = case src of
400404
401405createThunk :: MonadIO m => FilePath -> ThunkPtr -> m ()
402406createThunk target thunk = liftIO $ do
403− createDirectoryIfMissing True (target </> ".attr-cache")
407+ createDirectoryIfMissing True (target </> attrCacheFileName)
404408 T.writeFile (target </> "default.nix") (thunkPtrLoader thunk)
405409 let
406410 jsonFileName = case _thunkPtr_source thunk of
@@ -574,7 +578,7 @@ nixBuildThunkAttrWithCache thunkDir attr = do
574578 let cacheErrHandler e
575579 | isDoesNotExistError e = return Nothing -- expected from a cache miss
576580 | otherwise = putLog Error (T.pack $ displayException e) >> return Nothing
577− cacheDir = thunkDir </> ".attr-cache"
581+ cacheDir = thunkDir </> attrCacheFileName
578582 cachePath = cacheDir </> attr <.> "out"
579583 latestChange <- liftIO $ do
580584 createDirectoryIfMissing False cacheDir