on master help sign in
Move path functions into utils module
commit31b5c01980aa15eaceb586d5f1f09cb9fc4b0d85 authorAlexandre Esteves <alexandre.fmp.esteves@gmail.com> dateFri 22 May 2020, 15:17 (6 years ago) parent666a73b
2 files changed+8−3
lib/command/src/Obelisk/Command/Thunk.hs+2−3 lib/command/src/Obelisk/Command/Utils.hs+6
lib/command/src/Obelisk/Command/Thunk.hs+2−3
@@ -58,7 +58,6 @@ import System.FilePath
5858import System.IO.Error
5959import System.IO.Temp
6060import System.PosixCompat.Files (getSymbolicLinkStatus, modificationTime)
61−import System.Which (staticWhich)
6261import qualified Text.URI as URI
6362
6463import Obelisk.App (MonadObelisk)
@@ -180,14 +179,14 @@ getNixSha256ForUriUnpacked
180179getNixSha256ForUriUnpacked uri =
181180 withExitFailMessage ("nix-prefetch-url: Failed to determine sha256 hash of URL " <> gitUriToText uri) $ do
182181 [hash] <- fmap T.lines $ readProcessAndLogOutput (Debug, Debug) $
183− proc $(staticWhich "nix-prefetch-url") ["--unpack", "--type", "sha256", T.unpack $ gitUriToText uri]
182+ proc nixPrefetchUrlPath ["--unpack", "--type", "sha256", T.unpack $ gitUriToText uri]
184183 pure hash
185184
186185nixPrefetchGit :: MonadObelisk m => GitUri -> Text -> Bool -> m NixSha256
187186nixPrefetchGit uri rev fetchSubmodules =
188187 withExitFailMessage ("nix-prefetch-git: Failed to determine sha256 hash of Git repo " <> gitUriToText uri <> " at " <> rev) $ do
189188 out <- readProcessAndLogStderr Debug $
190− proc $(staticWhich "nix-prefetch-git") $ filter (/="")
189+ proc nixPrefetchGitPath $ filter (/="")
191190 [ "--url", T.unpack $ gitUriToText uri
192191 , "--rev", T.unpack rev
193192 , if fetchSubmodules then "--fetch-submodules" else ""
lib/command/src/Obelisk/Command/Utils.hs+6
@@ -54,6 +54,12 @@ nixBuildExePath = $(staticWhich "nix-build")
5454jreKeyToolPath :: FilePath
5555jreKeyToolPath = $(staticWhich "keytool")
5656
57+nixPrefetchGitPath :: FilePath
58+nixPrefetchGitPath = $(staticWhich "nix-prefetch-git")
59+
60+nixPrefetchUrlPath :: FilePath
61+nixPrefetchUrlPath = $(staticWhich "nix-prefetch-url")
62+
5763-- | Nix syntax requires relative paths to be prefixed by @./@ or
5864-- @../@. This will make a 'FilePath' that can be embedded in a Nix
5965-- expression.