Is it possible to upgrade to .NET 8?

Similar to

how can I get .Net 8? (pkgs.dotnet-sdk_8 doesn’t work)

1 Like

As the requester for .NET 7 I immediately tried it for .NET 8. Unfortunately I could not make this work. And used the same package name as you.

Error I get is:

nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines

       … while evaluating attribute 'REPLIT_LD_LIBRARY_PATH' of derivation 'nix-shell'

         at «string»:309:9:

          308|       {
          309|         REPLIT_LD_LIBRARY_PATH = (pkgs.lib.optionalString (env ? REPLIT_LD_LIBRARY_PATH) (env.REPLIT_LD_LIBRARY_PATH + ":")) +
             |         ^
          310|         pkgs.lib.makeLibraryPath deps;

       error: attribute 'dotnet-runtime_8' missing

       at /home/runner/test/replit.nix:3:5:

            2|     deps = [
            3|     pkgs.dotnet-runtime_8
             |     ^
            4|           pkgs.jq.bin
       Did you mean one of dotnet-runtime_3, dotnet-runtime_5, dotnet-runtime_6, dotnet-runtime_7 or dotnet-runtime?

My replit.nix file is:

{ pkgs }: {
	deps = [
    pkgs.dotnet-runtime_8
		pkgs.jq.bin
    pkgs.dotnet-sdk_8
    pkgs.omnisharp-roslyn
	];
}

The cause is simple:
.NET 8 is not supported in the Nix packages that Replit has access to at the moment. Nix packages are managed in a repository that needs to be updated to include new software versions, and it seems .NET 8 has not been added yet, or your Replit environment does not have access to a repository where it is available.

So we need to wait until Replit adds it.

1 Like

I was unable to confirm this. It is possible to update the replit nix channel (repository ‘version’) to one that does have pkgs.dotnet-runtime_8. First, check your .replit file. Is there a channel variable underneath [nix] section? If there isn’t, add one like this:

[nix]
channel = "stable-23_11"

If there is, change the value to one of the suggested values in the dropdown that contains the package: "stable-23_5", "stable-23_11", "unstable", or copy the code snippet above. "stable-22_11" does not have the package.
Type kill 1 in Shell to refresh.
You can check which packages are in which channels here.

4 Likes

The nix channel entry is already set to "stable-23_11" by default. I see in the package browser that stable-23_11 does have entry for dotnet-sdk_8 and dotnet-runtime_8. However, editing replit.nix with either of these, kill 1 generates an error like:

nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines

       … while evaluating attribute 'REPLIT_LD_LIBRARY_PATH' of derivation 'nix-shell'

         at «string»:309:9:

          308|       {
          309|         REPLIT_LD_LIBRARY_PATH = (pkgs.lib.optionalString (env ? REPLIT_LD_LIBRARY_PATH) (env.REPLIT_LD_LIBRARY_PATH + ":")) +
             |         ^
          310|         pkgs.lib.makeLibraryPath deps;

       error: attribute 'dotnet-sdk_8' missing

       at /home/runner/GentleDisguisedStartup/replit.nix:4:5:

            3|               pkgs.jq.bin
            4|     pkgs.dotnet-sdk_8
             |     ^
            5|     pkgs.omnisharp-roslyn
       Did you mean one of dotnet-sdk_2, dotnet-sdk_3, dotnet-sdk_5, dotnet-sdk_6 or dotnet-sdk_7?

sh: 1: dotnet: not found

Does using the unstable branch produce a different result?

1 Like

Are you positively sure that the channel variable in .replit is set to "stable-23_11" or "stable-23_05" or "unstable", and not "stable-22_11"? I was able to get the dotnet-sdk_8 and dotnet-runtime_8 packages in a repl.

2 Likes

That fixed it. I did indeed have “stable-22_11” rather than “stable-23_11”.

A couple of things now:

  • The entry in NixOS Search for stable-23_11 dotnet-runtime_8 says it’s 8.0.1 but, in replit, dotnet --info says it’s 8.0.0-rc.2.23479.6.
  • Every run emits “An issue was encountered verifying workloads. For more information, run “dotnet workload update”.”. (The app still runs though.) However, dotnet workload update can’t be run in the replit environment (dotnet says “inadequate permissions” but you can’t use sudo in replit) and dotnet workload list is empty.

While I do not know the specifics of replit’s architecture, I know that some packages may differ from search.nixos.org such as python312, possibly replit keeps their own cache of the nix repository. I think replit keeps their own cache for many package repositories. You can try the "unstable" channel.

I do not know much at all about .NET, I just know stuff about replit configuration, but if you are able to find (or ask others for) a way to use/configure the framework locally (“user” or ‘not system’) (which is common for popular packages as the user might not own their machine), then that might work. (It may or may not be possible on replit.) Often, packages offer alternatives to using sudo.

If you are able to get it working, I’d recommend creating and publishing a template so that others and yourself may use it.

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.