Rust: Difference between revisions

Remove the recommendation for the rust-lang.rust extension for VSCode, since it is deprecated and was replaced by the already recommended rust-lang.rust-analyzer
Using overrideAttrs with Rust Packages: slight tweak to presentation of overriding attributes: IFD/no IFD are now presented as bullet items.
Line 166: Line 166:


== Using overrideAttrs with Rust Packages ==
== Using overrideAttrs with Rust Packages ==
There are two ways to use <code>overrideAttrs</code> with Rust packages:
* Using [[Import From Derivation]]:
<p>
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
nil = pkgs.nil.overrideAttrs (
nil = pkgs.nil.overrideAttrs (
Line 184: Line 188:
     };
     };
     cargoHash = null;
     cargoHash = null;
  }
);
</syntaxhighlight>
</p>
* Overriding <code>cargoDeps</code>:
<p>
<syntaxhighlight lang="nix">
nil = pkgs.nil.overrideAttrs (
  finalAttrs: previousAttrs: {
    version = "unstable-2024-09-19";
                                                                         
    src = pkgs.fetchFromGitHub {
      owner = "oxalica";
      repo = "nil";
      rev = "c8e8ce72442a164d89d3fdeaae0bcc405f8c015a";
      hash = "sha256-mIuOP4I51eFLquRaxMKx67pHmhatZrcVPjfHL98v/M8=";
    };
                                                                            
                                                                            
     # Doesn't require IFD
     # Doesn't require IFD
     #cargoDeps = previousAttrs.cargoDeps.overrideAttrs {
     cargoDeps = previousAttrs.cargoDeps.overrideAttrs {
    #  name = "nil-vendor.tar.gz";
      name = "nil-vendor.tar.gz";
    #  inherit (finalAttrs) src;
      inherit (finalAttrs) src;
    #  #outputHash = pkgs.lib.fakeHash;
      #outputHash = pkgs.lib.fakeHash;
    #  outputHash = "sha256-RWgknkeGNfP2wH1X6nc+b10Qg1QX3UeewDdeWG0RIE8=";
      outputHash = "sha256-RWgknkeGNfP2wH1X6nc+b10Qg1QX3UeewDdeWG0RIE8=";
     #};
     #};
   }
   }
);
);
</syntaxhighlight>
</syntaxhighlight>
</p>


== Packaging Rust projects with nix ==
== Packaging Rust projects with nix ==