Outils pour utilisateurs

Outils du site


tuto:nix

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tuto:nix [2020/03/14 11:08] – [nix-shell] roottuto:nix [2022/06/21 20:15] (Version actuelle) – [nix-shell] root
Ligne 44: Ligne 44:
 </xtermrtf> </xtermrtf>
  
 +==== NIX_PAGER ====
 <xtermrtf> <xtermrtf>
 export NIX_PAGER= export NIX_PAGER=
 +</xtermrtf>
 +
 +==== nixpkgs ====
 +<xtermrtf>
 +nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-15.09.tar.gz
 +nixpkgs=channel:nixos-15.09
 </xtermrtf> </xtermrtf>
  
Ligne 133: Ligne 140:
 ==== nix-shell ==== ==== nix-shell ====
   * https://www.sam.today/blog/environments-with-nix-shell-learning-nix-pt-1/   * https://www.sam.today/blog/environments-with-nix-shell-learning-nix-pt-1/
 +
 +<code haskell shell.nix>
 +{ pkgs ? import <nixpkgs> {} }:
 +
 +with pkgs;
 +
 +mkShell {
 +  buildInputs = [
 +    elixir_1_10
 +    nodejs-12_x
 +  ];
 +}
 +</code>
 +
 +<xtermrtf>
 +$ nix-shell
 +$ nix-shell shell.nix
 +</xtermrtf>
 +
 <xtermrtf> <xtermrtf>
 $ nix-shell --pure -E 'import <nixpkgs> {}' -A hello $ nix-shell --pure -E 'import <nixpkgs> {}' -A hello
Ligne 329: Ligne 355:
 path is '/nix/store/2l5az5rvkkavrr7zgghgqpmsqj3vn1yp-742781c358d65c8849a6a6f5b8f4bb3dcefc203a.tar.gz' path is '/nix/store/2l5az5rvkkavrr7zgghgqpmsqj3vn1yp-742781c358d65c8849a6a6f5b8f4bb3dcefc203a.tar.gz'
 02cgs6b1rmh8hmcwm5wpxxg32p3km9c05606pykv49qq1spd6p38 02cgs6b1rmh8hmcwm5wpxxg32p3km9c05606pykv49qq1spd6p38
 +</xtermrtf>
 +
 +==== nix-instantiate ====
 +<xtermrtf>
 +$ nix-instantiate --eval -E '(import <nixpkgs> {}).vscode.version'
 +"1.43.0"
 +</xtermrtf>
 +
 +<xtermrtf>
 +$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
 +"20.09pre216928.991bbef6835"
 </xtermrtf> </xtermrtf>
  
Ligne 431: Ligne 468:
 Welcome to Nix version 2.3.3. Type :? for help. Welcome to Nix version 2.3.3. Type :? for help.
  
-nix-repl> builtins.currentSystem+nix-repl> builtins.currentSystem
 "x86_64-linux" "x86_64-linux"
 </xtermrtf> </xtermrtf>
  
 <xtermrtf> <xtermrtf>
-$ nix-repl> :l <nixpkgs>+nix repl 
 +nix-repl> :l <nixpkgs>
 nix-repl> simple = derivation { name = "simple"; builder = "${bash}/bin/bash"; args = [ ./simple_builder.sh ]; gcc = gcc; coreutils = coreutils; src = ./simple.c; system = builtins.currentSystem; } nix-repl> simple = derivation { name = "simple"; builder = "${bash}/bin/bash"; args = [ ./simple_builder.sh ]; gcc = gcc; coreutils = coreutils; src = ./simple.c; system = builtins.currentSystem; }
 nix-repl> :b simple nix-repl> :b simple
 this derivation produced the following outputs: out -> /nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple this derivation produced the following outputs: out -> /nix/store/ni66p4jfqksbmsl616llx3fbs1d232d4-simple
 +</xtermrtf>
 +
 +<xtermrtf>
 +nix-repl> (builtins.parseDrvName "NUnit.Console-3.0.1").name
 +"NUnit.Console"
 +</xtermrtf>
 +
 +=== nix edit ===
 +Permet d'éditer un build avant de l'installer ([|https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-edit.html|nix edit]]):
 +<xtermrtf>
 +$ EDITOR=vim nix edit -f "<nixpkgs>" samba --extra-experimental-features nix-command
 +</xtermrtf>
 +
 +On install ensuite le paquet:
 +<xtermrtf>
 +$ nix-env -i samba
 </xtermrtf> </xtermrtf>
  
Ligne 520: Ligne 574:
 </xtermrtf> </xtermrtf>
  
-==== Chemains (path) ====+==== Chemins (path) ====
 <xtermrtf> <xtermrtf>
 $ nix eval '(some/path)'  $ nix eval '(some/path)' 
Ligne 624: Ligne 678:
 ==== Override ==== ==== Override ====
 <xtermrtf> <xtermrtf>
-$ nix-repl+$ nix repl
 nix-repl> :l <nixpkgs> nix-repl> :l <nixpkgs>
 Added 4360 variables. Added 4360 variables.
tuto/nix.1584184092.txt.gz · Dernière modification : 2020/03/14 11:08 de root