From bf040a75802dd7c6e70f936e4bf0ca4e8f220c59 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Mon, 28 Jan 2019 22:37:13 +0100 Subject: [PATCH] Update README --- README.md | 137 ++++++++++++++++++++++++------------------------------ 1 file changed, 62 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index a02b16f..9def445 100644 --- a/README.md +++ b/README.md @@ -9,99 +9,86 @@ Inside the provided nix shell: ``` bash $ # GHCi: $ snack ghci -$ # actual build: -$ snack build +$ # run: +$ snack run -- ``` ## Usage -**NOTES** +* [Add](#add) +* [Update](#update) +* [Drop](#drop) -* no support for non-json, to enforce convention -* fixed path to nix/versions.json, to enforce convention +``` +NIV - Version manager for Nix projects -### Commands +Usage: niv COMMAND -Abbreviations: +Available options: + -h,--help Show this help text -### Attributes - -* `-b` -> `--branch` -* `-n` -> `--name` -* `-o` -> `--owner` -* `-r` -> `--repo` -* `-t` -> `--template` -* `-a` -> `--attribute` - -### VCS - -* `-h` -> `--github` -* `-l` -> `--gitlab` - -#### init - -* `[ --branch foo ...]` - -Creates (if the file doesn't exist) - -* `nix/versions.json`: -``` json -{"nixpkgs": { ... }} +Available commands: + init Initialize a Nix project. Existing files won't be + modified. + add Add dependency + show + update Update dependencies + drop Drop dependency ``` -*`nix/fetch.nix`: -``` nix -... + +### Add + +``` +Examples: + + niv add stedolan/jq + niv add NixOS/nixpkgs-channel -n nixpkgs -b nixos-18.09 + niv add my-package -v alpha-0.1 -t http://example.com/archive/.zip + +Usage: niv add PACKAGE ([-b|--branch BRANCH] | [-o|--owner OWNER] | + [-r|--repo REPO] | [-v|--version VERSION] | + [-a|--attribute KEY=VAL] | [-t|--template URL]) + [-n|--name NAME] + Add dependency + +Available options: + -t,--template URL foo + -h,--help Show this help text ``` -*`default.nix`: -``` nix -with { fetch = import ; }; -let pkgs = import fetch.nixpkgs; -in pkgs.hello + +### Update + +``` +Examples: + + niv update + niv update nixpkgs + niv update my-package -v beta-0.2 + +Usage: niv update [PACKAGE] ([-b|--branch BRANCH] | [-o|--owner OWNER] + | [-r|--repo REPO] | [-v|--version VERSION] | + [-a|--attribute KEY=VAL] | [-t|--template URL]) + Update dependencies + +Available options: + -t,--template URL foo + -h,--help Show this help text ``` -#### add +### Drop -* ``: adds the following to the versions file where `let = ` -``` json -{ "": - { "owner": "", - "repo": "", - "rev": ">", - "sha256": "", - "branch": "" - } -} ``` +Examples: -* `--branch`: specifies `` (default: master) -* `--username `: then `let = ` -* `--gitlab`: use gitlab instead of GitHub -* `--attribute `: sets `` to `` + niv drop jq -If the package already exists, merges with the package (prior to heuristics) +Usage: niv drop PACKAGE + Drop dependency -#### update - -* `[p [--commit] [--branch]]` - - `[]`: all packages are updated - - `[p1 p2 ...]`: the specified packages are updated - -* `--commit `: `rev` is set to `` and the package is prefetched -* `--branch `: `branch` is set to ``, `rev` is set to the - latest revision on that branch and the package is prefetched - -#### show - -* Shows all packages - -#### drop - -` ` - -* Drops the specified packages - -**NOTE**: should the URLs be used instead? or more simply, how do we differentiate between Gitlab/GitHub? +Available options: + -h,--help Show this help text +``` [Nix]: https://nixos.org/nix/