From d67c25f29716fd2087e71352783fcce194303a9a Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:30:27 +0100 Subject: [PATCH] Update FAQ to explain submodules (#393) * Update FAQ to explain submodules * Update README.md * Update README.md * Update README template --------- Co-authored-by: Nicolas Mattia --- README.md | 23 +++++++++++++++++++++++ README.tpl.md | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/README.md b/README.md index c4053dc..cc5b89b 100644 --- a/README.md +++ b/README.md @@ -399,6 +399,7 @@ Available options: * [How do I import a subpath of a source?](#how-do-i-import-a-subpath-of-a-source) * [How do I import NixOS modules](#how-do-i-import-nixos-modules) * [Can I use local packages?](#can-i-use-local-packages) +* [Can I use git submodules?](#can-i-use-git-submodules) ### Can I use private GitHub repositories? @@ -542,3 +543,25 @@ have a source named `` then `niv` will use the value of characters in the source name are escaped to the character `_`; i.e. to override the package `my package-foo` you need to set the environment variable `NIV_OVERRIDE_my_package_foo`. + +### Can I use a git dependency with submodules? + +Yes, however you need to follow some steps. + +Add your dependency as git dependency to your `sources.json`: +``` +niv add git git@github.com:user/repo -n name +``` + +Add `"submodules": true,` to your dependecy in the source.json: +``` +{ + "name": { + "branch": "main", + "repo": "git@github.com:user/repo", + "rev": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "submodules": true, + "type": "git" + } +} +``` diff --git a/README.tpl.md b/README.tpl.md index bf3e7a3..14d420e 100644 --- a/README.tpl.md +++ b/README.tpl.md @@ -261,6 +261,7 @@ replace_niv_show_help * [How do I import a subpath of a source?](#how-do-i-import-a-subpath-of-a-source) * [How do I import NixOS modules](#how-do-i-import-nixos-modules) * [Can I use local packages?](#can-i-use-local-packages) +* [Can I use git submodules?](#can-i-use-git-submodules) ### Can I use private GitHub repositories? @@ -404,3 +405,25 @@ have a source named `` then `niv` will use the value of characters in the source name are escaped to the character `_`; i.e. to override the package `my package-foo` you need to set the environment variable `NIV_OVERRIDE_my_package_foo`. + +### Can I use a git dependency with submodules? + +Yes, however you need to follow some steps. + +Add your dependency as git dependency to your `sources.json`: +``` +niv add git git@github.com:user/repo -n name +``` + +Add `"submodules": true,` to your dependecy in the source.json: +``` +{ + "name": { + "branch": "main", + "repo": "git@github.com:user/repo", + "rev": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", + "submodules": true, + "type": "git" + } +} +```