This allows packages that require several dotnet versions to build (like
BeatSaberModManager) to properly depend on the dotnet-sdk specific deps.
This in turns avoids having to regenerate the deps of those packages
after each dotnet-sdk update.
This also changes nuget-to-nix to accept a file with a list of
exclusions instead of a folder.
Previously, you had to provide the path to the deps.nix of the package inside
your Nixpkgs checkout as an argument manually. Now it just does that by default
when no argument is passed.
Inside `nix-shell`, `TMPDIR` (used by `mktemp`) is set to
`/run/user/<uid>` which is usually a tmpfs stored in RAM.
When fetching a large dotnet deps tree to this tmpdir from a
nix-shell (e.g. via `btcpayserver/update.sh`), this can easily exceed
system RAM and `fetch-deps` fails.
mktemp arg `-t` is deprecated and can be omitted.
The source used to download a particular package still isn't
deterministic in nuget. Even worse, the hash of the package can vary
between sources. This makes nuget use the first enabled source
containing the package.
The order of the dependencies may be slightly different because it now
uses glob order of the lower-case package names and versions, instead of
sorting the output.
If the package actually downloaded was the first source that contains
the package, then it will be hashed from disk to avoid downloading it
again.
Previously we had an assert that would complain when nugetDeps wasnt set,
which also didnt allow any passthru attributes (like fetch-deps) to be
build. That causes a cycle where you need nugetDeps to fetch the nuget
deps, but arent able to build the script to do so.
For example, this script doesn't work for `xivlauncher` because its
proper `pname` is `XIVLauncher`, and `mktemp` complains about "too few
X's":
$ mktemp -td "XXXXXX-XIVLauncher-home"
mktemp: too few X's in template ‘XXXXXX-XIVLauncher-home’
vs
$ mktemp -td "XIVLauncher-home-XXXXXX"
/tmp/XIVLauncher-home-EdGMei
This makes buildDotnetModule restore nuget dependencies for the
platforms set in meta.platforms. This should help with generating
lockfiles for platforms other than the host machine.
Co-authored-by: mdarocha <git@mdarocha.pl>
cp on macOS doesn't support the -T flag, which causes the fetch-deps
script to fail. Use Nix's coreutils to ensure the script works
consistently across all platforms.
cp on macOS doesn't support the -T flag, which causes the fetch-deps
script to fail. Appending `/.` to the source argument replicates the
same functionality.
Some packages are defined by the build proccess, and change every time
the dotnet-sdk package changes. To avoid having to regenerate every
dependant packages dependencies every dotnet update, this moves these
packages into the `dotnet-sdk` `passthru` attribute, and includes them
every time `buildDotnetModule` is used.
The --self-contained and --no-self-contained switches were
added to the dotnet build command starting with .NET 6.
The switch is equivalent to the setting the SelfContained
property, so we use the property for backwards compatibility.
In some cases `$pkgs_src` can be a path. For example with `FSharp.Core` when it comes with dotnet SDK.
In these cases we need to fallback on default URL otherwise curl fails.
Sometimes I want to pass a different implementation of `mkNugetDeps`.
For example in private repos, it can be handy to use `__noChroot = true`
and bypass the deps.nix generation altogether. Or some Nuget packages
ship with ELF binaries that need to be patched, and that's best done as
soon as possible.
If the package was not restored from nuget.org (determinted by checking
the "source" field of ".nupkg.metadata"), query the custom source for
the package endpoint (the way nuget api is built we can't determine it
without an API query) and build a custom package URL to save in the
generated deps file.
Previously buildDotnetModule did not properly inherit some arguments from
derivations, take for example this expression:
dotnetFlags = [
"--runtime linux-x64"
];
It would error out as follows: "MSBUILD : error MSB1001: Unknown switch.".
Setting the same flag from bash would work fine. This fixes that, all
arguments should now be properly interpreted :)
There used to be a few issues with the way we generate the nuget source:
* The derivation generated for the deps would have "nuget-deps" in them twice:
/nix/store/...-foo-1.0-nuget-deps-nuget-deps
* We always tried to generate the dependencies for "projectReferences"
even when it wasn't set, causing a warning.
This fixes those issues :)
This improves the metadata generation, previously it would take any
"license" entry from the nuspec, and tried to match it to an spdx ID from
"lib.licenses".
Sometimes however licenses are provided in plain-text, which we
obviously cannot cleanly resolve. This resulted in in useless information
("LICENSE.txt") being written to "meta.license".
It is the package list output that should be sorted. The current
output sequence is not logical because '.' is sorted in front of '/'
with input sorting and is not deterministic for different language
environments.
To get a deterministic and logical sorting in environments with
different language configured, env "LC_ALL=C" is set and the produced
strings is that is sorted. To get alphabetic sorting and not a pure
ASCII value sort "--ignore-case" is added.
This reverts commit 0b1856bfe3.
This broke one of our clients projects where a local libary could no
longer be found. Since there is no easy way to disable it's better
if this flag is set per project using `dotnetRestoreFlags`.
Uses fsharp interactive (fsi) to run fsx script
Expose mkNugetSource and mkNugetDeps functions
Use them in writers.writeFSharp and buildDotnetModule
Add tests
This should speed up restore times a fair bit, especially for bigger
projects. Roslyn also has it enabled by default already, so I don't
expect any breakages from it.
This is a much more flexible way of doing things, as we can adopt and
reuse these hooks for various tasks. Syntax highlighting now also works
way better for me, which is a nice bonus :)