tuto:nix
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tuto:nix [2020/03/06 19:32] – [Documentation] root | tuto:nix [2022/06/21 20:15] (Version actuelle) – [nix-shell] root | ||
|---|---|---|---|
| Ligne 44: | Ligne 44: | ||
| </ | </ | ||
| + | ==== NIX_PAGER ==== | ||
| < | < | ||
| export NIX_PAGER= | export NIX_PAGER= | ||
| + | </ | ||
| + | |||
| + | ==== nixpkgs ==== | ||
| + | < | ||
| + | nixpkgs=https:// | ||
| + | nixpkgs=channel: | ||
| </ | </ | ||
| Ligne 67: | Ligne 74: | ||
| $ nix-env -u --dry-run | $ nix-env -u --dry-run | ||
| $ nix-env -e hello | $ nix-env -e hello | ||
| + | </ | ||
| + | |||
| + | Force a specific channel (master in this example): | ||
| + | < | ||
| + | $ nix-env -f https:// | ||
| </ | </ | ||
| Ligne 128: | Ligne 140: | ||
| ==== nix-shell ==== | ==== nix-shell ==== | ||
| * https:// | * https:// | ||
| + | |||
| + | <code haskell shell.nix> | ||
| + | { pkgs ? import < | ||
| + | |||
| + | with pkgs; | ||
| + | |||
| + | mkShell { | ||
| + | buildInputs = [ | ||
| + | elixir_1_10 | ||
| + | nodejs-12_x | ||
| + | ]; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ nix-shell | ||
| + | $ nix-shell shell.nix | ||
| + | </ | ||
| + | |||
| < | < | ||
| $ nix-shell --pure -E ' | $ nix-shell --pure -E ' | ||
| Ligne 144: | Ligne 175: | ||
| < | < | ||
| $ nix-shell '< | $ nix-shell '< | ||
| + | </ | ||
| + | |||
| + | Force a specific channel: | ||
| + | < | ||
| + | $ nix-shell -p hello -I nixpkgs=https:// | ||
| </ | </ | ||
| Ligne 197: | Ligne 233: | ||
| $ nix-channel --add https:// | $ nix-channel --add https:// | ||
| $ nix-channel --remove nixpkgs_19_09 | $ nix-channel --remove nixpkgs_19_09 | ||
| + | </ | ||
| + | |||
| + | Master channel: | ||
| + | < | ||
| + | $ nix-channel --add https:// | ||
| </ | </ | ||
| Ligne 314: | Ligne 355: | ||
| path is '/ | path is '/ | ||
| 02cgs6b1rmh8hmcwm5wpxxg32p3km9c05606pykv49qq1spd6p38 | 02cgs6b1rmh8hmcwm5wpxxg32p3km9c05606pykv49qq1spd6p38 | ||
| + | </ | ||
| + | |||
| + | ==== nix-instantiate ==== | ||
| + | < | ||
| + | $ nix-instantiate --eval -E ' | ||
| + | " | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ nix-instantiate --eval -E ' | ||
| + | " | ||
| </ | </ | ||
| Ligne 416: | Ligne 468: | ||
| Welcome to Nix version 2.3.3. Type :? for help. | Welcome to Nix version 2.3.3. Type :? for help. | ||
| - | $ nix-repl> | + | nix-repl> |
| " | " | ||
| </ | </ | ||
| < | < | ||
| - | $ nix-repl> | + | $ nix repl |
| + | nix-repl> | ||
| nix-repl> | nix-repl> | ||
| nix-repl> | nix-repl> | ||
| this derivation produced the following outputs: out -> / | this derivation produced the following outputs: out -> / | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | nix-repl> | ||
| + | " | ||
| + | </ | ||
| + | |||
| + | === nix edit === | ||
| + | Permet d' | ||
| + | < | ||
| + | $ EDITOR=vim nix edit -f "< | ||
| + | </ | ||
| + | |||
| + | On install ensuite le paquet: | ||
| + | < | ||
| + | $ nix-env -i samba | ||
| </ | </ | ||
| Ligne 505: | Ligne 574: | ||
| </ | </ | ||
| - | ==== Chemains | + | ==== Chemins |
| < | < | ||
| $ nix eval ' | $ nix eval ' | ||
| Ligne 609: | Ligne 678: | ||
| ==== Override ==== | ==== Override ==== | ||
| < | < | ||
| - | $ nix-repl | + | $ nix repl |
| nix-repl> | nix-repl> | ||
| Added 4360 variables. | Added 4360 variables. | ||
| Ligne 739: | Ligne 808: | ||
| | | ||
| + | </ | ||
| + | |||
| + | ==== builder ==== | ||
| + | |||
| + | < | ||
| + | { stdenv, fetchurl, openmpi }: | ||
| + | |||
| + | stdenv.mkDerivation rec { | ||
| + | name = " | ||
| + | src = fetchurl { | ||
| + | url = " | ||
| + | | ||
| + | }; | ||
| + | |||
| + | buildInputs = [ openmpi ]; | ||
| + | |||
| + | builder = builtins.toFile " | ||
| + | " | ||
| + | source $stdenv/ | ||
| + | mpicc -w -o oned.exe $src | ||
| + | mkdir $out | ||
| + | mkdir $out/bin | ||
| + | cp oned.exe $out/bin | ||
| + | "; | ||
| + | |||
| + | meta = { | ||
| + | description = "JDEV 2017 Nix tutoriel"; | ||
| + | license | ||
| + | platforms | ||
| + | }; | ||
| + | } | ||
| </ | </ | ||
tuto/nix.1583523126.txt.gz · Dernière modification : de root
