!ZUiNnfpRqQMDrPLChM:nixos.org

Nix ♥ la francophonie

154 Members
Salon francographe de NixOS54 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
22 Apr 2024
@ManUtopiK:matrix.orgManUtopiK

Salut à tous !
J'essaye de builder une application en rust. Première fois que je fais ça.
Dans mon home.nix j'utilise la dernière version de rust 1.77 en chargeant depuis unstable. Dans le terminal, cargo -V me donne bien 1.77.1
Mais quand je lance nix-build default.nix, le build plante car rustc est en version 1.74.
Comment spécifier la version de rust ?
Voici default.nix :

{ pkgs ? import <nixpkgs> {} }:

rustPlatform.buildRustPackage rec {
  pname = "gcli";
  version = "0.2.9";

  cargoLock.lockFile = ./Cargo.lock;
  src = pkgs.lib.cleanSource ./.;
  cargoLock.outputHashes = {
    "ark-secret-scalar-0.0.2" = "sha256-91sODxaj0psMw0WqigMCGO5a7+NenAsRj5ZmW6C7lvc=";
    "common-0.1.0" = "sha256-LHz2dK1p8GwyMimlR7AxHLz1tjTYolPwdjP7pxork1o=";
    "fflonk-0.1.0" = "sha256-+BvZ03AhYNP0D8Wq9EMsP+lSgPA6BBlnWkoxTffVLwo=";
    "simple-mermaid-0.1.0" = "sha256-IekTldxYq+uoXwGvbpkVTXv2xrcZ0TQfyyE2i2zH+6w=";
    "sp-application-crypto-23.0.0" = "sha256-Ju+VoWSw/KLF1dnTbgxw+ezwTUQV+tUTYuehD7G8M+k=";
    "sp-ark-bls12-381-0.4.2" = "sha256-nNr0amKhSvvI9BlsoP+8v6Xppx/s7zkf0l9Lm3DW8w8=";
    "sp-crypto-ec-utils-0.10.0" = "sha256-OVoNzvupbqpQSEz1bYcrhkGxfyKoUsQ6/w+kQgFlk/o=";
    "subxt-0.34.0" = "sha256-i6yIRBllVedBIh57x1Ye6gDtQ08VlV08uwwnd1bjgzI=";
  };
}
19:12:03
@symphorien:xlumurb.eusymphoriença depend de la version de <nixpkgs>19:24:14
@symphorien:xlumurb.eusymphorienet le fait que ça ignore la version "ambiante" de rustc (celle de home.nix) est fait exprès19:25:01
@symphorien:xlumurb.eusymphorienje suppose qu'il faut que tu utilises unstable dans ce fichier aussi19:27:19
@ManUtopiK:matrix.orgManUtopiK Ok, merci ! Pour connaitre ma version de nixpkgs, c'est nix-channel --list ? Ça me retourne :
nixpkgs https://nixos.org/channels/nixpkgs-unstable
Comment je peux utiliser unstable dans default.nix ? En fait, idéalement, il me faudrait la version 1.75 de rustc pour builder.
19:29:49
@symphorien:xlumurb.eusymphoriennix-info te dira19:30:10
@symphorien:xlumurb.eusymphorienaussi pense bien que root et ton utilisateur peuvent avoir des channels différents19:30:59
@ManUtopiK:matrix.orgManUtopiK nix-info retourne :
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.18.1, channels(manu): "nixpkgs", channels(root): "nixos-23.11, nixos-hardware, nixos-unstable, nixpkgs, unstable", nixpkgs: /home/manu/.nix-defexpr/channels/nixpkgs
19:31:29
@symphorien:xlumurb.eusymphorienje te déconseille d'avoir le même nom de channel pour ton utilisateur et root, ça.prête à confusion19:32:44
@symphorien:xlumurb.eusymphorienmais sinon remplace <nixpkgs> par <nixos-unstable> et ça devrait marcher19:34:34
@ManUtopiK:matrix.orgManUtopiKAh ok, tout simplement ! Ça build :)19:36:39
@ManUtopiK:matrix.orgManUtopiKBon, le build plante, mais ça vient du code que je compile. J'ai pas finit de galérer... Merci en tout cas !19:39:30
@ManUtopiK:matrix.orgManUtopiK
In reply to @symphorien:xlumurb.eu
je te déconseille d'avoir le même nom de channel pour ton utilisateur et root, ça.prête à confusion
Comment je peux changer ça ?
19:40:27
@symphorien:xlumurb.eusymphorienavec nix-channel --delete19:41:10
@symphorien:xlumurb.eusymphorienet à la fin --update19:41:21
@ManUtopiK:matrix.orgManUtopiK Il y a pas --delete, j'ai fait nix-channel --remove nixpkgs.
nix-channel --list ne retourne plus rien. Mais nix-info retourne exactement la même chose.
C'est mieux comme ça ?
19:50:10
@symphorien:xlumurb.eusymphoriensans --update ça n'a pas d'effet20:02:11
@ManUtopiK:matrix.orgManUtopiK Oui, j'ai fait nix-channel --update aussi. En fait, je ne vois pas bien le problème. Avec nix-info, tu veux que channels(manu): "nixpkgs" soit différent car nixpkgs est aussi dans channels(root) ? 20:08:10
@ManUtopiK:matrix.orgManUtopiK Tu sais comment obtenir le hash d'un packet rust ? Dans default.nix, il y a "simple-mermaid-0.1.0" = "sha256-IekTldxYq+uoXwGvbpkVTXv2xrcZ0TQfyyE2i2zH+6w=" qui faut que je passe en version 0.1.1. J'ai télécharger l'archive tar.gz et je fait nix-hash --type sha256 --base32 simple-mermaid-0.1.1.tar.gz, mais il me sort pas un hash qui ressemble à ce qu'il faut... 20:11:13
@ManUtopiK:matrix.orgManUtopiK Avec nix-prefetch-url ou nix-prefetch-url --unpack c'est pas mieux 20:14:08
@Minijackson:matrix.orgMinijackson en général, ce qu'on fait, c'est qu'on met une string vide "", et Nix nous dit à quel hash il s'attendait 20:18:23
@ManUtopiK:matrix.orgManUtopiK

Ah oui, ça serait plus simple ! Mais ça plante. Avec une string vide il retourne cette erreur :

❯ nix-build default.nix
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'gcli-0.2.9'
         whose name attribute is located at /nix/store/3r643hm4q1l4dj1yw0hlaya8gkbbn235-nixos-unstable/nixos-unstable/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'cargoDeps' of derivation 'gcli-0.2.9'

         at /nix/store/3r643hm4q1l4dj1yw0hlaya8gkbbn235-nixos-unstable/nixos-unstable/pkgs/build-support/rust/build-rust-package/default.nix:101:10:

          100| } // {
          101|   inherit buildAndTestSubdir cargoDeps;
             |          ^
          102|

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: A hash was specified for simple-mermaid-0.1.1, but there is no corresponding git dependency.
20:23:58
@ManUtopiK:matrix.orgManUtopiKAh c'est bon. J'ai réussi !20:26:02
@ManUtopiK:matrix.orgManUtopiKMerci !20:26:18
@ManUtopiK:matrix.orgManUtopiKAh non en fait 🤪 Ça marche pour "simple-mermaid-0.1.0" = ""; mais pas pour "simple-mermaid-0.1.1" = "";20:27:51
@Minijackson:matrix.orgMinijackson

there is no corresponding git dependency

20:32:11

Show newer messages


Back to Room ListRoom Version: 6