Use --file to install directly instead of copying to ~/.nix-defexp

This commit is contained in:
Tyson Whitehead
2016-11-21 16:33:52 -05:00
parent efb0b213e4
commit 9dcf69a9e8

View File

@@ -1,12 +1,11 @@
# 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.
SHARCNET staff for various software packages. You can use them to
install the associated packages 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)
These directions assume you have loaded the Nix module (this enables
your Nix environment and makes the various Nix commands available)
```sh
@@ -30,31 +29,24 @@ 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.
Once you have a copy of the expressions you can use `nix-env` to
install, update, or remove them from your 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*)
## Installing an expression
To install (or update) a package pass the corresponding file (replace
*package.nix* in what follows) to `nix-env` using the `--file` option
```sh
nix-env --install --file package.nix
```
You can also copy or symlink the file into your *~/.nix-defexpr*
directory and then refer to it as a top-level attribute (replace
*package* with the base name of the copied file)
```sh
nix-env --install --attr package
@@ -63,7 +55,7 @@ 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)
but not necessarily, the same as the name of the Nix expression file)
```sh
nix-env --query