!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

128 Members
23 Servers

Load older messages


SenderMessageTime
1 Jul 2023
@magikarpz:matrix.orgmdarochaunfortunately, currently you have to write a separate update script for each package23:09:01
@magikarpz:matrix.orgmdarocha making a common one is on my todo list though 23:09:55
6 Jul 2023
@huantian:huantian.devhuantian It seems like it would be relatively easy to add to something like nix-update, all you'd have to do is run the passthru script after updating 00:51:46
10 Jul 2023
@achnazoor:matrix.orgachnazoor joined the room.09:07:56
19 Jul 2023
@nycode:mozilla.orgMarie left the room.22:18:57
24 Jul 2023
@nry_:matrix.orgnry_ joined the room.17:40:14
25 Jul 2023
@federicodschonborn:matrix.orgFederico Damián Schonborn changed their profile picture.01:57:04
27 Jul 2023
@ribosomerocker:matrix.orgribosomerocker joined the room.03:03:06
30 Jul 2023
@cwstra:matrix.orgCorin (CWStra) joined the room.20:09:42
@cwstra:matrix.orgCorin (CWStra)

I've been having trouble getting dotnet programs to run when they rely on DllImport attributes. Here's a simple github repo that demonstrates the problem:
https://github.com/cwstra/nixos-dll-example/tree/example

On my nixos machine, running nix-shell run "dotnet run" in there spits out:

"Error loading unmanaged library from path: <snip>/nixos-dll-example/bin/Debug/net7.0/runtimes/linux-x64/native/libassimp.so".

From the path, I take it that it's not trying to import a globally-installed library (though I did add it to the nix-shell just in case). Does anyone have insight as to if/how I could set up an environment where I could work on projects with these dependencies?

21:47:46
3 Aug 2023
@raphi:tapesoftware.netraphi
In reply to @cwstra:matrix.org

I've been having trouble getting dotnet programs to run when they rely on DllImport attributes. Here's a simple github repo that demonstrates the problem:
https://github.com/cwstra/nixos-dll-example/tree/example

On my nixos machine, running nix-shell run "dotnet run" in there spits out:

"Error loading unmanaged library from path: <snip>/nixos-dll-example/bin/Debug/net7.0/runtimes/linux-x64/native/libassimp.so".

From the path, I take it that it's not trying to import a globally-installed library (though I did add it to the nix-shell just in case). Does anyone have insight as to if/how I could set up an environment where I could work on projects with these dependencies?

$ ldd bin/Debug/net7.0/runtimes/linux-x64/native/libassimp.so
        linux-vdso.so.1 (0x00007ffe88bd4000)
        libz.so.1 => not found
        librt.so.1 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/librt.so.1 (0x00007fd439b52000)
        libstdc++.so.6 => not found
        libm.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libm.so.6 (0x00007fd439a72000)
        libgcc_s.so.1 => /nix/store/jd99cyc0251p0i5y69w8mqjcai8mcq7h-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x00007fd438bdf000)
        libc.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 (0x00007fd4389f9000)
        /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007fd439b59000)

The assimp native library depends on libz and libstdc++. Add this to the shellHook:

export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.libc pkgs.zlib ]}:$LD_LIBRARY_PATH
08:59:53
5 Aug 2023
@cwstra:matrix.orgCorin (CWStra)I thought I was missing a trick. Thanks for the help!21:11:02
13 Aug 2023
@10leej:matrix.orgnevoyu joined the room.01:25:16
@yarekt:matrix.orgYarek T joined the room.16:54:23
@yarekt:matrix.orgYarek THiya. I'm at a job where we use a lot of dotnet, happy to help with issues16:59:06
@yarekt:matrix.orgYarek T
In reply to @raphi:tapesoftware.net
$ ldd bin/Debug/net7.0/runtimes/linux-x64/native/libassimp.so
        linux-vdso.so.1 (0x00007ffe88bd4000)
        libz.so.1 => not found
        librt.so.1 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/librt.so.1 (0x00007fd439b52000)
        libstdc++.so.6 => not found
        libm.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libm.so.6 (0x00007fd439a72000)
        libgcc_s.so.1 => /nix/store/jd99cyc0251p0i5y69w8mqjcai8mcq7h-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x00007fd438bdf000)
        libc.so.6 => /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6 (0x00007fd4389f9000)
        /nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007fd439b59000)

The assimp native library depends on libz and libstdc++. Add this to the shellHook:

export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.libc pkgs.zlib ]}:$LD_LIBRARY_PATH
Sweet, this actually fixes my issue with missing sqlite lib. something custom that we have to ship. Nice co-incidence, I was dreading having to deal with this on monday. Thanks!
20:19:25
@yarekt:matrix.orgYarek T Just out of curiosity, is it possible to convert this addition to be system wide? using environment.sessionVariables sort of doesn't look right 20:21:56
@yarekt:matrix.orgYarek T * Just out of curiosity, is it possible to convert this addition to be system wide? using environment.sessionVariables sort of doesn't look right. I have to compile and run a bunch of different dotnet projects, this lib is needed a lot. Wouldn't mind having it available system wide 20:25:32
@yarekt:matrix.orgYarek T * Just out of curiosity, is it possible to convert this addition to be system wide? using environment.sessionVariables sort of doesn't look right. I have to compile and run a bunch of different dotnet projects, this lib is needed a lot. Wouldn't mind having it available system wide, or I'll basically be stuck in a nix-shell all the time 20:25:50
14 Aug 2023
@emma:rory.gayEmma [it/its] joined the room.03:24:41
@emma:rory.gayEmma [it/its] Microsoft.NETCore.App.Runtime.Mono.browser-wasm seems to be missing from dotnet-sdk_7's packages, this is required to build a blazor wasm app, any solutions? 03:32:53
@emma:rory.gayEmma [it/its]

build fails as such:

MatrixRoomUtils.Web-v1> unpacking sources
MatrixRoomUtils.Web-v1> unpacking source archive /nix/store/ghrc75bpl7lkzjfyg7y5mw04i5bw7kvm-h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source
MatrixRoomUtils.Web-v1> source root is h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source
MatrixRoomUtils.Web-v1> patching sources
MatrixRoomUtils.Web-v1> updateAutotoolsGnuConfigScriptsPhase
MatrixRoomUtils.Web-v1> configuring
MatrixRoomUtils.Web-v1> Executing dotnetConfigureHook
MatrixRoomUtils.Web-v1> Cannot find a manifest file.
MatrixRoomUtils.Web-v1> For a list of locations searched, specify the "-d" option before the tool name.
MatrixRoomUtils.Web-v1> No tools were restored.
MatrixRoomUtils.Web-v1>   Determining projects to restore...
MatrixRoomUtils.Web-v1> /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.Mono.browser-wasm. No packages exist with this id in source(s): nugetSource
MatrixRoomUtils.Web-v1>   Failed to restore /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj (in 1.12 sec).
MatrixRoomUtils.Web-v1>   Restored /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/LibMatrix/LibMatrix/LibMatrix.csproj (in 538 ms).
error: builder for '/nix/store/mmjdifnfgrc3f4ragf8pql2fxsc73m1a-MatrixRoomUtils.Web-v1-1.drv' failed with exit code 1;
03:33:58
@emma:rory.gayEmma [it/its] *

build fails as such:

...
MatrixRoomUtils.Web-v1>   Determining projects to restore...
MatrixRoomUtils.Web-v1> /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.Mono.browser-wasm. No packages exist with this id in source(s): nugetSource
MatrixRoomUtils.Web-v1>   Failed to restore /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj (in 1.12 sec).
MatrixRoomUtils.Web-v1>   Restored /build/h6sn3kw7ld0rilnv6gf49qs01zsnhg34-source/LibMatrix/LibMatrix/LibMatrix.csproj (in 538 ms).
error: builder for '/nix/store/mmjdifnfgrc3f4ragf8pql2fxsc73m1a-MatrixRoomUtils.Web-v1-1.drv' failed with exit code 1;
03:34:30
@rover:aguiarvieira.ptRover joined the room.03:38:42
@raphi:tapesoftware.netraphi
In reply to @yarekt:matrix.org
Just out of curiosity, is it possible to convert this addition to be system wide? using environment.sessionVariables sort of doesn't look right. I have to compile and run a bunch of different dotnet projects, this lib is needed a lot. Wouldn't mind having it available system wide, or I'll basically be stuck in a nix-shell all the time
don't, i strongly advise you to use this in shellHooks only
if you use that globally it will affect everything (and can possibly break anything). also other people won't be able to just run nix-shell and get a working development environment, since they won't have your global variable
which goes against the reproducibility goals of nix
07:12:43
@emma:rory.gayEmma [it/its]whats the best way to make a deps.nix? nuget-to-nix usually works but misses dependencies for awsm07:19:49
@emma:rory.gayEmma [it/its]* whats the best way to make a deps.nix? nuget-to-nix usually works but misses dependencies for wasm07:20:05
@magikarpz:matrix.orgmdarochanuget-to-nix is mostly an internal tool used by the fetch-deps script07:41:35
@magikarpz:matrix.orgmdarochafollow the docs to get a buildDotnetModule derivation working, and then run the fetch-deps script from the derivation attributes, as shown in the docs07:42:51
@emma:rory.gayEmma [it/its]well i did follow the docs but i needed nuget-to-nix to generate the deps.nix07:45:24

Show newer messages


Back to Room ListRoom Version: 9