!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

712 Members
Rust163 Servers

Load older messages


SenderMessageTime
19 Oct 2022
@aktaboot:tchncs.deaktabootit's even in the official docs though18:06:44
@charles:computer.surgeryCharles ⚡️why is any of my code working18:07:43
@charles:computer.surgeryCharles ⚡️you should paste your flake18:08:57
@aktaboot:tchncs.deaktaboot https://0x0.st/owU2.nix 18:10:11
@aktaboot:tchncs.deaktabootit's building now :D \o/18:11:18
@charles:computer.surgeryCharles ⚡️
--- flake.nix	2022-10-19 11:10:47.604364787 -0700
+++ fixed.nix	2022-10-19 11:11:14.429945027 -0700
@@ -25,15 +25,14 @@
             channel = "nightly";
             date = "2022-10-19";
             sha256 = "wqcIBI0cuNAj3g4Fpk83jajPpwlyV4EetYex1vInAFY=";
-          }).toolchain;
+          });


           pkgs = nixpkgs.legacyPackages.${system};
         in

         (pkgs.makeRustPlatform {
-          cargo = toolchain;
-          rustc = toolchain;
+          inherit (toolchain) cargo rustc;
         }).buildRustPackage {
           pname = "uad";
           version = "0.5.1";
18:11:36
@charles:computer.surgeryCharles ⚡️that's why it's making you do that18:11:48
@charles:computer.surgeryCharles ⚡️i would recommend not listening to the docs and do what i'm suggesting instead18:12:12
@charles:computer.surgeryCharles ⚡️reason being, you can easily reuse this to include clippy/rustfmt/rust-src in your devshell this way but not in your actual derivation18:12:38
@charles:computer.surgeryCharles ⚡️e.g. iiuc, using the method you're using, your real package will depend on clippy/rustfmt/etc for no reason18:13:10
@aktaboot:tchncs.deaktabootoh okay18:14:06
@aktaboot:tchncs.deaktabootI thought it woud be the other way around18:14:21
@charles:computer.surgeryCharles ⚡️ no, fenix.packages.${system}.${thing}.toolchain is a derivation that includes everything from ${thing} which is generally undesirable 18:14:55
@charles:computer.surgeryCharles ⚡️here's how to include devtools in your devshell using my methodology, plus a hack to always use nightly rustfmt because of all the "unstable" options: https://or.computer.surgery/charles/engage/-/blob/main/flake.nix#L42-4918:15:46
@aktaboot:tchncs.deaktabootoh okay, whereas using it in the Rust 'Platform' will only be used in the build Phase, correct ?18:16:26
@aktaboot:tchncs.deaktaboot* oh okay, whereas using it in the Rust 'Platform', it will only be used in the build Phase, correct ?18:16:54
@charles:computer.surgeryCharles ⚡️ yeah, your buildRustPackage only needs cargo and rustc to build your crates, it doesn't need clippy or rustfmt 18:17:25
@aktaboot:tchncs.deaktabootthanks, I'm pretty new still 😅 sorry for being an idiot :P18:17:44
@charles:computer.surgeryCharles ⚡️nah it's fine i also went through this18:17:54
@aktaboot:tchncs.deaktabootoh no :(18:18:46
@aktaboot:tchncs.deaktaboot collect2: fatal error: cannot find 'ld' 18:19:11
@charles:computer.surgeryCharles ⚡️bizarre18:19:55
@charles:computer.surgeryCharles ⚡️

one other change i would recommend as well:

--- flake.nix	2022-10-19 11:10:47.604364787 -0700
+++ fixed.nix	2022-10-19 11:19:38.387891737 -0700
@@ -39,6 +39,8 @@
           version = "0.5.1";

           src = uad;
+
+          cargoLock.lockFile = "${uad}/Cargo.lock";

 #          src = pkgs.fetchFromGitHub {
 #            owner = "0x192";
@@ -46,7 +48,6 @@
 #            rev = "0.5.1";
 #            sha256 = "0ByB/jRJze9B2o4S1nevy+uIvEpjMszAVB0pB6WWocU=";
 #          };
-  cargoSha256 = "D2PsUoL1v9RWV1GNGHVQWvrY8I/hNaGvSZSsQJSh08w=";

         };
     });

makes it less annoying to pull updates

18:20:23
@aktaboot:tchncs.deaktaboot
❯ nix build .#
error: No hash was found while vendoring the git dependency glutin-0.28.0. You can add
       a hash through the `outputHashes` argument of `importCargoLock`:

       outputHashes = {
         "glutin-0.28.0" = "<hash>";
       };

       If you use `buildRustPackage`, you can add this attribute to the `cargoLock`
       attribute set.
(use '--show-trace' to show detailed location information)
18:23:19
@charles:computer.surgeryCharles ⚡️one moment i'm just gonna send you a flake that works18:23:33
@aktaboot:tchncs.deaktabootnow it wants me to put all the outputHashes for some reason18:26:17
@aktaboot:tchncs.deaktaboot maybe because it's a pure build ? 18:26:44
@charles:computer.surgeryCharles ⚡️yes because it uses git dependencies18:26:58
@charles:computer.surgeryCharles ⚡️ and buildRustPackage does not use builtins.fetchGit but pkgs.fetchgit 18:27:12
@charles:computer.surgeryCharles ⚡️so you need to provide hashes18:27:15

Show newer messages


Back to Room ListRoom Version: 6