aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/github.cc
AgeCommit message (Collapse)Author
2020-10-06Shut up some clang warningsEelco Dolstra
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-09-30StyleEelco Dolstra
2020-09-30SimplifyEelco Dolstra
2020-09-29Remove github-access-token in favor of access-token.Kevin Quick
2020-09-29Merge branch 'master' into access-tokensKevin Quick
2020-09-29Make Headers an optional argumentEelco Dolstra
2020-09-29CleanupEelco Dolstra
2020-09-25Merge remote-tracking branch 'origin/master' into github-api-tokenGregory Hale
2020-09-25Re-add support for github-access-token, but mark as deprecated.Kevin Quick
2020-09-24Update to use access-tokens configuration for github/gitlab access.Kevin Quick
This change provides support for using access tokens with other instances of GitHub and GitLab beyond just github.com and gitlab.com (especially company-specific or foundation-specific instances). This change also provides the ability to specify the type of access token being used, where different types may have different handling, based on the forge type.
2020-09-24Complete conversion of "url" to "host" with associated variable renaming.Kevin Quick
Completes the change begun in commit 56f1e0d to consistently use the "host" attribute for "github" and "gitlab" inputs instead of a "url" attribute.
2020-09-21Don't include <regex> in header filesEelco Dolstra
This reduces compilation time by ~15 seconds (CPU time). Issue #4045.
2020-09-21libfetchers/github: rename `url` to `host`Maximilian Bosch
2020-09-18libfetchers/github: allow `url` attributeMaximilian Bosch
Since 108debef6f703aa3ca1f6d6c45428880624ec6f8 we allow a `url`-attribute for the `github`-fetcher to fetch tarballs from self-hosted `gitlab`/`github` instances. However it's not used when defining e.g. a flake-input foobar = { type = "github"; url = "gitlab.myserver"; /* ... */ } and breaks with an evaluation-error: error: --- Error --------------------------------------nix unsupported input attribute 'url' (use '--show-trace' to show detailed location information) This patch allows flake-inputs to be fetched from self-hosted instances as well.
2020-09-16Fetch commits from github/gitlab using Auth headerGreg Hale
`nix flake info` calls the github 'commits' API, which requires authorization when the repository is private. Currently this request fails with a 404. This commit adds an authorization header when calling the 'commits' API. It also changes the way that the 'tarball' API authenticates, moving the user's token from a query parameter into the Authorization header. The query parameter method is recently deprecated and will be disallowed in November 2020. Using them today triggers a warning email.
2020-09-01github: Use access token when calling .../commits APIEelco Dolstra
2020-07-16Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into ↵John Ericson
better-ca-parse-errors
2020-07-13Fix gitlab-fetcher to obtain tags and branchesMaximilian Bosch
Until now, the `gitlab`-fetcher determined the source's rev by checking the latest commit of the given `ref` using the `/repository/branches`-API. This breaks however when trying to fetch a gitlab-repo by its tag: ``` $ nix repl nix-repl> builtins.fetchTree gitlab:Ma27/nvim.nix/0.2.0 error: --- Error ------------------------------------------------------------------------------------- nix unable to download 'https://gitlab.com/api/v4/projects/Ma27%2Fnvim.nix/repository/branches/0.2.0': HTTP error 404 ('') ``` When using the `/commits?ref_name`-endpoint[1] you can pass any kind of valid ref to the `gitlab`-fetcher. Please note that this fetches the only first 20 commits on a ref, unfortunately there's currently no endpoint which only retrieves the latest commit of any kind of `ref`. [1] https://docs.gitlab.com/ee/api/commits.html#list-repository-commits
2020-07-01Rename two hash constructors to proper functionsCarlo Nucera
2020-06-18github: Respect default branchEelco Dolstra
2020-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-12Use `std::string_view` in a few more placesJohn Ericson
2020-06-09Fix applyOverride() for githubEelco Dolstra
2020-06-04getDefaultUrl() -> value_or()Eelco Dolstra
2020-06-04add support for selfhosted gitlab/githubFinn Behrens
2020-06-01use Tree ctorMatthew Kenigsberg
2020-05-30Check revCount / lastModified input attributes if specifiedEelco Dolstra
2020-05-30Remove TreeInfoEelco Dolstra
The attributes previously stored in TreeInfo (narHash, revCount, lastModified) are now stored in Input. This makes it less arbitrary what attributes are stored where. As a result, the lock file format has changed. An entry like "info": { "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github" }, is now stored as "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github", "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, The 'Input' class is now a dumb set of attributes. All the fetcher implementations subclass InputScheme, not Input. This simplifies the API. Also, fix substitution of flake inputs. This was broken since lazy flake fetching started using fetchTree internally.
2020-05-29Factor out GitHub / GitLab commonalityEelco Dolstra
2020-04-09Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-04-08after flake rebaseNikola Knezevic
2020-04-07Respect the narHash attribute in more input typesEelco Dolstra
(cherry picked from commit a6ff66b658b61aef80d936f0183447fe4cb46000)
2020-04-07Backport libfetchers from the flakes branchEelco Dolstra
This provides a pluggable mechanism for defining new fetchers. It adds a builtin function 'fetchTree' that generalizes existing fetchers like 'fetchGit', 'fetchMercurial' and 'fetchTarball'. 'fetchTree' takes a set of attributes, e.g. fetchTree { type = "git"; url = "https://example.org/repo.git"; ref = "some-branch"; rev = "abcdef..."; } The existing fetchers are just wrappers around this. Note that the input attributes to fetchTree are the same as flake input specifications and flake lock file entries. All fetchers share a common cache stored in ~/.cache/nix/fetcher-cache-v1.sqlite. This replaces the ad hoc caching mechanisms in fetchGit and download.cc (e.g. ~/.cache/nix/{tarballs,git-revs*}). This also adds support for Git worktrees (c169ea59049f861aaba429f48b828d0820b74d1d).
2020-04-02Respect the narHash attribute in more input typesEelco Dolstra
call-flake.nix now passes node.info.narHash to fetchTree. This ensures that dirty Git trees work even in pure mode.
2020-03-30Move fetchers from libstore to libfetchersEelco Dolstra