@@ -346,8 +346,9 @@ updateThunkToLatest target = do
346346-- This tool will only ever produce the newest one when it writes a thunk.
347347gitHubStandaloneLoaders :: NonEmpty Text
348348gitHubStandaloneLoaders =
349− gitHubStandaloneLoaderV2 :|
350− [ gitHubStandaloneLoaderV1
349+ gitHubStandaloneLoaderV3 :|
350+ [ gitHubStandaloneLoaderV2
351+ , gitHubStandaloneLoaderV1
351352 ]
352353
353354gitHubStandaloneLoaderV1 :: Text
@@ -366,6 +367,26 @@ gitHubStandaloneLoaderV2 = T.unlines
366367 , "))"
367368 ]
368369
370+gitHubStandaloneLoaderV3 :: Text
371+gitHubStandaloneLoaderV3 = T.unlines
372+ [ "# DO NOT HAND-EDIT THIS FILE"
373+ , "let"
374+ , " fetch = { private ? false, ... }@args: if private && builtins.hasAttr \"fetchGit\" builtins"
375+ , " then fetchFromGitHubPrivate args"
376+ , " else (import <nixpkgs> {}).fetchFromGitHub (builtins.removeAttrs args [\"branch\"]);"
377+ , " fetchFromGitHubPrivate ="
378+ , " { owner, repo, rev, branch ? null, name ? null, sha256 ? null, private ? false"
379+ , " , fetchSubmodules ? false, githubBase ? \"github.com\", ..."
380+ , " }: assert !fetchSubmodules;"
381+ , " builtins.fetchGit ({"
382+ , " url = \"ssh://git@${githubBase}/${owner}/${repo}.git\";"
383+ , " inherit rev;"
384+ , " }"
385+ , " // (if branch == null then {} else { ref = branch; })"
386+ , " // (if name == null then {} else { inherit name; }));"
387+ , "in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))"
388+ ]
389+
369390plainGitStandaloneLoaders :: NonEmpty Text
370391plainGitStandaloneLoaders =
371392 plainGitStandaloneLoaderV1 :|