on master help sign in
Merge remote-tracking branch 'origin/new-loader' into eac@builtins-fetchgit-loader
commitcb3c2a6edd6fc870b093736d9e5ce29dd40c3581 authorElliot Cameron <eacameron@gmail.com> dateTue 24 Dec 2019, 12:49 (7 years ago) parent7c40bdd327aeed
1 file changed+21−1
lib/command/src/Obelisk/Command/Thunk.hs+21−1
lib/command/src/Obelisk/Command/Thunk.hs+21−1
@@ -414,8 +414,9 @@ setThunk target gs branch = do
414414-- This tool will only ever produce the newest one when it writes a thunk.
415415gitHubStandaloneLoaders :: NonEmpty Text
416416gitHubStandaloneLoaders =
417− gitHubStandaloneLoaderV2 :|
417+ gitHubStandaloneLoaderV4 :|
418418 [ gitHubStandaloneLoaderV3
419+ , gitHubStandaloneLoaderV2
419420 , gitHubStandaloneLoaderV1
420421 ]
421422
@@ -455,6 +456,25 @@ gitHubStandaloneLoaderV3 = T.unlines
455456 , "in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))"
456457 ]
457458
459+gitHubStandaloneLoaderV4 :: Text
460+gitHubStandaloneLoaderV4 = T.unlines
461+ [ "# DO NOT HAND-EDIT THIS FILE"
462+ , "let"
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)))"
476+ ]
477+
458478plainGitStandaloneLoaders :: NonEmpty Text
459479plainGitStandaloneLoaders =
460480 plainGitStandaloneLoaderV1 :|