19 Oct 2024 |
steveej | mhh i could also write the shared attrset in TOML and parse it from both | 20:22:03 |
steveej | thanks K900, helpful idea with the JSON | 20:24:45 |
Toma | I did some polishing on https://github.com/NixOS/nixpkgs/pull/349360 and I'm looking for some feedback. Since buildCargoPackage assumes that cargoHash is for fetchCargoTarballs and cargoLock.lockfile is for importCargoLock , what would be a good way of telling buildCargoPackage to use the new fetcher the PR adds? I listed some possiblilities in the PR, e.g. specifying fetcher = "custom" . | 21:23:40 |
20 Oct 2024 |
Pope_Rigby | I'm trying to build this derivation, but I'm running into a compile error:
{
fetchFromGitHub,
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "illuminanced";
version = "unstable-2024-08-13";
src = fetchFromGitHub {
owner = "mikhail-m1";
repo = "illuminanced";
rev = "f61d87e0543174cc8e62347ac4326d145879fe1a";
hash = "sha256-0rG6Br/S7M28e1EGub8gSoEalfUm+3e9b4NyRjOZlt4=";
};
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
meta = {
description = "Ambient Light Sensor Daemon for Linux";
homepage = "https://github.com/mikhail-m1/illuminanced";
license = lib.licenses.gpl3Only;
mainProgram = "illuminanced";
};
}
Compiling illuminanced v0.1.0 (/build/source)
error[E0432]: unresolved import `simplelog::LogLevelFilter`
--> src/discrete_value.rs:35:45
|
35 | use simplelog::{Config as LoggerConfig, LogLevelFilter, TermLogger};
| ^^^^^^^^^^^^^^
| |
| no `LogLevelFilter` in the root
| help: a similar name exists in the module: `LevelFilter`
error[E0061]: this function takes 4 arguments but 2 arguments were supplied
--> src/discrete_value.rs:36:13
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default());
| ^^^^^^^^^^^^^^^^------------------------------------------------ two arguments of type `TerminalMode` and `ColorChoice` are missing
|
note: associated function defined here
--> /build/cargo-vendor-dir/simplelog-0.12.2/src/loggers/termlog.rs:66:12
|
66 | pub fn init(
| ^^^^
help: provide the arguments
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default(), /* TerminalMode */, /* ColorChoice */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0061, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `illuminanced` (bin "illuminanced" test) due to 2 previous errors
This is the Cargo.lock I've used: https://github.com/user-attachments/files/17439795/Cargo.lock.txt
| 03:49:16 |
Pope_Rigby | * I'm trying to build this derivation, but I'm running into a compile error:
{
fetchFromGitHub,
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "illuminanced";
version = "unstable-2024-08-13";
src = fetchFromGitHub {
owner = "mikhail-m1";
repo = "illuminanced";
rev = "f61d87e0543174cc8e62347ac4326d145879fe1a";
hash = "sha256-0rG6Br/S7M28e1EGub8gSoEalfUm+3e9b4NyRjOZlt4=";
};
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
meta = {
description = "Ambient Light Sensor Daemon for Linux";
homepage = "https://github.com/mikhail-m1/illuminanced";
license = lib.licenses.gpl3Only;
mainProgram = "illuminanced";
};
}
Compiling illuminanced v0.1.0 (/build/source)
error[E0432]: unresolved import `simplelog::LogLevelFilter`
--> src/discrete_value.rs:35:45
|
35 | use simplelog::{Config as LoggerConfig, LogLevelFilter, TermLogger};
| ^^^^^^^^^^^^^^
| |
| no `LogLevelFilter` in the root
| help: a similar name exists in the module: `LevelFilter`
error[E0061]: this function takes 4 arguments but 2 arguments were supplied
--> src/discrete_value.rs:36:13
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default());
| ^^^^^^^^^^^^^^^^------------------------------------------------ two arguments of type `TerminalMode` and `ColorChoice` are missing
|
note: associated function defined here
--> /build/cargo-vendor-dir/simplelog-0.12.2/src/loggers/termlog.rs:66:12
|
66 | pub fn init(
| ^^^^
help: provide the arguments
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default(), /* TerminalMode */, /* ColorChoice */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0061, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `illuminanced` (bin "illuminanced" test) due to 2 previous errors
This is the Cargo.lock I've used: https://github.com/user-attachments/files/17439795/Cargo.lock.txt
| 03:49:27 |
ghpzin | In reply to@lumbo7332:matrix.org
I'm trying to build this derivation, but I'm running into a compile error:
{
fetchFromGitHub,
lib,
rustPlatform,
}:
rustPlatform.buildRustPackage {
pname = "illuminanced";
version = "unstable-2024-08-13";
src = fetchFromGitHub {
owner = "mikhail-m1";
repo = "illuminanced";
rev = "f61d87e0543174cc8e62347ac4326d145879fe1a";
hash = "sha256-0rG6Br/S7M28e1EGub8gSoEalfUm+3e9b4NyRjOZlt4=";
};
cargoLock.lockFile = ./Cargo.lock;
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
meta = {
description = "Ambient Light Sensor Daemon for Linux";
homepage = "https://github.com/mikhail-m1/illuminanced";
license = lib.licenses.gpl3Only;
mainProgram = "illuminanced";
};
}
Compiling illuminanced v0.1.0 (/build/source)
error[E0432]: unresolved import `simplelog::LogLevelFilter`
--> src/discrete_value.rs:35:45
|
35 | use simplelog::{Config as LoggerConfig, LogLevelFilter, TermLogger};
| ^^^^^^^^^^^^^^
| |
| no `LogLevelFilter` in the root
| help: a similar name exists in the module: `LevelFilter`
error[E0061]: this function takes 4 arguments but 2 arguments were supplied
--> src/discrete_value.rs:36:13
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default());
| ^^^^^^^^^^^^^^^^------------------------------------------------ two arguments of type `TerminalMode` and `ColorChoice` are missing
|
note: associated function defined here
--> /build/cargo-vendor-dir/simplelog-0.12.2/src/loggers/termlog.rs:66:12
|
66 | pub fn init(
| ^^^^
help: provide the arguments
|
36 | let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default(), /* TerminalMode */, /* ColorChoice */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0061, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `illuminanced` (bin "illuminanced" test) due to 2 previous errors
This is the Cargo.lock I've used: https://github.com/user-attachments/files/17439795/Cargo.lock.txt
It is not a build error, it builds fine with both your .nix file and inside shell with cargo build
cargo test --profile release fails with both. Seems like they are using deprecated LogLevelFilter which was removed from simplelog around v0.4.0 | 05:41:27 |
ghpzin | It is not a build error, it builds fine with both your .nix file and inside shell with cargo build
cargo test --profile release fails with both. Seems like they are using deprecated LogLevelFilter which was removed from simplelog around v0.4.0 Or at least I can't find refs to LogLevelFilter in current version. | 05:42:27 |
Pope_Rigby | In reply to @9hp71n:matrix.org It is not a build error, it builds fine with both your .nix file and inside shell with cargo build
cargo test --profile release fails with both. Seems like they are using deprecated LogLevelFilter which was removed from simplelog around v0.4.0 Or at least I can't find refs to LogLevelFilter in current version. So it's only failing to do a check, but not build? How does that make sense? | 05:42:54 |
ghpzin | It is not a build error, it builds fine with both your .nix file and inside shell with cargo build
cargo test --profile release fails with both. Seems like they are using deprecated LogLevelFilter which was removed from simplelog around v0.4.0 Or at least I can't find refs to LogLevelFilter in current version other than this changelog: https://github.com/Drakulix/simplelog.rs/blob/c1954e14d9396257f62a402da375ed405f891cf4/CHANGELOG.md?plain=1#L110-L115 | 05:43:02 |
ghpzin | In reply to@lumbo7332:matrix.org So it's only failing to do a check, but not build? How does that make sense? Because part that fails is inside #[test] :
#[test]
fn discrete_value_change() {
use simplelog::{Config as LoggerConfig, LogLevelFilter, TermLogger};
let _ = TermLogger::init(LogLevelFilter::Debug, LoggerConfig::default());
https://github.com/mikhail-m1/illuminanced/blob/f61d87e0543174cc8e62347ac4326d145879fe1a/src/discrete_value.rs#L33-L36 | 05:46:05 |
Pope_Rigby | Ahhh | 05:46:23 |
Pope_Rigby | Okay I'll patch that out and tell the maintainer | 05:47:33 |
Pope_Rigby | Thanks 🙂 | 05:47:35 |
mpiechotka | I have problem with code that used to work with rust-overlay. super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml complains that there is recursion:
error: infinite recursion encountered
at /nix/store/la4l36mk91vd2z95lf3inr3s0bxwgy6s-source/lib/mk-aggregated.nix:24:5:
23| tier1TargetPlatforms = rustc.tier1TargetPlatforms or lib.platforms.all;
24| badTargetPlatforms = rustc.badTargetPlatforms or [ ];
| ^
25| };
| 07:47:02 |
emily | are you overlaying Nixpkgs' rustc ? | 07:48:48 |
mpiechotka | Yes | 07:55:06 |
emily | don't :) | 07:55:11 |
mpiechotka | How am I suppose to do it then? | 07:55:51 |
emily | just use pkgs.rust-bin.fromRustupToolchainFile directly? | 07:56:30 |
emily | or give it a unique attribute name for your own use | 07:56:34 |
mpiechotka | I think crate2nix uses pkgs.rustc. | 07:57:34 |
mpiechotka | Or it needs to use some attribute which is somewhere... | 07:58:30 |
mpiechotka | (I like Nix but documentation is not it's strong suite) | 07:58:46 |
mpiechotka | Also it doesn't work for whatever reason:
error: attribute 'rust-bin' missing
at /nix/store/nf5ii9mbs71v5jcaj5w55i921dfasi0p-source/flake.nix:58:16:
57| vanillapkgs.cargo-binutils
58| (rust-overlay.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
| ^
59| ];
| 08:00:25 |
emily | wouldn't be rust-overlay , would be the pkgs that you overlaid it into | 08:01:25 |
emily | not sure how to override the compiler with crate2nix , but I'd be shocked if there weren't a way | 08:02:01 |
EsperLily [she/her] | I just checked the generated code from crate2nix generate and the generated file takes a bunch of arguments, one of which is
, buildRustCrateForPkgs ? pkgs: pkgs.buildRustCrate
| 08:09:19 |
mpiechotka | How do I rebuild a package from nixpkgs using rust-overlay? | 10:33:16 |
mpiechotka | I'm trying to get rustPlatform equivalent | 10:33:34 |
mpiechotka | Ok. Found makeRustPlatform
| 10:41:04 |