Flakes/fr: Difference between revisions

CORAAL (talk | contribs)
Created page with "* Un [https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html#description flocon] fait référence à une arborescence de système de fichiers dont le répertoire racine contient la spécification de fichier Nix appelée <code>flake.nix</code>."
Tags: Mobile edit Mobile web edit
CORAAL (talk | contribs)
Created page with "====AVERTISSEMENT Chiffrement===="
 
(30 intermediate revisions by the same user not shown)
Line 9: Line 9:
<code>flake.nix</code>.
<code>flake.nix</code>.


<div lang="en" dir="ltr" class="mw-content-ltr">
* Le contenu d'un fichier <code>flake.nix</code> suit un schéma de dénomination uniforme pour déclarer les paquets et leurs dépendances dans le langage Nix
* The contents of <code>flake.nix</code> file follow a uniform naming schema for declaring packages and their dependencies in the Nix language.
 
</div>
* Les flocons introduisent une [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references syntaxe de type URL] pour spécifier des sources distantes.


<div lang="en" dir="ltr" class="mw-content-ltr">
* Pour simplifier la syntaxe des URL longues avec des noms plus courts, [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry.html les flocons utilisent des registres] d'identifiants symbolique.  
* Flakes introduce a [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references URL-like syntax] for specifying remote sources.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Pour simplifier la syntaxe des URL longues avec des noms plus courts, [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry.html flakes utilise un registre] d'identifiants symboliques.
* To simplify the long URL syntax with shorter names, [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry.html flakes uses a registry] of symbolic identifiers.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Les flocons permettent également de verrouiller des références et des versions, qui peuvent ensuite être interrogées et mises à jour de manière programmatique.
* Flakes also allow for locking references and versions that can then be queried and updated programmatically.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* Une [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix.html interface de ligne de commandes expérimentale] accepte les références flocon pour les expressions qui créent, exécutent et déploient des packages.
* An [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix.html experimental command-line interface] accepts flake references for expressions that build, run, and deploy packages.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Enable_flakes_temporarily"></span>
====Enable flakes temporarily====
====Activer temporairement les flocons====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Lorsque vous utilisez une commande <code>nix</code>, ajoutez les commandes suivantes:
When using any <code>nix</code> command, add the following command-line options:
</div>
<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
  --experimental-features 'nix-command flakes'
  --experimental-features 'nix-command flakes'
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Enable_flakes_permanently_in_NixOS"></span>
====Enable flakes permanently in NixOS====
====Activer les flocons de manière permanente dans NixOS====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Ajoutez ce qui suit à la [[Overview_of_the_NixOS_Linux_distribution#Declarative_Configuration system configuration |configuration NixOS]]:
Add the following to the [[Overview_of_the_NixOS_Linux_distribution#Declarative_Configuration system configuration |NixOS configuration]]:
</div>


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 52: Line 38:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Other_Distros,_with_Home-Manager"></span>
=====Other Distros, with Home-Manager=====
=====Autres Distributions, avec Home-Manager=====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Ajouter ce qui suis à votre configuration home-manager:
Add the following to your home-manager config:
</div>


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 64: Line 47:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Other_Distros,_without_Home-Manager"></span>
=====Other Distros, without Home-Manager=====
=====Autres Distributions, sans Home-Manager=====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 72: Line 54:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Ajoutez ce qui suit à <code>~/.config/nix/nix.conf</code> ou <code>/etc/nix/nix.conf</code>:
Add the following to <code>~/.config/nix/nix.conf</code> or <code>/etc/nix/nix.conf</code>:
</div>


<syntaxHighlight lang=text>
<syntaxHighlight lang=text>
Line 80: Line 60:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Basic_Usage_of_Flake"></span>
===Basic Usage of Flake===
===Utilisation de base des Flocons===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Avant d'exécuter des commandes nix à ce stade, prenez note des deux avertissements ci-dessous: l'un pour le chiffrement et l'autre pour git.
Before running any nix commands at this point, please note the two warnings below: one for encryption and the other for git.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Encryption_WARNING"></span>
====Encryption WARNING====
====AVERTISSEMENT Chiffrement====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 96: Line 72:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Git_WARNING"></span>
====Git WARNING====
====AVERTISSEMENT Git====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Pour les flocons dans un dépôt git, seuls les fichiers dans l'arbre de travail seront copiés dans le store.
For flakes in git repos, only files in the working tree will be copied to the store.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 112: Line 85:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Generate_flake.nix_file"></span>
====Generate flake.nix file====
====Générer un fichier flake.nix====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 124: Line 96:
</syntaxHighlight>
</syntaxHighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Flake_schema"></span>
== Flake schema ==
== Schéma d'un Flocon ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Un fichier flake.nix est un fichier Nix mais avec des restrictions spéciales (nous en reparlerons plus tard)
The flake.nix file is a Nix file but that has special restrictions (more on that later).
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Il possède 4 attributs de premier niveau :
It has 4 top-level attributes:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>description</code> est une chaine de caractères décrivant le flocon.
* <code>description</code> is a string describing the flake.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>inputs</code> est un attribut définissant toutes les dépendances du flocon. Le schéma est décrit ci-dessous.
* <code>inputs</code> is an attribute set of all the dependencies of the flake. The schema is described below.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* <code>outputs</code> est une fonction d'un argument qui prend un ensemble d'attributs de toutes les entrées réalisées et génère un autre ensemble d'attributs dont le schéma est décrit ci-dessous.
* <code>outputs</code> is a function of one argument that takes an attribute set of all the realized inputs, and outputs another attribute set whose schema is described below.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 152: Line 113:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Input_schema"></span>
=== Input schema ===
=== Schéma d'entrée ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-inputs Le manuel d'entrée de flocon nix].
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-inputs The nix flake inputs manual].
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references Le manuel de références de flocon nix].
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references The nix flake references manual].
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
L'attribut d'entrée (inputs) définit les dépendances du flocon. Par exemple, nixpkgs doit être défini comme une dépendance pour un flocon système afin que le système se construise correctement.
The inputs attribute defines the dependencies of the flake. For example, nixpkgs has to be defined as a dependency for a system flake in order for the system to build properly.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Nixpkgs peut être défini en utilisant le code suivant:
Nixpkgs can be defined using the following code:
</div>


<code>inputs.nixpkgs.url = "github:NixOS/nixpkgs/<branch name>";</code>
<code>inputs.nixpkgs.url = "github:NixOS/nixpkgs/<branch name>";</code>