From 82d627d5a8c7e7abfbe0c012ea7bc513ac65272f Mon Sep 17 00:00:00 2001 From: LDprg <71488985+LDprg@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:02:00 +0100 Subject: [PATCH 1/4] Update FAQ to explain submodules --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index c4053dc..4168b45 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 git submodules? + +Yes, however you need to follow some steps. + +Add dependecy as git dependecy to your source.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" + } +} +``` From 05811d1ddf8999eb89bc36ef268aceba5936cf9f Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 22 Feb 2024 23:26:57 +0100 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4168b45..2882926 100644 --- a/README.md +++ b/README.md @@ -548,7 +548,7 @@ override the package `my package-foo` you need to set the environment variable Yes, however you need to follow some steps. -Add dependecy as git dependecy to your source.json: +Add your dependency as git dependency to your `sources.json`: ``` niv add git git@github.com:user/repo -n name ``` From 0269ac8c3217ef3bb38aeaafcf0e09d22ff0728f Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 22 Feb 2024 23:27:02 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2882926..cc5b89b 100644 --- a/README.md +++ b/README.md @@ -544,7 +544,7 @@ 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 git submodules? +### Can I use a git dependency with submodules? Yes, however you need to follow some steps. From 6baa98e8fbf3b98fc6a91d4b322515d03242428c Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 22 Feb 2024 23:28:20 +0100 Subject: [PATCH 4/4] Update README template --- README.tpl.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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" + } +} +```