DotNET: Difference between revisions

imported>WhiteBlackGoose
m Capitalized
imported>WhiteBlackGoose
Added a workaround for declarative global .net tool installations
Line 156: Line 156:
   '';
   '';
}
}
</syntaxHighlight>
== Global Tools ==
There is currently no mechanism to install them globally, and regular (mutable) installation [does not work](https://github.com/dotnet/sdk/issues/30546).
[Here](https://github.com/WhiteBlackGoose/dotfiles/blob/3f7d1b508f75ea87b8f36f3e2be0e2db1f4241c1/envs/dotnet-tool.nix) is a proof of concept of how .NET tools could be used declaratively.
Here's an example of using that package:
<syntaxHighlight lang=nix>
packages =                                                       
  let dotnetPkg =                                               
    (with dotnetCorePackages; combinePackages [                 
      sdk_7_0                                                   
      sdk_6_0                                                   
    ]);                                                         
    dotnetTools = (callPackage ./dotnet-tool.nix {});    # dotnet-tool.nix is the file from the link above
  in [                                                           
    vim                                                         
    firefox                                                     
    dotnetPkg                                                   
    dotnetTools.combineTools dotnetPkg (with dotnetTools.tools; [
                          #  ^^^^^^^^^ here we specify the dotnet package
                          # that will be invoked for this tool
                          # Ideally, something like dotnetPkg.withTools
                          # should be there
      fsautocomplete                                      # these are tools from dotnetTools.tools;       
      csharp-ls                                          # if a package is missing, it can be declared
      dotnet-repl                                        # manually, see the sources of dotnet-tools.nix
    ])                                                           
  ];                                                             
</syntaxHighlight>
</syntaxHighlight>