@@ -7,6 +7,7 @@
7{-# LANGUAGE PatternGuards #-}
7{-# LANGUAGE PatternGuards #-}
8{-# LANGUAGE QuasiQuotes #-}
8{-# LANGUAGE QuasiQuotes #-}
9{-# LANGUAGE ScopedTypeVariables #-}
9{-# LANGUAGE ScopedTypeVariables #-}
10+{-# LANGUAGE TemplateHaskell #-}
10{-# LANGUAGE TypeApplications #-}
11{-# LANGUAGE TypeApplications #-}
11module Obelisk.Command.Thunk where
12module Obelisk.Command.Thunk where
@@ -57,6 +58,7 @@ import System.FilePath
57import System.IO.Error
58import System.IO.Error
58import System.IO.Temp
59import System.IO.Temp
59import System.Posix (getSymbolicLinkStatus, modificationTime)
60import System.Posix (getSymbolicLinkStatus, modificationTime)
61+import System.Which (staticWhich)
60import qualified Text.URI as URI
62import qualified Text.URI as URI
62import Obelisk.App (MonadObelisk)
64import Obelisk.App (MonadObelisk)
@@ -178,14 +180,14 @@ getNixSha256ForUriUnpacked
178getNixSha256ForUriUnpacked uri =
180getNixSha256ForUriUnpacked uri =
179 withExitFailMessage ("nix-prefetch-url: Failed to determine sha256 hash of URL " <> gitUriToText uri) $ do
181 withExitFailMessage ("nix-prefetch-url: Failed to determine sha256 hash of URL " <> gitUriToText uri) $ do
180 [hash] <- fmap T.lines $ readProcessAndLogOutput (Debug, Debug) $
182 [hash] <- fmap T.lines $ readProcessAndLogOutput (Debug, Debug) $
181− proc "nix-prefetch-url" ["--unpack", "--type", "sha256", T.unpack $ gitUriToText uri]
183+ proc $(staticWhich "nix-prefetch-url") ["--unpack", "--type", "sha256", T.unpack $ gitUriToText uri]
182 pure hash
184 pure hash
184nixPrefetchGit :: MonadObelisk m => GitUri -> Text -> Bool -> m NixSha256
186nixPrefetchGit :: MonadObelisk m => GitUri -> Text -> Bool -> m NixSha256
185nixPrefetchGit uri rev fetchSubmodules =
187nixPrefetchGit uri rev fetchSubmodules =
186 withExitFailMessage ("nix-prefetch-git: Failed to determine sha256 hash of Git repo " <> gitUriToText uri <> " at " <> rev) $ do
188 withExitFailMessage ("nix-prefetch-git: Failed to determine sha256 hash of Git repo " <> gitUriToText uri <> " at " <> rev) $ do
187 out <- readProcessAndLogStderr Debug $
189 out <- readProcessAndLogStderr Debug $
188− proc "nix-prefetch-git" $ filter (/="")
190+ proc $(staticWhich "nix-prefetch-git") $ filter (/="")
189 [ "--url", T.unpack $ gitUriToText uri
191 [ "--url", T.unpack $ gitUriToText uri
190 , "--rev", T.unpack rev
192 , "--rev", T.unpack rev
191 , if fetchSubmodules then "--fetch-submodules" else ""
193 , if fetchSubmodules then "--fetch-submodules" else ""