!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

710 Members
Rust162 Servers

Load older messages


SenderMessageTime
13 Jul 2022
@pennae:matrix.eno.spacepennaeah, that sounds like it's just the thing :)08:38:03
@pennae:matrix.eno.spacepennaewill give that a shot, tyvm08:38:28
@pennae:matrix.eno.spacepennaeyeah, this is much better than what we had before :)09:32:26
@qyliss:fairydust.spaceAlyssa Rossyay :)09:32:46
@pennae:matrix.eno.spacepennae(even if it's still mostly doing some setup and calling python 😅)09:32:56
14 Jul 2022
@grahamc:nixos.org@grahamc:nixos.org

I have a shell that comes from this use of Naersk. When I open a shell, it pre-builds all my dependencies. The naersk docs show just throwing rustc and cargo into a mkShell but that isn't sufficient for the case I show below. Is there a way to ask naersk to stop prebuilding and just use buildPackage for my shell?

naersk-lib.buildPackage {
          src = ./.;

          nativeBuildInputs = with pkgs; [
            clang
            cpiotools.defaultPackage.${system}
            grub2_efi
            jq
            nix
            pkgsStatic.pkg-config
            pkgsStatic.stdenv.cc
            qemu
            rustfmt
            which
            vim # xxd
          ];
          buildInputs = with pkgs; [ pkgsStatic.zstd cryptsetupStatic rustPlatform.bindgenHook ];

          OVMF_PATH = pkgs.OVMF.fd;

          # Configures the target which will be built.
          # ref: https://doc.rust-lang.org/cargo/reference/config.html#buildtarget
          CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";

          # Enables static compilation.
          #
          # If the resulting executable is still considered dynamically
          # linked by ldd but doesn't have anything actually linked to it,
          # don't worry. It's still statically linked. It just has static
          # position independent execution enabled.
          # ref: https://github.com/rust-lang/rust/issues/79624#issuecomment-737415388
          CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";

          # Configures the linker which will be used. cc.targetPrefix is
          # sometimes different than the targets used by rust. i.e.: the
          # mingw-w64 linker is "x86_64-w64-mingw32-gcc" whereas the rust
          # target is "x86_64-pc-windows-gnu".
          #
          # This is only necessary if rustc doesn't already know the correct linker to use.
          #
          # ref: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker
          CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = with pkgs.pkgsStatic.stdenv;
            "${cc}/bin/${cc.targetPrefix}gcc";
          # link against libc.a
          CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS = "-lc";

          doCheck = true;
        };
14:40:02
@jonringer:matrix.orgjonringer Not naersk, but I just rustPlatform.buildRustPackage + cargoLock.lockFile example 21:25:39
@jonringer:matrix.orgjonringer * Not naersk, but I just use rustPlatform.buildRustPackage + cargoLock.lockFile example 21:26:26
15 Jul 2022
@dpc:matrix.orgdpc
In reply to @grahamc:nixos.org

I have a shell that comes from this use of Naersk. When I open a shell, it pre-builds all my dependencies. The naersk docs show just throwing rustc and cargo into a mkShell but that isn't sufficient for the case I show below. Is there a way to ask naersk to stop prebuilding and just use buildPackage for my shell?

naersk-lib.buildPackage {
          src = ./.;

          nativeBuildInputs = with pkgs; [
            clang
            cpiotools.defaultPackage.${system}
            grub2_efi
            jq
            nix
            pkgsStatic.pkg-config
            pkgsStatic.stdenv.cc
            qemu
            rustfmt
            which
            vim # xxd
          ];
          buildInputs = with pkgs; [ pkgsStatic.zstd cryptsetupStatic rustPlatform.bindgenHook ];

          OVMF_PATH = pkgs.OVMF.fd;

          # Configures the target which will be built.
          # ref: https://doc.rust-lang.org/cargo/reference/config.html#buildtarget
          CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";

          # Enables static compilation.
          #
          # If the resulting executable is still considered dynamically
          # linked by ldd but doesn't have anything actually linked to it,
          # don't worry. It's still statically linked. It just has static
          # position independent execution enabled.
          # ref: https://github.com/rust-lang/rust/issues/79624#issuecomment-737415388
          CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";

          # Configures the linker which will be used. cc.targetPrefix is
          # sometimes different than the targets used by rust. i.e.: the
          # mingw-w64 linker is "x86_64-w64-mingw32-gcc" whereas the rust
          # target is "x86_64-pc-windows-gnu".
          #
          # This is only necessary if rustc doesn't already know the correct linker to use.
          #
          # ref: https://doc.rust-lang.org/cargo/reference/config.html#targettriplelinker
          CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = with pkgs.pkgsStatic.stdenv;
            "${cc}/bin/${cc.targetPrefix}gcc";
          # link against libc.a
          CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS = "-lc";

          doCheck = true;
        };
I don't understand what's 'isn't sufficient for the case I show below'
18:56:27
@grahamc:nixos.org@grahamc:nixos.orgI wanted to do this, but had trouble making it cross-compile to musl18:57:00
@dpc:matrix.orgdpcDo you want the binary that you're building with naersk in your shell ... ?18:59:16
@dpc:matrix.orgdpc I should finally try musl target with crane. I couldn't get it working with naersk as well, though I did not try really hard. 19:01:36
16 Jul 2022
@denommus:matrix.orgdenommusHow to have a checkPhase in cargo2nix?17:45:01
19 Jul 2022
@robin:icewind.nlIcewind joined the room.12:44:51
20 Jul 2022
@benfrank:matrix.orgBen Frank joined the room.20:58:51
23 Jul 2022
@didiercrunch:matrix.orgdidiercrunch joined the room.22:14:32
26 Jul 2022
@ctem:matrix.orgctem joined the room.11:32:40
@tinybronca:sibnsk.netunderpantsgnome! changed their display name from tinybronca to tailrec.14:48:56
@tinybronca:sibnsk.netunderpantsgnome! changed their display name from tailrec to tinybronca.15:38:18
28 Jul 2022
@tengkuizdihar:matrix.orgIzdihar joined the room.01:29:20
@tengkuizdihar:matrix.orgIzdiharhello, does anyone know how to use nixos+codelldb + rust?01:30:10
@tengkuizdihar:matrix.orgIzdihar * hello, does anyone know how to use nixos+codelldb+rust?01:30:13
29 Jul 2022
@dpc:matrix.orgdpcWhere's the problem?03:35:11
@tengkuizdihar:matrix.orgIzdihar
In reply to @dpc:matrix.org
Where's the problem?
my problem is about how to do it at all. I've followed non-nixos way to do it to no avail.
05:32:05
@kayla.fire:matrix.orgkayla (she/they)
In reply to@tengkuizdihar:matrix.org
my problem is about how to do it at all. I've followed non-nixos way to do it to no avail.

in what way is it not working? what have you done so far? Does it show up? is the extension installed in vscode already? is the extension erroring?

17:12:12
1 Aug 2022
@better_sleeping:converser.eubetter_sleeping joined the room.09:02:43
@better_sleeping:converser.eubetter_sleeping left the room.09:03:16
@jhillyerd:matrix.orgjhillyerd joined the room.22:38:09
3 Aug 2022
@qyliss:fairydust.spaceAlyssa Rosshey, it's been a while since I needed a beta/nightly Rust compiler. Is oxalica's Rust overlay still the thing to use?18:04:09
@a-kenji:matrix.orga-kenji
In reply to @qyliss:fairydust.space
hey, it's been a while since I needed a beta/nightly Rust compiler. Is oxalica's Rust overlay still the thing to use?
For me, yes.
18:04:36

Show newer messages


Back to Room ListRoom Version: 6