Package: nix-prefetch-github
IntroductionThis module implements a python function and a command line tool to help
you fetch sources from github when usingfetchFromGitHub.This program can be distributed under the conditions of the GNU Public
License Version 3. Check outLICENSE.txtto read the license text.Command Line Exampleresult/bin/nix-prefetch-githubseppeljordannix-prefetch-github{
    "owner": "seppeljordan",
    "repo": "nix-prefetch-github",
    "rev": "b89933bf5643c97f00c374b39af4f265eef83220",
    "hash": "sha256-8veCTba0fhHEUPLge58FfWlk6tnYfAL852AYXWLu4Ss="
}Available Commandsnix-prefetch-githubThis command downloads the code from a github repository and puts it
into the local nix store. It also prints the function arguments tofetchFromGitHubto the standard output. :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 REVnix-prefetch-github-directoryThis 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
theoriginremote repository similar to the commandnix-prefetch-github.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 REMOTEnix-prefetch-github-latest-releaseThis command fetches the code for the latest release of the specified
repository.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 exitdevelopment environmentUsenix developwith flake support enabled. Development without nix
flake support is not officially supported. Run the provided tests viapytest. You can control what kind of tests are run via the variableDISABLED_TESTS:# Only run tests that don't hit network and don't use nix
DISABLED_TESTS="network requires_nix_build" pytestCurrentlynetworkandrequires_nix_buildare 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-graphprogram.You can generate a coverage report for the tests viacoverage run -m nix_prefetch_github.run_tests && coverage htmlchangesv7.1.0Add-q/--quietoption to decrease logging verbosityAdd--metaoption to include the commit timestamp of the latest
prefetched commit in the outputUse content of=GITHUB_TOKEN=environment variable for
authenticating with GitHub APIv7.0.0The output format changed. In previous versions the json and nix
output includedsha256as a field. This field was removed in
favour of ahashfield. The value of this field is an SRI hash.v6.0.1Fix bug in repository detection fornix-prefetch-github-directoryv6.0.0Drop support for python3.8Drop default arguments to fetchFromGitHub from json output (e.g.leaveDotGit = false;,fetchSubmodule = false;,deepClone = false;)v5.2.2Add more info to error messagesv5.2.1Fixed a bug that broke the program for users without the experimental
`nix-command` featurev5.2.0Emit warning if unsafe options –deep-clone and –leave-dot-git are
used.Improve –help output slightlyDeclutter verbose logging outputv5.1.2Use old prefetch implementation because of bug innix-prefetch-git. Seethis github
issuev5.1.1Fix bug that brokenix-prefetch-github--versionv5.1.0Usenix-prefetch-gitandnix-prefetch-urlfor calculating
sha256 sums when possible. The application will fall back to the old
method whennix-prefetch-*are not available.v5.0.1Fix breaking bug in hash generationv5.0.0Remove all dependencies to other python packages other than “core”
onesAllow users to control debugging output via the--verbositycli
optionAll commands now understand--fetch-submodulesand--no-fetch-submodulesoptionsCommands now understand--leave-dot-gitand--no-leave-dot-gitoptionsCommands now understand--deep-cloneand--no-deep-clonev4.0.4Print standard error output of subprocesses for better debuggingv4.0.3Generated hashes now don’t have a “sha256-” prefixjinja2 is no longer a dependency of nix-prefetch-githubv4.0.2packaging release, no bugfixes or featuresv4.0.1Fix issue #38v4.0Make fetching submodules the default in calls to python routines. The
CLI should be uneffected by this change.Remove default values forfetch_submodulesin all internal
classes.Implementnix-prefetch-github-latest-releasecommandv3.0major changes to the internal module structureintroduction of thenix-prefetch-github-directorycommandcode repository now functions as a nix flakev2.4added--fetch-submodulesflagFixed incompability with nix 2.4v2.3.2fix issues #21, #22nix-prefetch-github now accepts full ref names, e.g.refs/heads/masterwhich was broken since 2.3 (#23)v2.3.1Fix bug in generated nix expressionFix bug that prevented targeting tags with prefetch commandImprove error message format in case revision is not foundv2.3Remove dependency torequestsDefault tomasterbranch instead of first branch in listv2.2Add--versionflagFix bug in output formattingv2.1Fix bug (#4) that madenix-prefetch-githubincompatible withnix 2.2.v2.0The result of nixpretchgithuband 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--nixthat makes the command line tool output a
valid nix expressionRemoved the--hash-onlyand--no-hash-onlyflags and changed
add--prefetchand--no-prefetchflags to replace them.