2019-01-17 23:59:01 +03:00
|
|
|
# niv
|
|
|
|
|
|
|
|
A tool for dealing with third-party packages in [Nix].
|
|
|
|
|
2019-01-18 01:00:48 +03:00
|
|
|
## Building
|
|
|
|
|
|
|
|
Inside the provided nix shell:
|
|
|
|
|
|
|
|
``` bash
|
|
|
|
$ # GHCi:
|
2019-01-23 23:55:26 +03:00
|
|
|
$ snack ghci
|
2019-01-18 01:00:48 +03:00
|
|
|
$ # actual build:
|
2019-01-23 23:55:26 +03:00
|
|
|
$ snack build
|
2019-01-18 01:00:48 +03:00
|
|
|
```
|
|
|
|
|
2019-01-17 23:59:01 +03:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
**NOTES**
|
|
|
|
|
|
|
|
* no support for non-json, to enforce convention
|
2019-01-24 23:58:22 +03:00
|
|
|
* fixed path to nix/versions.json, to enforce convention
|
2019-01-17 23:59:01 +03:00
|
|
|
|
|
|
|
### Commands
|
|
|
|
|
2019-01-24 23:58:22 +03:00
|
|
|
Abbreviations:
|
|
|
|
|
|
|
|
### Attributes
|
|
|
|
|
|
|
|
* `-b` -> `--branch`
|
|
|
|
* `-n` -> `--name`
|
|
|
|
* `-o` -> `--owner`
|
|
|
|
* `-r` -> `--repo`
|
|
|
|
* `-t` -> `--template`
|
|
|
|
* `-a` -> `--attribute`
|
|
|
|
|
|
|
|
### VCS
|
|
|
|
|
|
|
|
* `-h` -> `--github`
|
|
|
|
* `-l` -> `--gitlab`
|
|
|
|
|
2019-01-17 23:59:01 +03:00
|
|
|
#### init
|
|
|
|
|
2019-01-24 23:58:22 +03:00
|
|
|
* `[<p1> --branch foo <p2> ...]`
|
2019-01-17 23:59:01 +03:00
|
|
|
|
|
|
|
Creates (if the file doesn't exist)
|
|
|
|
|
|
|
|
* `nix/versions.json`:
|
|
|
|
``` json
|
|
|
|
{"nixpkgs": { ... }}
|
|
|
|
```
|
|
|
|
|
|
|
|
*`nix/fetch.nix`:
|
|
|
|
``` nix
|
|
|
|
...
|
|
|
|
```
|
|
|
|
|
|
|
|
*`default.nix`:
|
|
|
|
``` nix
|
|
|
|
with { fetch = import <fetch>; };
|
|
|
|
let pkgs = import fetch.nixpkgs;
|
|
|
|
in pkgs.hello
|
|
|
|
```
|
|
|
|
|
|
|
|
#### add
|
|
|
|
|
|
|
|
* `<package>`: adds the following to the versions file where `let <username/repo> = <package>`
|
|
|
|
``` json
|
|
|
|
{ "<repo>":
|
|
|
|
{ "owner": "<username>",
|
|
|
|
"repo": "<repo>",
|
|
|
|
"rev": "<latest commit on <branch>>",
|
|
|
|
"sha256": "<sha256>",
|
|
|
|
"branch": "<branch>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-01-18 01:00:48 +03:00
|
|
|
* `--branch`: specifies `<branch>` (default: master)
|
2019-01-17 23:59:01 +03:00
|
|
|
* `--username <username>`: then `let <repo> = <package>`
|
|
|
|
* `--gitlab`: use gitlab instead of GitHub
|
2019-01-18 01:00:48 +03:00
|
|
|
* `--attribute <attribute> <value>`: sets `<attribute>` to `<value>`
|
2019-01-17 23:59:01 +03:00
|
|
|
|
2019-01-23 23:55:26 +03:00
|
|
|
#### update
|
|
|
|
|
|
|
|
* `[p [--commit] [--branch]]`
|
|
|
|
- `[]`: all packages are updated
|
|
|
|
- `[p1 p2 ...]`: the specified packages are updated
|
|
|
|
|
|
|
|
* `--commit <rev>`: `rev` is set to `<rev>` and the package is prefetched
|
|
|
|
* `--branch <branch>`: `branch` is set to `<branch>`, `rev` is set to the
|
|
|
|
latest revision on that branch and the package is prefetched
|
|
|
|
|
|
|
|
#### show
|
|
|
|
|
|
|
|
`[--branch] [--rev] [--owner] [--repo] [--attribute <attribute>] <p1> <p2>`...
|
|
|
|
if no attribute (br, rev, ...) is given, all attributes are shown for
|
|
|
|
`<packages>`. Otherwise the specified attributes are shown. If no package is
|
|
|
|
specified: `<packages> = <all packages>`, otherwise `<packages>` is set to
|
|
|
|
the specified packages.
|
|
|
|
|
2019-01-17 23:59:01 +03:00
|
|
|
**NOTE**: should the URLs be used instead? or more simply, how do we differentiate between Gitlab/GitHub?
|
|
|
|
|
2019-01-18 00:01:09 +03:00
|
|
|
[Nix]: https://nixos.org/nix/
|