!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

465 Members
Rust111 Servers

Load older messages


SenderMessageTime
19 Oct 2024
@steveej0:matrix.orgsteveej so run nix eval .. in rust and parse that? 20:21:20
@k900:0upti.meK900Yes 20:21:46
@steveej0:matrix.orgsteveejmhh i could also write the shared attrset in TOML and parse it from both20:22:03
@steveej0:matrix.orgsteveej thanks K900, helpful idea with the JSON 20:24:45
@tomasajt:matrix.orgToma 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
@lumbo7332:matrix.orgPope_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
@lumbo7332:matrix.orgPope_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
@9hp71n:matrix.orgghpzin
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
@9hp71n:matrix.orgghpzin 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
@lumbo7332:matrix.orgPope_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
@9hp71n:matrix.orgghpzin 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
@9hp71n:matrix.orgghpzin
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
@lumbo7332:matrix.orgPope_RigbyAhhh05:46:23
@lumbo7332:matrix.orgPope_RigbyOkay I'll patch that out and tell the maintainer05:47:33
@lumbo7332:matrix.orgPope_RigbyThanks 🙂05:47:35
@mpiechotka:matrix.orgmpiechotka

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
@emilazy:matrix.orgemily are you overlaying Nixpkgs' rustc? 07:48:48
@mpiechotka:matrix.orgmpiechotkaYes07:55:06
@emilazy:matrix.orgemilydon't :)07:55:11
@mpiechotka:matrix.orgmpiechotkaHow am I suppose to do it then?07:55:51
@emilazy:matrix.orgemily just use pkgs.rust-bin.fromRustupToolchainFile directly? 07:56:30
@emilazy:matrix.orgemilyor give it a unique attribute name for your own use07:56:34
@mpiechotka:matrix.orgmpiechotkaI think crate2nix uses pkgs.rustc. 07:57:34
@mpiechotka:matrix.orgmpiechotkaOr it needs to use some attribute which is somewhere...07:58:30
@mpiechotka:matrix.orgmpiechotka(I like Nix but documentation is not it's strong suite)07:58:46
@mpiechotka:matrix.orgmpiechotka

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
@emilazy:matrix.orgemily wouldn't be rust-overlay, would be the pkgs that you overlaid it into 08:01:25
@emilazy:matrix.orgemily not sure how to override the compiler with crate2nix, but I'd be shocked if there weren't a way 08:02:01
@esperlily:matrix.orgEsperLily [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:matrix.orgmpiechotkaHow do I rebuild a package from nixpkgs using rust-overlay?10:33:16

Show newer messages


Back to Room ListRoom Version: 6