@@ -414,8 +414,9 @@ setThunk target gs branch = do
414-- This tool will only ever produce the newest one when it writes a thunk.
414-- This tool will only ever produce the newest one when it writes a thunk.
415gitHubStandaloneLoaders :: NonEmpty Text
415gitHubStandaloneLoaders :: NonEmpty Text
416gitHubStandaloneLoaders =
416gitHubStandaloneLoaders =
417− gitHubStandaloneLoaderV2 :|
417+ gitHubStandaloneLoaderV4 :|
418 [ gitHubStandaloneLoaderV3
418 [ gitHubStandaloneLoaderV3
419+ , gitHubStandaloneLoaderV2
419 , gitHubStandaloneLoaderV1
420 , gitHubStandaloneLoaderV1
@@ -455,6 +456,25 @@ gitHubStandaloneLoaderV3 = T.unlines
455 , "in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))"
456 , "in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))"
459+gitHubStandaloneLoaderV4 :: Text
460+gitHubStandaloneLoaderV4 = T.unlines
461+ [ "# DO NOT HAND-EDIT THIS FILE"
463+ , " fetch = { private ? false, ... }@args:"
464+ , " if private && builtins.hasAttr \"fetchGit\" builtins"
465+ , " then fetchFromGitHubPrivate args"
466+ , " else fetchFromGitHub (builtins.removeAttrs args [\"branch\"]);"
467+ , " fetchFromGitHub = if builtins.hasAttr \"fetchTarball\" builtins then"
468+ , " ({ owner, repo, rev, sha256, ... }: builtins.fetchTarball {"
469+ , " url = \"https://github.com/${owner}/${repo}/archive/${rev}.tar.gz\";"
470+ , " inherit sha256; })"
471+ , " else (import <nixpkgs> {}).fetchFromGitHub;"
472+ , " fetchFromGitHubPrivate = { owner, repo, rev, sha256, ... }:"
473+ , " (import <nixpkgs> {}).fetchFromGitHub"
474+ , " { inherit owner repo rev sha256; private = true; }"
475+ , "in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))"
458plainGitStandaloneLoaders :: NonEmpty Text
478plainGitStandaloneLoaders :: NonEmpty Text
459plainGitStandaloneLoaders =
479plainGitStandaloneLoaders =
460 plainGitStandaloneLoaderV1 :|
480 plainGitStandaloneLoaderV1 :|