Description of how to use the Nix expressions

This commit is contained in:
Tyson Whitehead
2016-05-18 12:10:20 -04:00
parent 0130a56a01
commit b702d55c93

84
README.md Normal file
View File

@@ -0,0 +1,84 @@
# Overview
This package contains a collection of Nix expressions created by
SHARCNET staff for various software packages. Once copied or linked
into your *~/.nix-defexpr* directory they will allow you to install
the associated package into your Nix environment.
These directions assume you have loaded the Nix module (this enabes
your Nix environment and makes the various Nix commands avaialble)
```sh
module load nix
```
# Obtaining the latest expressions
If you don't yet have a copy of *~/nix-nixpkgs-sharcnet*, you will
need to clone a copy (use your SHARCNET credentials)
```sh
cd ~
git clone https://git.sharcnet.ca/tyson/nix-nixpkgs-sharcnet.git
```
If you already have a copy, you can update to the latest version
```sh
cd ~/nix-nixpkgs-sharcnet
git pull
```
## Installing an expression
To use any of the provided Nix expressions, you need to copy it to or
link it into your *~/.nix-defexpr* directory (replace *package.nix*
with the name of the Nix expression you wish to use)
```sh
ln -s ../nix-nixpkgs-sharcnet/package.nix ~/.nix-defexpr/
```
Using a symbolic link has the advantage that it automatically gets
updated whenever you update *~/nix-nixpkgs-sharcnet*.
# Using an expression
Once you have the expression in your *~/.nix-defexpr* you can use the
`nix-env` command to install (or update) the associated package in
your Nix environment.
## Installing and updating
To install or update the associated package (replace *package* with
the base name of the Nix expression file you copied to
*~/.nix-defexpr*)
```sh
nix-env --install --attr package
```
## Removing
To remove a package you first need to figure out its name (generally,
but not nessesarily, the same as the name of the Nix expression file)
```sh
nix-env --query
```
Then you (replace *package* with the package name)
```sh
nix-env --uninstall package
```
## Reverting
To undo the last install/update/remove command
```sh
nix-env --rollback
```