Open purkhusid opened 2 years ago
I'm curious if @forki thinks it's a lot of work to add a JSON format and if it would be accepted as a contribution.
this was brought up multiple times. It's not really that hard to do. But there needs to be an explicit switch for this. Also you need to implement the parser as well.
Big 👍 from me on this one, I know that having this would make efforts like @TheAngryByrd's attempted integration with Dependabot easier, for example.
@forki we could potentially do it in a staged fashion as well, where the lock file could be the output of a command (paket show lock file --json) while keeping the existing file as the source of truth. This might help to prove out the formatting/syntax, before committing to it as the full lock file format.
I know that having this would make efforts like @TheAngryByrd's attempted integration with Dependabot easier
It would also make the integration with Nix way easier too!
It would also make the integration with Nix way easier too!
Is there any existing Nix integration solution? I was just researching this and coming up short. Thinking the approach would be to parse the lock file and convert it to a derivation.
Is there any existing Nix integration solution?
Not that I'm aware of. Right now I use dotnet
through nix shell
or nix develop
and install fantomas as a dotnet tool. The main problem is not the lock file (although it's bad enough to parse it) it is the fake build script, because you have to package another dotnet tool (FAKE).
Having the paket.lock as a JSON would just be a nice thing to have because you could easily build tools as dependabot and package programs with Nix.
I spent last weekend looking into this further. It's a pretty challenging undertaking. The current Nix support for dotnet involves restoring packages and then using nuget-to-nix
to produce a derivation that fetches the packages from Nuget via fetchNuget
. This creates a derivation roughly equivalent to package.lock
. That's then used in a dotnet publish
process.
I attempted to get this workflow working with Paket. I first needed to override the passthru.fetchDeps
script to be amenable for Paket by including a dotnet tool install
and changing the dotnet restore
command. This would produce the derivation file. That should have then allowed the normal build to work. Unfortunately, the --no-build
argument for dotnet publish
isn't working properly for F# 2.
What
Add an option to Paket that changes to format of
paket.lock
to JSONWhy?
The exact use case for me is to parse the
paket.lock
file to generate Bazel targets for each NuGet package. If the lock file would be in JSON it makes it easier for other tools to parse the lock file since JSON is supported by all programming/scripting languages.Other use cases: