1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-19 11:27:40 +03:00
Easy dependency management for Nix projects
Go to file
2019-02-08 19:29:48 +01:00
.circleci Fix Circle config 2019-02-05 15:43:23 +01:00
nix Update README 2019-02-08 19:29:48 +01:00
script Implement dropping package attr 2019-02-08 19:07:05 +01:00
.gitignore Add gitignore 2019-01-31 19:05:08 +01:00
default.nix Restructure Nix dirs 2019-02-03 14:07:42 +01:00
Main.hs Implement dropping package attr 2019-02-08 19:07:05 +01:00
package.yaml Prettify specs.json 2019-02-07 14:15:56 +01:00
README.md Update README 2019-02-08 19:29:48 +01:00
README.tpl.md Update README 2019-02-08 19:29:48 +01:00
shell.nix Restructure Nix dirs 2019-02-03 14:07:42 +01:00

niv

CircleCI

A tool for dealing with third-party packages in Nix. Read more about it in the usage section.

Install

$ nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master

Build

Inside the provided nix shell:

$ # GHCi:
$ snack ghci
$ # run:
$ snack run -- <args>

Usage

niv simplifies adding and updating dependencies in Nix projects. It uses a single file, nix/sources.json, where it stores the data necessary for fetching and updating the packages.

  • Add: inserts a package in nix/sources.json.
  • Update: updates one or all packages in nix/sources.json.
  • Drop: deletes a package from nix/sources.json.

niv has two more utility functions:

  • Init: bootstraps a Nix projects, in particular creates a nix/sources.json file containing niv and nixpkgs as well as a nix/sources.nix file that returns the sources as a Nix object.
  • Show: shows the packages' information.
NIV - Version manager for Nix projects

Usage: niv COMMAND

Available options:
  -h,--help                Show this help text

Available commands:
  init                     Initialize a Nix project. Existing files won't be
                           modified.
  add                      Add dependency
  show                     
  update                   Update dependencies
  drop                     Drop dependency

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/<version>.zip

Usage: niv add [-n|--name NAME] PACKAGE ([-a|--attribute KEY=VAL] |
               [-b|--branch BRANCH] | [-o|--owner OWNER] | [-r|--repo REPO] |
               [-v|--version VERSION] | [-t|--template URL])
  Add dependency

Available options:
  -n,--name NAME           Set the package name to <NAME>
  -a,--attribute KEY=VAL   Set the package spec attribute <KEY> to <VAL>
  -b,--branch BRANCH       Equivalent to --attribute branch=<BRANCH>
  -o,--owner OWNER         Equivalent to --attribute owner=<OWNER>
  -r,--repo REPO           Equivalent to --attribute repo=<REPO>
  -v,--version VERSION     Equivalent to --attribute version=<VERSION>
  -t,--template URL        Used during 'update' when building URL. Occurrences
                           of <foo> are replaced with attribute 'foo'.
  -h,--help                Show this help text

Update

Examples:

  niv update
  niv update nixpkgs
  niv update my-package -v beta-0.2

Usage: niv update [PACKAGE] ([-a|--attribute KEY=VAL] | [-b|--branch BRANCH] |
                  [-o|--owner OWNER] | [-r|--repo REPO] | [-v|--version VERSION]
                  | [-t|--template URL])
  Update dependencies

Available options:
  -a,--attribute KEY=VAL   Set the package spec attribute <KEY> to <VAL>
  -b,--branch BRANCH       Equivalent to --attribute branch=<BRANCH>
  -o,--owner OWNER         Equivalent to --attribute owner=<OWNER>
  -r,--repo REPO           Equivalent to --attribute repo=<REPO>
  -v,--version VERSION     Equivalent to --attribute version=<VERSION>
  -t,--template URL        Used during 'update' when building URL. Occurrences
                           of <foo> are replaced with attribute 'foo'.
  -h,--help                Show this help text

Drop

Examples:

  niv drop jq
  niv drop my-package version

Usage: niv drop PACKAGE [ATTRIBUTE]
  Drop dependency

Available options:
  -h,--help                Show this help text

Init

Usage: niv init 
  Initialize a Nix project. Existing files won't be modified.

Available options:
  -h,--help                Show this help text

show

Usage: niv show 

Available options:
  -h,--help                Show this help text