!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

710 Members
Rust162 Servers

Load older messages


SenderMessageTime
20 Sep 2022
@gianarb:matrix.orgGianluca Arbezzano joined the room.14:22:46
@tengkuizdihar:matrix.orgIzdihar yep still the same error in nativeBuildInputs lmao Linux Hackerman 14:34:18
@linus:schreibt.jetztLinux Hackerman Izdihar: ah, I think you also need gsettings-desktop-schemas in buildInputs 14:36:40
@tengkuizdihar:matrix.orgIzdihar
In reply to @linus:schreibt.jetzt
Izdihar: ah, I think you also need gsettings-desktop-schemas in buildInputs
alright, its building time
14:37:17
@tengkuizdihar:matrix.orgIzdiharstill doesn't work lmaoo14:55:21
@tengkuizdihar:matrix.orgIzdiharI might need to follow this https://github.com/NixOS/nixpkgs/blob/95af2245a32f8e1310ad4e3bf50b76d86ddbbc0a/doc/languages-frameworks/gnome.section.md#frequently-encountered-issues-ssec-gnome-common-issues14:57:58
@gianarb:matrix.orgGianluca Arbezzano

Hello! I think I have a basic question. First time trying to package a Rust project

        alexandria = naersk'.buildPackage {
          src = builtins.fetchGit {
            url = ssh://git@github.com/.../...;
            ref = "HEAD";
            rev = "asdas";
          };
          patches = [
            ./001-remove-buildinfo.patch
          ];
          gitAllRefs = true;
        };

The build fails applying the patch with:

can't find file to patch at input line 14                                                                                       
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

I looked at the derivation logs via nix logs and I checked the source archive directory but the files in there looks totally different compared with the one I have as part of the repository. Not sure why and as consequence the patch fails because it can't find all the files it should have

15:31:09
@gianarb:matrix.orgGianluca Arbezzano *

Hello! I think I have a basic question. First time trying to package a Rust project

        rust-test = naersk'.buildPackage {
          src = builtins.fetchGit {
            url = ssh://git@github.com/.../...;
            ref = "HEAD";
            rev = "asdas";
          };
          patches = [
            ./001-remove-buildinfo.patch
          ];
          gitAllRefs = true;
        };

The build fails applying the patch with:

can't find file to patch at input line 14                                                                                       
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

I looked at the derivation logs via nix logs and I checked the source archive directory but the files in there looks totally different compared with the one I have as part of the repository. Not sure why and as consequence the patch fails because it can't find all the files it should have

15:31:17
21 Sep 2022
@tengkuizdihar:matrix.orgIzdihar It's working now! No more errors! The worst part about it is that I need to probably wait for the next version of the package to get some of the fixes that's included in my patch... https://github.com/NixOS/nixpkgs/issues/189571#issuecomment-1253102758 Linux Hackerman 02:36:05
@tengkuizdihar:matrix.orgIzdihar
In reply to @tengkuizdihar:matrix.org
It's working now! No more errors! The worst part about it is that I need to probably wait for the next version of the package to get some of the fixes that's included in my patch... https://github.com/NixOS/nixpkgs/issues/189571#issuecomment-1253102758 Linux Hackerman
or not, I guess now I just need to wait for a PR review
12:32:23
22 Sep 2022
@Ericson2314:matrix.orgJohn Ericson joined the room.15:36:50
@dpc:matrix.orgdpcHow do I configure a piece of code to run in my (crane-base) derivation?21:34:45
@dpc:matrix.orgdpcAPI docs mentiones Phases and hooks: https://github.com/ipetkov/crane/blob/master/docs/API.md#optional-attributes-1021:35:14
@dpc:matrix.orgdpc But I can't figure out what exactly am I supposed to set to get something to run? I just need to chmod +x some files that were copied into the derivation. 21:35:46
@ngerstle:matrix.org@ngerstle:matrix.org joined the room.22:00:17
23 Sep 2022
@tengkuizdihar:matrix.orgIzdihar
In reply to @dpc:matrix.org
But I can't figure out what exactly am I supposed to set to get something to run? I just need to chmod +x some files that were copied into the derivation.
what do you want to run in those phases? Like a custom bash command?
01:24:46
@tengkuizdihar:matrix.orgIzdiharIf so, then which phase you're choosing will depend entirely on what you want to do. This is the order of the phases is explained here preBuild01:28:08
@tengkuizdihar:matrix.orgIzdihar * If so, then which phase you're choosing will depend entirely on what you want to do. This is the order of the phases is explained here https://nixos.org/manual/nixpkgs/stable/#sec-stdenv-phases01:28:19
@nbp:mozilla.orgnbp changed their display name from nbp to nbp (PTO until Oct 1st).17:55:19
@nbp:mozilla.orgnbp changed their display name from nbp (PTO until Oct 1st) to nbp.17:55:48
25 Sep 2022
@andreasfelix:matrix.orgFelix Andreas joined the room.22:17:07
27 Sep 2022
@x10an14:matrix.orgx10an14

Anyone know of a cross-compilation example that targets musl and uses rust-overlay?

I can't for the life of me figure this out. I've spent the past couple of hours trying to search and read up on it, but I feel like there's some crucial tidbits of ignorance that keep me in the dark.
All the rust docs refer to leveraging rustup, which AFAIU is kinda antheisis to the premise of Nix.

I'm finding the learning curve a bit too steep for me =/

I've attempted:

  • rust-toolchain.toml; ```toml
    [toolchain]
    targets = ["x86_64-unknown-linux-musl", "x86_64-unknown-linux-gnu"]
    `flake.nix`: ```nix
      overlays = [
        (import rust-overlay)
        (self: super: {
          rustToolchain =
            let
              rust = super.rust-bin;
            in
            if builtins.pathExists ./rust-toolchain.toml then
              rust.fromRustupToolchainFile ./rust-toolchain.toml
            else if builtins.pathExists ./rust-toolchain then
              rust.fromRustupToolchainFile ./rust-toolchain
            else
              rust.stable.latest.default;
        })
      ]
    
    And finally; cargo build --target 'x86_64-unknown-linux-musl'
18:24:57
@x10an14:matrix.orgx10an14 *

Anyone know of a cross-compilation example that targets musl and uses rust-overlay?

I can't for the life of me figure this out. I've spent the past couple of hours trying to search and read up on it, but I feel like there's some crucial tidbits of ignorance that keep me in the dark.
All the rust docs refer to leveraging rustup, which AFAIU is kinda antheisis to the premise of Nix.

I'm finding the learning curve a bit too steep for me =/

I've attempted:

  • rust-toolchain.toml;

    [toolchain]
    targets = ["x86\_64-unknown-linux-musl", "x86\_64-unknown-linux-gnu"]
    
    

    flake.nix:

      overlays = [
        (import rust-overlay)
        (self: super: {
          rustToolchain =
            let
              rust = super.rust-bin;
            in
            if builtins.pathExists ./rust-toolchain.toml then
              rust.fromRustupToolchainFile ./rust-toolchain.toml
            else if builtins.pathExists ./rust-toolchain then
              rust.fromRustupToolchainFile ./rust-toolchain
            else
              rust.stable.latest.default;
        })
      ]
    

    And finally; cargo build --target 'x86_64-unknown-linux-musl'

18:27:11
@x10an14:matrix.orgx10an14

As mentioned in the https://matrix.to/#/#nix:nixos.org channel, the end result I'm looking for is a reduction of my docker image;

# flake.nix
      # The rust binary
      cargo-details = (pkgs.lib.importTOML ./Cargo.toml);
      binary-name = cargo-details.package.name;
      binary-version = cargo-details.package.version;
      cargo-package = pkgs.rustPlatform.buildRustPackage {
        pname = binary-name;
        version = binary-version;

        src = self;
        cargoLock.lockFile = ./Cargo.lock;

        nativeBuildInputs = rust-tools;
        buildInputs = rust-tools;
      };

      # Docker image
      # TODO: Reduce container size (cargo release -> ~5MB vs docker image -> ~35MB)
      # Seems like glibc is at fault? Statically compile? Musl?
      #  -> $ tree -L 3 unpacked_dockerimage/layer/
      #  unpacked_dockerimage/layer/
      #  └── nix
      #      └── store
      #          ├── 39pvnhy2l6zlqrgh6vv861v8lj6wnz0r-assign-item-to-project-field-0.1.0
      #          ├── 6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163
      #          ├── g7lwga9p547cqyi9ym35bk78m1r12rky-libunistring-1.0
      #          └── jna5qh81395w6xsalnl532pm9qvvvpjy-libidn2-2.3.2
      #
      #  6 directories, 0 files
      #  -> $ sudo du -hs unpacked_dockerimage/layer/nix/store/* | sort -h
      #  308K    unpacked_dockerimage/layer/nix/store/jna5qh81395w6xsalnl532pm9qvvvpjy-libidn2-2.3.2
      #  1,6M    unpacked_dockerimage/layer/nix/store/39pvnhy2l6zlqrgh6vv861v8lj6wnz0r-assign-item-to-project-field-0.1.0
      #  1,8M    unpacked_dockerimage/layer/nix/store/g7lwga9p547cqyi9ym35bk78m1r12rky-libunistring-1.0
      #  31M     unpacked_dockerimage/layer/nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163
      #
      docker-image = pkgs.dockerTools.buildImage {
        name = binary-name;
        tag = "v${binary-version}";
        config = {
          Cmd = ["${cargo-package}/bin/${binary-name}"];
        };
      }
18:28:34
@x10an14:matrix.orgx10an14 *

Anyone know of a cross-compilation example that targets musl and uses rust-overlay?

I can't for the life of me figure this out. I've spent the past couple of hours trying to search and read up on it, but I feel like there's some crucial tidbits of ignorance that keep me in the dark.
All the rust docs refer to leveraging rustup, which AFAIU is kinda antheisis to the premise of Nix.

I'm finding the learning curve a bit too steep for me =/

I've attempted:

  • rust-toolchain.toml;
[toolchain]
targets = ["x86\_64-unknown-linux-musl", "x86\_64-unknown-linux-gnu"]

flake.nix:

  overlays = [
    (import rust-overlay)
    (self: super: {
      rustToolchain =
        let
          rust = super.rust-bin;
        in
        if builtins.pathExists ./rust-toolchain.toml then
          rust.fromRustupToolchainFile ./rust-toolchain.toml
        else if builtins.pathExists ./rust-toolchain then
          rust.fromRustupToolchainFile ./rust-toolchain
        else
          rust.stable.latest.default;
    })
  ]

And finally; cargo build --target 'x86_64-unknown-linux-musl'

18:28:55
@x10an14:matrix.orgx10an14 *

Anyone know of a cross-compilation example that targets musl and uses rust-overlay?

I can't for the life of me figure this out. I've spent the past couple of hours trying to search and read up on it, but I feel like there's some crucial tidbits of ignorance that keep me in the dark.
All the rust docs refer to leveraging rustup, which AFAIU is kinda antheisis to the premise of Nix.

I'm finding the learning curve a bit too steep for me =/

I've attempted:

  • rust-toolchain.toml;
[toolchain]
targets = ["x86\_64-unknown-linux-musl", "x86\_64-unknown-linux-gnu"]

flake.nix:

  overlays = [
    (import rust-overlay)
    (self: super: {
      rustToolchain =
        let
          rust = super.rust-bin;
        in
        if builtins.pathExists ./rust-toolchain.toml then
          rust.fromRustupToolchainFile ./rust-toolchain.toml
        else if builtins.pathExists ./rust-toolchain then
          rust.fromRustupToolchainFile ./rust-toolchain
        else
          rust.stable.latest.default;
    })
  ]

And finally; cargo build --target 'x86_64-unknown-linux-musl'

18:30:00
@x10an14:matrix.orgx10an14 *

Anyone know of a cross-compilation example that targets musl and uses rust-overlay?

I can't for the life of me figure this out. I've spent the past couple of hours trying to search and read up on it, but I feel like there's some crucial tidbits of ignorance that keep me in the dark.
All the rust docs refer to leveraging rustup, which AFAIU is kinda antheisis to the premise of Nix.

I'm finding the learning curve a bit too steep for me =/

I've attempted:
rust-toolchain.toml;

[toolchain]
targets = ["x86\_64-unknown-linux-musl", "x86\_64-unknown-linux-gnu"]

flake.nix:

  overlays = [
    (import rust-overlay)
    (self: super: {
      rustToolchain =
        let
          rust = super.rust-bin;
        in
        if builtins.pathExists ./rust-toolchain.toml then
          rust.fromRustupToolchainFile ./rust-toolchain.toml
        else if builtins.pathExists ./rust-toolchain then
          rust.fromRustupToolchainFile ./rust-toolchain
        else
          rust.stable.latest.default;
    })
  ]

And finally; cargo build --target 'x86_64-unknown-linux-musl'

18:30:23
@zhaofeng:zhaofeng.liZhaofeng LiFor this, I'm currently using crane and it works fine: https://github.com/mars-research/miniond/blob/main/flake.nix18:36:32
@x10an14:matrix.orgx10an14

Zhaofeng Li: AFAICT this does not use rust-overlay?

I am for sure not able to parse your flake.nix. I looked into crane - and after reading what its README says, I can't tell how you add musl as a cross-compilation target?

18:46:53
@zhaofeng:zhaofeng.liZhaofeng Li It does use rust-overlay (see rust-bin) - I just imported it through another flake (mars-std). I added musl to the targets here: https://github.com/mars-research/miniond/blob/1cf92176880c1913eb1f89dcd514aeabb5d3f2cb/flake.nix#L27-L33 18:48:18

Show newer messages


Back to Room ListRoom Version: 6