Skip to content

Commit

Permalink
Update FAQ to explain submodules (#393)
Browse files Browse the repository at this point in the history
* Update FAQ to explain submodules

* Update README.md

* Update README.md

* Update README template

---------

Co-authored-by: Nicolas Mattia <nicolas@nmattia.com>
  • Loading branch information
LDprg and nmattia committed Feb 22, 2024
1 parent 51216db commit d67c25f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Expand Up @@ -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?

Expand Down Expand Up @@ -542,3 +543,25 @@ have a source named `<name>` 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"
}
}
```
23 changes: 23 additions & 0 deletions README.tpl.md
Expand Up @@ -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?

Expand Down Expand Up @@ -404,3 +405,25 @@ have a source named `<name>` 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"
}
}
```

0 comments on commit d67c25f

Please sign in to comment.