Prefetch sources from github for nix build tool
GPL-3.0 License
#+title: nix-prefetch-github
Introduction 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 #+begin_src sh :results verbatim :export :wrap example :exports both result/bin/nix-prefetch-github seppeljordan nix-prefetch-github #+end_src
#+RESULTS: #+begin_example { "owner": "seppeljordan", "repo": "nix-prefetch-github", "rev": "244024cbbda3638e93b1a18d10e0c36f3d62e6b4", "hash": "sha256-eQd/MNlnuzXzgFzvwUMchvHoIvkIrbpGKV7iknO14Cc=" } #+end_example
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. :
#+begin_src sh :results verbatim :wrap example :exports results result/bin/nix-prefetch-github --help #+end_src
#+RESULTS: #+begin_example usage: nix-prefetch-github [-h] [--fetch-submodules] [--no-fetch-submodules] [--leave-dot-git] [--no-leave-dot-git] [--deep-clone] [--no-deep-clone] [--verbose] [--quiet] [--nix] [--json] [--meta] [--version] [--rev REV] owner repo
positional arguments: owner repo
options: -h, --help show this help message and exit --fetch-submodules Include git submodules in the output derivation --no-fetch-submodules Don't include git submodules in output derivation --leave-dot-git Include .git folder in output derivation. Use this if you need repository data, e.g. current commit hash, for the build process. --no-leave-dot-git Don't include .git folder in output derivation. --deep-clone Include all of the repository history in the output derivation. This option implies --leave-dot-git. --no-deep-clone Don't include the repository history in the output derivation. --verbose, -v Print additional information about the programs execution. This is useful if you want to issue a bug report. --quiet, -q Print less information about the programs execution. --nix Output the results as valid nix code. --json Output the results in the JSON format --meta Output the results in JSON format where the arguments to fetchFromGitHub are located under the src key of the resulting json dictionary and meta information about the prefetched repository is located under the meta key of the output. --version show program's version number and exit --rev REV #+end_example
** 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=.
#+begin_src sh :results verbatim :wrap example :exports results result/bin/nix-prefetch-github-directory --help #+end_src
#+RESULTS: #+begin_example usage: .nix-prefetch-github-directory-wrapped [-h] [--fetch-submodules] [--no-fetch-submodules] [--leave-dot-git] [--no-leave-dot-git] [--deep-clone] [--no-deep-clone] [--verbose] [--quiet] [--nix] [--json] [--meta] [--version] [--directory DIRECTORY] [--remote REMOTE]
options: -h, --help show this help message and exit --fetch-submodules Include git submodules in the output derivation --no-fetch-submodules Don't include git submodules in output derivation --leave-dot-git Include .git folder in output derivation. Use this if you need repository data, e.g. current commit hash, for the build process. --no-leave-dot-git Don't include .git folder in output derivation. --deep-clone Include all of the repository history in the output derivation. This option implies --leave-dot-git. --no-deep-clone Don't include the repository history in the output derivation. --verbose, -v Print additional information about the programs execution. This is useful if you want to issue a bug report. --quiet, -q Print less information about the programs execution. --nix Output the results as valid nix code. --json Output the results in the JSON format --meta Output the results in JSON format where the arguments to fetchFromGitHub are located under the src key of the resulting json dictionary and meta information about the prefetched repository is located under the meta key of the output. --version show program's version number and exit --directory DIRECTORY --remote REMOTE #+end_example
** nix-prefetch-github-latest-release This command fetches the code for the latest release of the specified repository.
#+begin_src sh :results verbatim :wrap example :exports results result/bin/nix-prefetch-github-latest-release --help #+end_src
#+RESULTS: #+begin_example usage: nix-prefetch-github-latest-release [-h] [--fetch-submodules] [--no-fetch-submodules] [--leave-dot-git] [--no-leave-dot-git] [--deep-clone] [--no-deep-clone] [--verbose] [--quiet] [--nix] [--json] [--meta] [--version] owner repo
positional arguments: owner repo
options: -h, --help show this help message and exit --fetch-submodules Include git submodules in the output derivation --no-fetch-submodules Don't include git submodules in output derivation --leave-dot-git Include .git folder in output derivation. Use this if you need repository data, e.g. current commit hash, for the build process. --no-leave-dot-git Don't include .git folder in output derivation. --deep-clone Include all of the repository history in the output derivation. This option implies --leave-dot-git. --no-deep-clone Don't include the repository history in the output derivation. --verbose, -v Print additional information about the programs execution. This is useful if you want to issue a bug report. --quiet, -q Print less information about the programs execution. --nix Output the results as valid nix code. --json Output the results in the JSON format --meta Output the results in JSON format where the arguments to fetchFromGitHub are located under the src key of the resulting json dictionary and meta information about the prefetched repository is located under the meta key of the output. --version show program's version number and exit #+end_example
development environment Use =nix develop= with flake support enabled. Development without nix flake support is not officially supported. Run the provided tests via =pytest=. You can control what kind of tests are run via the variable =DISABLED_TESTS=:
#+begin_example
DISABLED_TESTS="network requires_nix_build" pytest #+end_example
Currently =network= and =requires_nix_build= are the only values that make sense with this environment variable.
You can visualize the dependency graph of the individual python modules via the =./generate-dependency-graph= program.
You can generate a coverage report for the tests via
#+begin_example coverage run -m nix_prefetch_github.run_tests && coverage html #+end_example
changes ** v8.0.0 (not released yet)
** v7.1.0
** v7.0.0
** v6.0.1
** v6.0.0
** v5.2.2
** v5.2.1
nix-command
feature** v5.2.0
** v5.1.2
** v5.1.0
** v5.0.1
** v5.0.0
** v4.0.4
** v4.0.3
** v4.0.2
** v4.0.1
** v4.0
** v3.0
** v2.4
** v2.3.2
** v2.3.1
** v2.3
** v2.2
** v2.1
** v2.0