| 19 Oct 2022 |
aktaboot | it's even in the official docs though | 18:06:44 |
Charles ⚡️ | why is any of my code working | 18:07:43 |
Charles ⚡️ | you should paste your flake | 18:08:57 |
aktaboot | https://0x0.st/owU2.nix | 18:10:11 |
aktaboot | it's building now :D \o/ | 18:11:18 |
Charles ⚡️ | --- 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 ⚡️ | that's why it's making you do that | 18:11:48 |
Charles ⚡️ | i would recommend not listening to the docs and do what i'm suggesting instead | 18:12:12 |
Charles ⚡️ | reason being, you can easily reuse this to include clippy/rustfmt/rust-src in your devshell this way but not in your actual derivation | 18:12:38 |
Charles ⚡️ | e.g. iiuc, using the method you're using, your real package will depend on clippy/rustfmt/etc for no reason | 18:13:10 |
aktaboot | oh okay | 18:14:06 |
aktaboot | I thought it woud be the other way around | 18:14:21 |
Charles ⚡️ | no, fenix.packages.${system}.${thing}.toolchain is a derivation that includes everything from ${thing} which is generally undesirable | 18:14:55 |
Charles ⚡️ | 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-49 | 18:15:46 |
aktaboot | oh okay, whereas using it in the Rust 'Platform' will only be used in the build Phase, correct ? | 18:16:26 |
aktaboot | * oh okay, whereas using it in the Rust 'Platform', it will only be used in the build Phase, correct ? | 18:16:54 |
Charles ⚡️ | yeah, your buildRustPackage only needs cargo and rustc to build your crates, it doesn't need clippy or rustfmt | 18:17:25 |
aktaboot | thanks, I'm pretty new still 😅 sorry for being an idiot :P | 18:17:44 |
Charles ⚡️ | nah it's fine i also went through this | 18:17:54 |
aktaboot | oh no :( | 18:18:46 |
aktaboot | collect2: fatal error: cannot find 'ld' | 18:19:11 |
Charles ⚡️ | bizarre | 18:19:55 |
Charles ⚡️ | 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 | ❯ 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 ⚡️ | one moment i'm just gonna send you a flake that works | 18:23:33 |
aktaboot | now it wants me to put all the outputHashes for some reason | 18:26:17 |
aktaboot | maybe because it's a pure build ? | 18:26:44 |
Charles ⚡️ | yes because it uses git dependencies | 18:26:58 |
Charles ⚡️ | and buildRustPackage does not use builtins.fetchGit but pkgs.fetchgit | 18:27:12 |
Charles ⚡️ | so you need to provide hashes | 18:27:15 |