ZB3QX7JVLOPCSRUXCXHQMSRRUFUIRK5WNBOIXWQ5POT5DYRJLISQC
# Ajouter un nouveau paquet
https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
- Formatteur officiel (en cours d'adoption le 28 mars 2024, https://discourse.nixos.org/t/call-for-testing-nix-formatter/39179/5)
```sh
nix profile install nixpkgs#nixfmt-rfc-style
nixfmt package.nix
```
Les nouveaux paquets sont dans pkg/by-name
Tester dans nixpkgs qu'il compile
```
nix-build -A mypackage
```
Tester les dépendances
```
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
```
Regarder les variables d\'environement :
```
env
```
# Débugger un paquet
``` {.bash org-language="sh"}
cd nixpkgs
mkdir lol
cd lol
nix-shell ../ -A kent
```
Le plus simple est d\'utiliser genericBuild avec les différentes phases,
exemple :
``` {.bash org-language="sh"}
phases="checkPhase installPhase" genericBuild
```
Liste des phases : unpackPhase patchPhase configurePhase buildPhase
checkPhase installPhase fixupPhase installCheckPhase distPhase
Voir : <https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages>
# Astuces
## Problèes de driver
Utiliser nixGL https://github.com/nix-community/nixGL si l'on n'utilise pas nixos.
On essaie de mettre gtest dans buildInput
On essaie de mettre gtest dans buildInput: Ok.
Problème d'installation
```sh
Running phase: installPhase
mkdir: cannot create directory '/nix/store/q5livgwj4gcd6mgc5firyak9a86nrvqk-DRAGMAP-1.3.0/bin': No such file or directory
cp: cannot create regular file '/nix/store/q5livgwj4gcd6mgc5firyak9a86nrvqk-DRAGMAP-1.3.0/bin/': No such file or directory
```
Lors de la soumission du PR, `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"` échoue
```
98f0840b012d9975a687e5fc9fb179c57ee57/build.nix
[1/0/2 built, 48 copied (500.2/500.4 MiB), 86.3 MiB DL] building DRAGMAP-1.3.0 (buildPhase): making /build/source/builerror: builder for '/nix/store/r76fl0lbhhml92795igb9nxgbyv0yqcx-DRAGMAP-1.3.0.drv' failed with exit code 2;
last 10 log lines:
> from /nix/store/nn152mgpdfcw92b3b03g9kmnlpd9jris-gcc-13.2.0/include/c++/13.2.0/string:54,
> from include/boost/algorithm/string/std/string_traits.hpp:15,
> from include/boost/algorithm/string/std_containers_traits.hpp:19,
> from include/boost/algorithm/string.hpp:18,
> from /build/source/stubs/dragen/src/host/infra/linux/infra_linux_utils.cpp:23:
> /nix/store/ij144ma6vs8acil8r9hgr8xkb1dp9azg-glibc-2.39-5-dev/include/stdio.h:897:12: note: in a call to function 'int pclose(FILE*)' declared 'nonnull'
> 897 | extern int pclose (FILE *__stream) __nonnull ((1));
> | ^~~~~~
> cc1plus: all warnings being treated as errors
> make: *** [/build/source/make/dragen_stub_lib.mk:36: /build/source/build/release/stub_host/infra/linux/infra_linux_utils.o] Error 1
```
On soumet et on attend