mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Merge pull request #9505 from fricklerhandwerk/quick-start
shorten the quick start chapter
This commit is contained in:
commit
efc65ef122
1 changed files with 16 additions and 71 deletions
|
@ -1,10 +1,9 @@
|
||||||
# Quick Start
|
# Quick Start
|
||||||
|
|
||||||
This chapter is for impatient people who don't like reading
|
This chapter is for impatient people who don't like reading documentation.
|
||||||
documentation. For more in-depth information you are kindly referred
|
For more in-depth information you are kindly referred to subsequent chapters.
|
||||||
to subsequent chapters.
|
|
||||||
|
|
||||||
1. Install Nix by running the following:
|
1. Install Nix:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ curl -L https://nixos.org/nix/install | sh
|
$ curl -L https://nixos.org/nix/install | sh
|
||||||
|
@ -13,87 +12,33 @@ to subsequent chapters.
|
||||||
The install script will use `sudo`, so make sure you have sufficient rights.
|
The install script will use `sudo`, so make sure you have sufficient rights.
|
||||||
On Linux, `--daemon` can be omitted for a single-user install.
|
On Linux, `--daemon` can be omitted for a single-user install.
|
||||||
|
|
||||||
For other installation methods, see [here](installation/index.md).
|
For other installation methods, see the detailed [installation instructions](installation/index.md).
|
||||||
|
|
||||||
1. See what installable packages are currently available in the
|
1. Run software without installing it permanently:
|
||||||
channel:
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --query --available --attr-path
|
$ nix-shell --packages cowsay lolcat
|
||||||
nixpkgs.docbook_xml_dtd_43 docbook-xml-4.3
|
|
||||||
nixpkgs.docbook_xml_dtd_45 docbook-xml-4.5
|
|
||||||
nixpkgs.firefox firefox-33.0.2
|
|
||||||
nixpkgs.hello hello-2.9
|
|
||||||
nixpkgs.libxslt libxslt-1.1.28
|
|
||||||
…
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Install some packages from the channel:
|
This downloads the specified packages with all their dependencies, and drops you into a Bash shell where the commands provided by those packages are present.
|
||||||
|
This will not affect your normal environment:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-env --install --attr nixpkgs.hello
|
[nix-shell:~]$ cowsay Hello, Nix! | lolcat
|
||||||
```
|
```
|
||||||
|
|
||||||
This should download pre-built packages; it should not build them
|
Exiting the shell will make the programs disappear again:
|
||||||
locally (if it does, something went wrong).
|
|
||||||
|
|
||||||
1. Test that they work:
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ which hello
|
|
||||||
/home/eelco/.nix-profile/bin/hello
|
|
||||||
$ hello
|
|
||||||
Hello, world!
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Uninstall a package:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-env --uninstall hello
|
|
||||||
```
|
|
||||||
|
|
||||||
1. You can also test a package without installing it:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-shell --packages hello
|
|
||||||
```
|
|
||||||
|
|
||||||
This builds or downloads GNU Hello and its dependencies, then drops
|
|
||||||
you into a Bash shell where the `hello` command is present, all
|
|
||||||
without affecting your normal environment:
|
|
||||||
|
|
||||||
```console
|
|
||||||
[nix-shell:~]$ hello
|
|
||||||
Hello, world!
|
|
||||||
|
|
||||||
[nix-shell:~]$ exit
|
[nix-shell:~]$ exit
|
||||||
|
$ lolcat
|
||||||
$ hello
|
lolcat: command not found
|
||||||
hello: command not found
|
|
||||||
```
|
```
|
||||||
|
|
||||||
1. To keep up-to-date with the channel, do:
|
1. Search for more packages on <search.nixos.org> to try them out.
|
||||||
|
|
||||||
|
1. Free up storage space:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-channel --update nixpkgs
|
$ nix-collect-garbage
|
||||||
$ nix-env --upgrade '*'
|
|
||||||
```
|
|
||||||
|
|
||||||
The latter command will upgrade each installed package for which
|
|
||||||
there is a “newer” version (as determined by comparing the version
|
|
||||||
numbers).
|
|
||||||
|
|
||||||
1. If you're unhappy with the result of a `nix-env` action (e.g., an
|
|
||||||
upgraded package turned out not to work properly), you can go back:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-env --rollback
|
|
||||||
```
|
|
||||||
|
|
||||||
1. You should periodically run the Nix garbage collector to get rid of
|
|
||||||
unused packages, since uninstalls or upgrades don't actually delete
|
|
||||||
them:
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-collect-garbage --delete-old
|
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue