Skip to main content

Prefetch source code from github for nix build tool

Project description

This module implements a python function and a command line tool to help you fetch sources from github when using fetchFromGitHub.

This program can be distributed under the conditions of the GNU Public License Version 3. Check out LICENSE.txt to read the license text.

command line example

$ nix-prefetch-github seppeljordan nix-prefetch-github
{
    "owner": "seppeljordan",
    "repo": "nix-prefetch-github",
    "rev": "603f42203db128a7aaa091cf34d406bf7a80e9f0",
    "sha256": "1wrvvy85x7yqj4rkgpj93cdnhalyhzpr8pmyca38v59lm5ndh2w4"
}

python example

Python 3.6.4 (default, Dec 19 2017, 05:36:13)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nix_prefetch_github
>>> nix_prefetch_github.nix_prefetch_github(owner="seppeljordan", repo="nix-prefetch-github")
{'owner': 'seppeljordan', 'repo': 'nix-prefetch-github', 'rev': '603f42203db128a7aaa091cf34d406bf7a80e9f0', 'sha256': '1wrvvy85x7yqj4rkgpj93cdnhalyhzpr8pmyca38v59lm5ndh2w4'}

available commands

nix-prefetch-github

This command downloads the code from a github repository and puts it into the local nix store. It also prints the function arguments to fetchFromGitHub to the standard output.

$ nix-prefetch-github --help
Usage: nix-prefetch-github [OPTIONS] OWNER REPO

Options:
  --prefetch / --no-prefetch  Prefetch given repository into nix store
  --nix                       Format output as Nix expression
  --fetch-submodules          Whether to fetch submodules contained in the
                              target repository

  --rev TEXT
  --version                   Show the version and exit.
  --help                      Show this message and exit.

nix-prefetch-github-directory

This command examins the current working directory and tries to figure out if it is part of a git repository linked to github. If this was successful the program prefetches the currently checked out commit from the origin remote repository similar to the command nix-prefetch-github.

$ nix-prefetch-github-directory --help
Usage: nix-prefetch-github-directory [OPTIONS]

Options:
  --directory TEXT
  --nix                       Format output as Nix expression
  --prefetch / --no-prefetch  Prefetch given repository into nix store
  --remote TEXT
  --fetch-submodules          Whether to fetch submodules contained in the
                              target repository

  --help                      Show this message and exit.

nix-prefetch-github-latest-release

This command fetches the code for the latest release of the specified repository.

$ nix-prefetch-github-latest-release --help
Usage: nix-prefetch-github-latest-release [OPTIONS] OWNER REPO

Options:
  --nix                       Format output as Nix expression
  --prefetch / --no-prefetch  Prefetch given repository into nix store
  --fetch-submodules          Whether to fetch submodules contained in the
                              target repository

  --help                      Show this message and exit.

changes

v4.1

  • Fix issue #38

v4.0

  • Make fetching submodules the default in calls to python routines. The CLI should be uneffected by this change.

  • Remove default values for fetch_submodules in all internal classes.

  • Implement nix-prefetch-github-latest-release command

v3.0

  • major changes to the internal module structure

  • introduction of the nix-prefetch-github-directory command

  • code repository now functions as a nix flake

v2.4

  • added --fetch-submodules flag

  • Fixed incompability with nix 2.4

v2.3.2

  • fix issues #21, #22

  • nix-prefetch-github now accepts full ref names, e.g. refs/heads/master which was broken since 2.3 (#23)

v2.3.1

  • Fix bug in generated nix expression

  • Fix bug that prevented targeting tags with prefetch command

  • Improve error message format in case revision is not found

v2.3

  • Remove dependency to requests

  • Default to master branch instead of first branch in list

v2.2

  • Add --version flag

  • Fix bug in output formatting

v2.1

  • Fix bug (#4) that made nix-prefetch-github incompatible with nix 2.2.

v2.0

  • The result of nix_pretch_github and its corresponding command line tool now contains always the actual commit hash as detected by the tool instead of the branch or tag name.

  • Add a new flag --nix that makes the command line tool output a valid nix expression

  • Removed the --hash-only and --no-hash-only flags and changed add --prefetch and --no-prefetch flags to replace them.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nix-prefetch-github-4.0.2.tar.gz (25.2 kB view details)

Uploaded Source

File details

Details for the file nix-prefetch-github-4.0.2.tar.gz.

File metadata

  • Download URL: nix-prefetch-github-4.0.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20201006 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

File hashes

Hashes for nix-prefetch-github-4.0.2.tar.gz
Algorithm Hash digest
SHA256 65d696224a4993c02f4d9980efa54c4d778e513ad62def96def87f7b4cf0581e
MD5 ab86b7b48a8229ea02418d79c15bb900
BLAKE2b-256 f2594757f2279533afa32a61a948059a05b59a4aa22c9cebd3bd6ab0f6a9a41c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page