Commit Graph

180 Commits

Author SHA1 Message Date
r-vdp
995ee2fa2c
nuget-to-nix: add meta.mainProgram 2024-10-09 12:33:27 +02:00
David McFarland
9bb309d5b5 buildDotnetModule: set --no-restore in check/publish/pack 2024-09-24 20:43:24 -03:00
David McFarland
00fe5f61ba buildDotnetModule: remove duplicate attribute key 2024-09-24 20:43:24 -03:00
David McFarland
2c97d67f62 dotnet: split sdk packages by platform 2024-09-24 20:43:24 -03:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
David McFarland
424bbc430e addNuGetDeps: fix fetch-deps output path handling 2024-09-17 01:14:28 -03:00
David McFarland
be577a25f4 fetchNupkg: conservatively set sourceProvenance 2024-09-17 01:14:27 -03:00
David McFarland
f5e9dd4201 addNuGetDeps: print name of package being fetched 2024-09-17 01:14:27 -03:00
David McFarland
0e5b1ff245 add-nuget-deps: use NUGET_HTTP_CACHE_PATH from user's HOME 2024-09-17 01:12:13 -03:00
David McFarland
a4189437a3 add-nuget-deps: set HOME outside of nix-shell 2024-09-17 01:12:13 -03:00
David McFarland
206693180f add-nuget-deps: expose fetch derivation as passthru.fetch-drv 2024-09-17 01:12:13 -03:00
David McFarland
4bb15106d5 add-nuget-deps: use cacert via nativeBuildInputs 2024-09-17 01:12:13 -03:00
David McFarland
e6bca73d01 nuget-to-nix: use xmlstarlet instead of xq (yq)
xq has such a long startup time that this significantly improves
performance.
2024-09-17 01:12:13 -03:00
David McFarland
c693cb8ec6 addNuGetDeps: move TMPDIR handling out of fetch-deps
We now handle creating TMPDIR and setting the working directory outide
of nix-shell.  This allows nix-shell to set NIX_BUILD_TOP correctly.
2024-09-17 01:12:13 -03:00
David McFarland
521b7b5e5f fetch-nupkg: use helper from nuget-package-hook to unpack 2024-09-17 01:12:12 -03:00
David McFarland
b1685747a7 nuget-package-hook: move package unpacking from buildDotnetModule 2024-09-17 01:12:11 -03:00
David McFarland
c1ee815d03 dotnet-fixup-hook: obey dontFixup 2024-09-17 01:12:11 -03:00
David McFarland
60d3a7d230 nuget-to-nix: set SSL_CERT_FILE
This is required for curl.
2024-09-17 01:12:11 -03:00
David McFarland
1d4d0d3db7 nuget-to-nix: use dotnet from PATH
The dotnet sdk used usually needs to match the one required by the
project (global.json). Having the dependcy in nix just meant it always
had to be overridden.
2024-09-17 01:12:11 -03:00
David McFarland
e05c0c4f98 dotnet-fixup-hook: remove confusing logs 2024-09-17 01:12:11 -03:00
David McFarland
773cc0de74 dotnet-sdk-setup-hook: move nuget configuration from dotnetBuildModule 2024-09-17 01:12:11 -03:00
David McFarland
60eb0db2ab dotnet-sdk-setup-hook: add trailing slashes to NUGET_PACKAGES vars 2024-09-17 01:12:11 -03:00
David McFarland
f820d2cf3c dotnetCorePackages: split fetch-deps logic into addNuGetDeps 2024-09-17 01:12:11 -03:00
Artturin
19bf002d43
treewide: fix editorconfig (#341423) 2024-09-13 21:49:38 +03:00
Artturin
a4e4fc5d35 dotnetenv.{buildSolution,buildWrapper}: follow editorconfig & follow common bash style
There seems to be duplication and also improvements to one between these, so someone
should rework these.

Add missing `pre` and `post` hook runs.
2024-09-13 18:17:41 +03:00
Sergei Trofimovich
35671aabff dotnet/build-dotnet-module: fix eval of fetch-deps
Without the change the eval fails as:

    $ nix build --no-link -f. csharp-ls.fetch-deps --show-trace
    error:
       … while evaluating a path segment
         at pkgs/build-support/dotnet/build-dotnet-module/default.nix:258:36:
          257|                   else
          258|                     ''$(mktemp -t "${finalAttrs.pname ? finalAttrs.finalPackage.name}-deps-XXXXXX.nix")'';
             |                                    ^
          259|                 nugetToNix = (nuget-to-nix.override { inherit dotnet-sdk; });

       error: cannot coerce a Boolean to a string: false

Switch from `?` operator (attribute presence predicate) to an `or`
("else" form).
2024-09-13 07:12:37 +01:00
Matt Sturgeon
c8a0f01473
dotnetCorePackages.fetchNupkg: override avalonia to include upstream fix
Backport https://github.com/AvaloniaUI/Avalonia/pull/16835 to versions
11.1.0 through 11.2.0-beta1

Co-authored-by: Nick Cao <nickcao@nichi.co>
2024-09-08 16:38:43 +01:00
David McFarland
e6c700ed11 dotnetCorePackages.fetchNupkg: override avalonia.x11 to find native libs 2024-09-06 16:32:08 -03:00
David McFarland
cc9c59c478 buildDotnetModule: use individual dependencies for nugetDeps 2024-09-06 16:05:19 -03:00
David McFarland
9a0be2fd28 dotnetCorePackages.fetchNupkg: override skiasharp to find fontconfig 2024-09-06 16:05:19 -03:00
David McFarland
1f6cd35f5e dotnetCorePackages.fetchNupkg: add override mechanism 2024-09-05 23:46:24 -03:00
David McFarland
32ccfdc278 dotnetCorePackages.fetchNupkg: run missing hooks 2024-09-05 23:46:24 -03:00
David McFarland
7ea78aaf5a dotnetCorePackages.fetchNupkg: split from mkNugetDeps 2024-09-05 23:46:23 -03:00
David McFarland
2d43ecc400 buildDotnetModule: clean-up stdenv attributes
- stop binding attributes we don't care about (e.g. name, doCheck)
- remove attributes we handle in nix (e.g. useAppHost)
- inherit attributes with default values (e.g. packNupkg)
2024-09-05 23:46:23 -03:00
David McFarland
e78882326b mkNugetDeps: unpack to source/
Unpacking to the build root was a bad idea. stdenv uses dumpVars() to
create a file env-vars containing the entire environment.  This was
being installed in the derivation output, and since it contains lots of
store paths, it was bloating the closure for every nuget package.
2024-09-05 22:47:39 -03:00
David McFarland
e49642596f buildDotnetModule: set TMPDIR in fetch-deps
Some packages assume TMPDIR is unshared, even in nix-shell.
2024-09-05 22:47:39 -03:00
David McFarland
e530139caa buildDotnetModule: fix tool manifest detection 2024-09-05 22:47:38 -03:00
Ivan Trubach
2d33d5c778 buildDotnetModule: inherit enableParallelBuilding
After this change, enableParallelBuilding defaults to true for packages
using buildDotnetModule. The argument value already defaults to true,
but we did not use it. Note that default values in Nix are not present
in the arguments attribute set, e.g. `args` does not contain `def` for
`{ def ? true }@args: …` function unless this argument is explicitly
passed.
2024-09-03 22:57:52 +03:00
Matt Sturgeon
1c379e3a57
buildDotnetModule: add testFilters arg
In addition to the existing `disabledTests`, allow defining more general
test filters using `testFilters`.
2024-08-22 19:52:07 +01:00
Matt Sturgeon
79d26048de
buildDotnetModule: add finalAttrs support
Allow users to pass arguments to `buildDotnetModule` in the form:

```nix
buildDotnetModule (finalAttrs: {
  # Args
})
```

Exposing the behaviour of the underlying `mkDerivation` and allowing
packages to be defined in a recursive way that works correctly even when
the package is overridden, e.g. using `overrideAttrs`.

Added some simple test cases that piggyback on the existing
`structured-attrs` test.
2024-08-06 16:33:49 +01:00
Matt Sturgeon
77a13aa9ad
buildDotnetModule: format with nixfmt 2024-08-01 13:58:28 +01:00
David McFarland
d3ca5027fa dotnet: use unpacked nuget packages 2024-07-31 00:47:14 -03:00
David McFarland
7402aa90cf buildDotnetModule: fix typo 2024-07-30 12:16:45 -03:00
David McFarland
b87ddc0dd5 nuget-to-nix: catch errors from process substitution 2024-07-30 12:16:45 -03:00
David McFarland
0c1f3e6c93 buildDotnetModule: remove nugetDeps from derivation args
This allows fetch-deps to work even when the deps file is missing.
2024-07-30 12:16:45 -03:00
Smaug123
7924a2513e
dotnet: fix fetchDeps null handling 2024-07-16 08:34:23 +01:00
David McFarland
d50a509660
Merge pull request #326785 from Smaug123/nuget-deterministic
dotnet: strip signature files from NuGet
2024-07-14 21:23:38 -03:00
Smaug123
368fc1c5b1
dotnet: strip signature files from NuGet packages 2024-07-14 22:41:30 +01:00
Smaug123
45037a9d73
buildDotnetModule: split fetch-deps script to new file
This makes the minimal change to put the script in a new file.
It does not fix the resulting ShellCheck warnings (which would
have been present in the previous version; I've just exposed
them).
2024-07-12 09:53:13 +01:00
David McFarland
691bec7b0e nuget-to-nix: fix hash generation when resolving multiple sources
Fixes: 2280d5c467
2024-07-08 12:14:09 -03:00