on master help sign in
Merge branch 'v0.5' into develop
commit3a2566e410efe6648cce411a0d3862ddc4f0cc86 authorElliot Cameron <eacameron@gmail.com> dateThu 6 Feb 2020, 22:44 (7 years ago) parent595d782311f537
1 file changed+21−1
lib/command/src/Obelisk/Command/Thunk.hs+21−1
lib/command/src/Obelisk/Command/Thunk.hs+21−1
@@ -513,9 +513,10 @@ gitHubStandaloneLoaderV4 = T.unlines
513513
514514plainGitStandaloneLoaders :: NonEmpty Text
515515plainGitStandaloneLoaders =
516− plainGitStandaloneLoaderV3 :|
516+ plainGitStandaloneLoaderV4 :|
517517 [ plainGitStandaloneLoaderV1
518518 , plainGitStandaloneLoaderV2
519+ , plainGitStandaloneLoaderV3
519520 ]
520521
521522plainGitStandaloneLoaderV1 :: Text
@@ -536,6 +537,8 @@ plainGitStandaloneLoaderV2 = T.unlines
536537 , "in import (fetchGit (builtins.fromJSON (builtins.readFile ./git.json)))"
537538 ]
538539
540+-- This loader has a bug because @builtins.fetchGit@ is not given a @ref@
541+-- and will fail to find commits without this because it does shallow clones.
539542plainGitStandaloneLoaderV3 :: Text
540543plainGitStandaloneLoaderV3 = T.unlines
541544 [ "# DO NOT HAND-EDIT THIS FILE"
@@ -552,6 +555,23 @@ plainGitStandaloneLoaderV3 = T.unlines
552555 , "in import (fetch (builtins.fromJSON (builtins.readFile ./git.json)))"
553556 ]
554557
558+plainGitStandaloneLoaderV4 :: Text
559+plainGitStandaloneLoaderV4 = T.unlines
560+ [ "# DO NOT HAND-EDIT THIS FILE"
561+ , "let fetch = {url, rev, branch ? null, sha256 ? null, fetchSubmodules ? false, private ? false, ...}:"
562+ , " let realUrl = let firstChar = builtins.substring 0 1 url; in"
563+ , " if firstChar == \"/\" then /. + url"
564+ , " else if firstChar == \".\" then ./. + url"
565+ , " else url;"
566+ , " in if !fetchSubmodules && private then builtins.fetchGit {"
567+ , " url = realUrl; inherit rev;"
568+ , " ${if branch == null then null else \"ref\"} = branch;"
569+ , " } else (import <nixpkgs> {}).fetchgit {"
570+ , " url = realUrl; inherit rev sha256;"
571+ , " };"
572+ , "in import (fetch (builtins.fromJSON (builtins.readFile ./git.json)))"
573+ ]
574+
555575thunkFileNames :: [FilePath]
556576thunkFileNames = ["default.nix", "github.json", "git.json"]
557577