{"id":15282016,"url":"https://github.com/seppeljordan/nix-prefetch-github","last_synced_at":"2025-04-05T08:03:45.228Z","repository":{"id":45870971,"uuid":"125272173","full_name":"seppeljordan/nix-prefetch-github","owner":"seppeljordan","description":"Prefetch sources from github for nix build tool","archived":false,"fork":false,"pushed_at":"2025-02-01T00:39:17.000Z","size":481,"stargazers_count":75,"open_issues_count":2,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:01:53.548Z","etag":null,"topics":["nix","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seppeljordan.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T20:52:31.000Z","updated_at":"2025-03-20T08:12:06.000Z","dependencies_parsed_at":"2024-11-07T16:00:35.374Z","dependency_job_id":"bbb756eb-9107-4379-b6d1-7ba40fa74202","html_url":"https://github.com/seppeljordan/nix-prefetch-github","commit_stats":{"total_commits":307,"total_committers":4,"mean_commits":76.75,"dds":"0.013029315960912058","last_synced_commit":"f933c2ed373618993d21964f7680422340a40f77"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seppeljordan%2Fnix-prefetch-github","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seppeljordan%2Fnix-prefetch-github/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seppeljordan%2Fnix-prefetch-github/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seppeljordan%2Fnix-prefetch-github/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seppeljordan","download_url":"https://codeload.github.com/seppeljordan/nix-prefetch-github/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305930,"owners_count":20917207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nix","python"],"created_at":"2024-09-30T14:05:16.033Z","updated_at":"2025-04-05T08:03:45.186Z","avatar_url":"https://github.com/seppeljordan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+title: nix-prefetch-github\n\n* Introduction\n  This module implements a python function and a command line tool to\n  help you fetch sources from github when using =fetchFromGitHub=.\n\n  This program can be distributed under the conditions of the GNU\n  Public License Version 3. Check out =LICENSE.txt= to read the\n  license text.\n\n* Dependencies\n  - Python and its standard library\n  - nix-prefetch-url\n  - nix-prefech-github\n  - git\n  - nix\n\n* Command Line Example\n  #+begin_src sh :results verbatim :export :wrap example :exports both\n    result/bin/nix-prefetch-github seppeljordan nix-prefetch-github\n  #+end_src\n\n  #+RESULTS:\n  #+begin_example\n  {\n      \"owner\": \"seppeljordan\",\n      \"repo\": \"nix-prefetch-github\",\n      \"rev\": \"9578399cadb1cb2b252438cf14663333e8c3ee00\",\n      \"hash\": \"sha256-JFC1+y+FMs2TwWjJxlAKAyDbSLFBE9J65myp7+slp50=\"\n  }\n  #+end_example\n\n* Available Commands\n** nix-prefetch-github\n   This command downloads the code from a github repository and puts\n   it into the local nix store. It also prints the function arguments\n   to =fetchFromGitHub= to the standard output. :\n\n   #+begin_src sh :results verbatim :wrap example :exports results\n     result/bin/nix-prefetch-github --help\n   #+end_src\n\n   #+RESULTS:\n   #+begin_example\n   usage: nix-prefetch-github [-h] [--fetch-submodules] [--no-fetch-submodules]\n\t\t\t      [--leave-dot-git] [--no-leave-dot-git]\n\t\t\t      [--deep-clone] [--no-deep-clone] [--verbose]\n\t\t\t      [--quiet] [--nix] [--json] [--meta] [--version]\n\t\t\t      [--rev REV]\n\t\t\t      owner repo\n\n   positional arguments:\n     owner\n     repo\n\n   options:\n     -h, --help            show this help message and exit\n     --fetch-submodules    Include git submodules in the output derivation\n     --no-fetch-submodules\n\t\t\t   Don't include git submodules in output derivation\n     --leave-dot-git       Include .git folder in output derivation. Use this if\n\t\t\t   you need repository data, e.g. current commit hash,\n\t\t\t   for the build process.\n     --no-leave-dot-git    Don't include .git folder in output derivation.\n     --deep-clone          Include all of the repository history in the output\n\t\t\t   derivation. This option implies --leave-dot-git.\n     --no-deep-clone       Don't include the repository history in the output\n\t\t\t   derivation.\n     --verbose, -v         Print additional information about the programs\n\t\t\t   execution. This is useful if you want to issue a bug\n\t\t\t   report.\n     --quiet, -q           Print less information about the programs execution.\n     --nix                 Output the results as valid nix code.\n     --json                Output the results in the JSON format\n     --meta                Output the results in JSON format where the arguments\n\t\t\t   to fetchFromGitHub are located under the src key of\n\t\t\t   the resulting json dictionary and meta information\n\t\t\t   about the prefetched repository is located under the\n\t\t\t   meta key of the output.\n     --version             show program's version number and exit\n     --rev REV\n   #+end_example\n\n** nix-prefetch-github-directory\n   This command examins the current working directory and tries to\n   figure out if it is part of a git repository linked to github. If\n   this was successful the program prefetches the currently checked\n   out commit from the =origin= remote repository similar to the\n   command =nix-prefetch-github=.\n\n   #+begin_src sh :results verbatim :wrap example :exports results\n     result/bin/nix-prefetch-github-directory --help\n   #+end_src\n\n   #+RESULTS:\n   #+begin_example\n   usage: .nix-prefetch-github-directory-wrapped [-h] [--fetch-submodules]\n\t\t\t\t\t\t [--no-fetch-submodules]\n\t\t\t\t\t\t [--leave-dot-git]\n\t\t\t\t\t\t [--no-leave-dot-git]\n\t\t\t\t\t\t [--deep-clone] [--no-deep-clone]\n\t\t\t\t\t\t [--verbose] [--quiet] [--nix]\n\t\t\t\t\t\t [--json] [--meta] [--version]\n\t\t\t\t\t\t [--directory DIRECTORY]\n\t\t\t\t\t\t [--remote REMOTE]\n\n   options:\n     -h, --help            show this help message and exit\n     --fetch-submodules    Include git submodules in the output derivation\n     --no-fetch-submodules\n\t\t\t   Don't include git submodules in output derivation\n     --leave-dot-git       Include .git folder in output derivation. Use this if\n\t\t\t   you need repository data, e.g. current commit hash,\n\t\t\t   for the build process.\n     --no-leave-dot-git    Don't include .git folder in output derivation.\n     --deep-clone          Include all of the repository history in the output\n\t\t\t   derivation. This option implies --leave-dot-git.\n     --no-deep-clone       Don't include the repository history in the output\n\t\t\t   derivation.\n     --verbose, -v         Print additional information about the programs\n\t\t\t   execution. This is useful if you want to issue a bug\n\t\t\t   report.\n     --quiet, -q           Print less information about the programs execution.\n     --nix                 Output the results as valid nix code.\n     --json                Output the results in the JSON format\n     --meta                Output the results in JSON format where the arguments\n\t\t\t   to fetchFromGitHub are located under the src key of\n\t\t\t   the resulting json dictionary and meta information\n\t\t\t   about the prefetched repository is located under the\n\t\t\t   meta key of the output.\n     --version             show program's version number and exit\n     --directory DIRECTORY\n     --remote REMOTE\n   #+end_example\n\n** nix-prefetch-github-latest-release\n   This command fetches the code for the latest release of the\n   specified repository.\n\n   #+begin_src sh :results verbatim :wrap example :exports results\n     result/bin/nix-prefetch-github-latest-release --help\n   #+end_src\n\n   #+RESULTS:\n   #+begin_example\n   usage: nix-prefetch-github-latest-release [-h] [--fetch-submodules]\n\t\t\t\t\t     [--no-fetch-submodules]\n\t\t\t\t\t     [--leave-dot-git]\n\t\t\t\t\t     [--no-leave-dot-git] [--deep-clone]\n\t\t\t\t\t     [--no-deep-clone] [--verbose]\n\t\t\t\t\t     [--quiet] [--nix] [--json] [--meta]\n\t\t\t\t\t     [--version]\n\t\t\t\t\t     owner repo\n\n   positional arguments:\n     owner\n     repo\n\n   options:\n     -h, --help            show this help message and exit\n     --fetch-submodules    Include git submodules in the output derivation\n     --no-fetch-submodules\n\t\t\t   Don't include git submodules in output derivation\n     --leave-dot-git       Include .git folder in output derivation. Use this if\n\t\t\t   you need repository data, e.g. current commit hash,\n\t\t\t   for the build process.\n     --no-leave-dot-git    Don't include .git folder in output derivation.\n     --deep-clone          Include all of the repository history in the output\n\t\t\t   derivation. This option implies --leave-dot-git.\n     --no-deep-clone       Don't include the repository history in the output\n\t\t\t   derivation.\n     --verbose, -v         Print additional information about the programs\n\t\t\t   execution. This is useful if you want to issue a bug\n\t\t\t   report.\n     --quiet, -q           Print less information about the programs execution.\n     --nix                 Output the results as valid nix code.\n     --json                Output the results in the JSON format\n     --meta                Output the results in JSON format where the arguments\n\t\t\t   to fetchFromGitHub are located under the src key of\n\t\t\t   the resulting json dictionary and meta information\n\t\t\t   about the prefetched repository is located under the\n\t\t\t   meta key of the output.\n     --version             show program's version number and exit\n   #+end_example\n\n* development environment\n  Use =nix develop= with flake support enabled. Development without\n  nix flake support is not officially supported. Run the provided\n  tests via =pytest=. You can control what kind of tests are run via\n  the variable =DISABLED_TESTS=:\n\n  #+begin_example\n    # Only run tests that don't hit network and don't use nix\n    DISABLED_TESTS=\"network requires_nix_build\" pytest\n  #+end_example\n\n  Currently =network= and =requires_nix_build= are the only values\n  that make sense with this environment variable.\n\n  You can visualize the dependency graph of the individual python\n  modules via the =./generate-dependency-graph= program.\n\n  You can generate a coverage report for the tests via\n\n  #+begin_example\n    coverage run -m nix_prefetch_github.run_tests \u0026\u0026 coverage html\n  #+end_example\n\n  \n\n* changes\n** v8.0.0 (not released yet)\n   - Drop official support for Python versions \u003c3.11 and introduce\n     official support for Python version 3.12\n   - Drop nix-build based prefetcher. This means that users need to\n     have =nix-prefetch-git= and =nix-prefetch=url= available in their\n     PATH.\n   - Meta information the program outputs now contains the store path\n     of prefetched repositories.\n\n** v7.1.0\n   - Add =-q= / =--quiet= option to decrease logging verbosity\n   - Add =--meta= option to include the commit timestamp of the latest\n     prefetched commit in the output\n   - Use content of ==GITHUB_TOKEN== environment variable for\n     authenticating with GitHub API\n\n** v7.0.0\n   - The output format changed. In previous versions the json and nix\n     output included =sha256= as a field. This field was removed in\n     favour of a =hash= field. The value of this field is an SRI hash.\n\n** v6.0.1\n   - Fix bug in repository detection for\n     =nix-prefetch-github-directory=\n\n** v6.0.0\n   - Drop support for python3.8\n   - Drop default arguments to fetchFromGitHub from json output\n     (e.g. =leaveDotGit = false;=, =fetchSubmodule = false;=,\n     =deepClone = false;=)\n\n** v5.2.2\n   - Add more info to error messages\n\n** v5.2.1\n   - Fixed a bug that broke the program for users without the\n     experimental `nix-command` feature\n\n** v5.2.0\n   - Emit warning if unsafe options --deep-clone and --leave-dot-git\n     are used.\n   - Improve --help output slightly\n   - Declutter verbose logging output\n\n** v5.1.2\n   - Use old prefetch implementation because of bug in\n     =nix-prefetch-git=.  See [[https://github.com/NixOS/nixpkgs/issues/168147][this github issue]]\n** v5.1.1\n   - Fix bug that broke =nix-prefetch-github --version=\n\n** v5.1.0\n   - Use =nix-prefetch-git= and =nix-prefetch-url= for calculating\n     sha256 sums when possible. The application will fall back to the\n     old method when =nix-prefetch-*= are not available.\n\n** v5.0.1\n   - Fix breaking bug in hash generation\n\n** v5.0.0\n   - Remove all dependencies to other python packages other than\n     \"core\" ones\n   - Allow users to control debugging output via the =--verbosity= cli\n     option\n   - All commands now understand =--fetch-submodules= and\n     =--no-fetch-submodules= options\n   - Commands now understand =--leave-dot-git= and\n     =--no-leave-dot-git= options\n   - Commands now understand =--deep-clone= and =--no-deep-clone=\n\n** v4.0.4\n   - Print standard error output of subprocesses for better debugging\n\n** v4.0.3\n   - Generated hashes now don't have a \"sha256-\" prefix\n   - jinja2 is no longer a dependency of nix-prefetch-github\n\n** v4.0.2\n   - packaging release, no bugfixes or features\n\n** v4.0.1\n   - Fix issue #38\n\n** v4.0\n   - Make fetching submodules the default in calls to python\n     routines. The CLI should be uneffected by this change.\n   - Remove default values for =fetch_submodules= in all internal\n     classes.\n   - Implement =nix-prefetch-github-latest-release= command\n\n** v3.0\n   - major changes to the internal module structure\n   - introduction of the =nix-prefetch-github-directory= command\n   - code repository now functions as a nix flake\n\n** v2.4\n   - added =--fetch-submodules= flag\n   - Fixed incompability with nix 2.4\n\n** v2.3.2\n   - fix issues #21, #22\n   - nix-prefetch-github now accepts full ref names, e.g.\n     =refs/heads/master= which was broken since 2.3 (#23)\n\n** v2.3.1\n   - Fix bug in generated nix expression\n   - Fix bug that prevented targeting tags with prefetch command\n   - Improve error message format in case revision is not found\n\n** v2.3\n   - Remove dependency to =requests=\n   - Default to =master= branch instead of first branch in list\n\n** v2.2\n   - Add =--version= flag\n   - Fix bug in output formatting\n\n** v2.1\n   - Fix bug (#4) that made =nix-prefetch-github= incompatible with\n     =nix 2.2=.\n\n** v2.0\n   - The result of nix_pretch_github and its corresponding command\n     line tool now contains always the actual commit hash as detected\n     by the tool instead of the branch or tag name.\n   - Add a new flag =--nix= that makes the command line tool output a\n     valid nix expression\n   - Removed the =--hash-only= and =--no-hash-only= flags and changed\n     add =--prefetch= and =--no-prefetch= flags to replace them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseppeljordan%2Fnix-prefetch-github","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseppeljordan%2Fnix-prefetch-github","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseppeljordan%2Fnix-prefetch-github/lists"}