Commit Graph

74 Commits

Author SHA1 Message Date
Winter
8c8524bc9a buildDotnetModule: fix sandboxed builds on darwin
ICU tries to unconditionally load files from /usr/share/icu on Darwin,
which makes builds fail in the sandbox. Thus, let's disable ICU during
the build on Darwin by setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT [0].

[0]: https://learn.microsoft.com/en-us/dotnet/core/runtime-config/globalization#invariant-mode
2023-02-21 18:04:39 -05:00
Felix Buehler
bc3d5934d7 treewide: use lib.optionals 2023-02-14 19:11:59 +01:00
mdarocha
08e378f0d4 buildDotnetModule: proper escaping of disabledTests 2023-01-17 16:46:13 +01:00
Erik Arvstedt
89c457d847
build-dotnet-module: fix mktemp
Re-add missing `-t` arg which I erroneously removed in
a98e520855.

Without it, the tmpdir is created in $PWD.
2023-01-09 17:33:10 +01:00
Erik Arvstedt
a98e520855
build-dotnet-module: avoid /run/user for downloading packages
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.
2023-01-07 17:59:34 +01:00
David McFarland
824d40aa04 build-dotnet-module: restore for current runtime by default 2022-12-19 15:36:25 -04:00
David McFarland
4c861dd26c build-dotnet-module: add useAppHost parameter so it can be disabled 2022-12-19 15:36:25 -04:00
David McFarland
62ecb39a1f buildDotnetModule: run tests on projectFile if testProjectFile is unset 2022-12-19 15:36:25 -04:00
David McFarland
507eff880d build-dotnet: make passthru.packages a derivation 2022-12-19 15:36:25 -04:00
David McFarland
06e4d89943 build-dotnet-module: strip --runtime flags without using rid 2022-12-19 15:36:25 -04:00
David McFarland
3fdb6c5a90 dotnetCorePackages: move systemToDotnetRid out of sdk 2022-12-19 15:36:25 -04:00
figsoda
ec8cb34358 treewide: fix typos 2022-12-17 19:39:44 -05:00
mdarocha
8e7296e984 buildDotnetModule: generate a NuGet.config with source
Some references, like <Sdk />, ignore the --source argument.
To fix that, we generate a simple NuGet.config containing only
the given nuget source.
2022-11-25 18:50:44 +01:00
Sandro Jäckel
0f386859f5
build-dotnet-module: don't end with exit code 1 when update was sucessfull
otherwise scripts might end prematurely
2022-10-25 16:12:22 +02:00
David McFarland
abebf5f591 nuget-to-nix: fix warning when package is installed from sdk 2022-10-18 23:42:46 -03:00
David McFarland
b60c9fd2fe nuget-to-nix: find sources deterministically
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.
2022-10-02 16:09:27 -03:00
David McFarland
f8763b87e0 nuget-to-nix: exclude by package source, not list
This allows exclusions to be by version.
2022-10-02 16:09:27 -03:00
David McFarland
0eb6874732 build-dotnet-module: fix fetch-deps usage message 2022-10-02 16:09:27 -03:00
David McFarland
f716d092e2 build-dotnet-module: limit package platforms by sdk support 2022-10-02 16:09:27 -03:00
David McFarland
4b40579b2d build-dotnet-module: clean up tmp file handling
Having:

rm -rf "$src" "$HOME"

Was slightly terrifying IMO, especially where the trap was installed
before HOME was set.
2022-10-02 16:09:24 -03:00
Ivar Scholten
4a8eb528be
buildDotnetModule: add the option to keep sources to fetch-deps 2022-09-18 18:02:03 +02:00
Ivar Scholten
8e00d6ac26
buildDotnetModule: move nugetDeps throw to when its actually needed
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.
2022-09-18 18:00:37 +02:00
Ivar Scholten
03a1b62cb3
buildDotnetModule: dont require specifing a projectFile
In a lot of cases dotnet can figure this out by itself, so we can just
invoke it without the project argument.
2022-09-18 18:00:37 +02:00
Ivar Scholten
a7c598e458
buildDotnetModule: minor changes to hooks
Abide by `set -e` rules and use `local -r` where applicable.
2022-09-18 18:00:37 +02:00
Ivar Scholten
e100b74627
buildDotnetModule: format with nixpkgs-fmt 2022-09-18 18:00:29 +02:00
Cole Helbling
e97ee029b4 build-dotnet-module/fetch-deps: fixup temp naming when pname has a capital X in it
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
2022-09-16 09:18:22 -07:00
David McFarland
c91f7dd64a nuget-to-nix: skip local packages 2022-09-15 19:39:36 -03:00
David McFarland
4ec86553b1 make-nuget-deps: use . for version separator
This allows the output to be used as a nuget source.
2022-09-15 19:39:36 -03:00
Ivv
44ef157f55
Merge pull request #187359 from IvarWithoutBones/dotnetmodule-updatescripts
treewide: migrate buildDotnetModule update scripts to use fetch-deps
2022-09-11 21:40:06 +02:00
Sandro Jäckel
c3f51d1b55
dotenv: convert CRLF line endings into LF
otherwise git converts the line endings with every rebase on Linux
2022-09-11 17:02:00 +02:00
Ivar Scholten
efd92e7fd7
buildDotnetModule: restore for all platforms in fetch-deps
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>
2022-09-11 01:06:33 +02:00
Zhaofeng Li
3d07ae8afd build-dotnet-module: Allow specifying the output path of fetch-deps 2022-08-18 13:49:45 -06:00
Zhaofeng Li
1528ce3063 nuget-to-nix: Make exclusion file optional 2022-08-18 13:49:45 -06:00
Evan Petousis
b4de4dc3bf
buildDotnetModule: set fetch-deps utils via PATH 2022-08-18 23:46:37 +10:00
Evan Petousis
c51e1a1fba
buildDotnetModule: use coreutils in fetch-deps
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.
2022-08-18 23:36:25 +10:00
Evan Petousis
d7728dfc67
buildDotnetModule: use platform-agnostic cp format
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.
2022-08-18 23:35:50 +10:00
Ivv
7ec728db17
Merge pull request #181512 from mdarocha/dotnet-6-update
dotnet-sdk: 6.0.301 -> 6.0.400, refactor to streamline dotnet updates
2022-08-14 15:08:43 +02:00
mdarocha
a3fff0c947 buildDotnetModule: exclude sdk-specific packages in fetch-deps result 2022-08-10 16:26:49 +02:00
mdarocha
886280e8a9 buildDotnetModule: include sdk-specific packages in nuget source
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.
2022-08-10 16:26:43 +02:00
mdarocha
134da4ce36 buildDotnetModule: fix build for dotnet-sdk versions below 6
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.
2022-08-03 16:15:59 +02:00
Sandro
f358b0d40d
Merge pull request #182273 from mdarocha/dotnet-self-contained-build
buildDotnetModule: add option to make a self-contained build
2022-07-28 11:59:09 +02:00
mdarocha
19403a85d9 buildDotnetModule: add option to make a self-contained build 2022-07-26 18:00:15 +02:00
Evgeny Zemtsov
7ab35bdaa6 nuget-to-nix: fallback to default URL for directories
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.
2022-07-25 11:05:10 +02:00
Rick van Schijndel
e243499338
Merge pull request #173889 from IvarWithoutBones/fix/dotnet-cross
dotnet ecosystem: fix cross compilation
2022-07-16 12:37:11 +02:00
mdarocha
98db245db7 buildDotnetModule: explicitly set UseAppHost to true
On macOS, the native executable is not generated by default
on Catalina and above. See https://github.com/dotnet/sdk/issues/10780
2022-07-13 17:15:39 +02:00
mdarocha
3d79e4871b buildDotnetModule: set LD_LIBRARY_PATH from runtimeDeps in dotnetCheckHook
Tests should execute in a similar environment to the final app
2022-07-13 17:15:36 +02:00
Evgeny Zemtsov
8d79dfe6f0 nuget-to-nix: enable default netrc
Enable default netrc for curl command. Otherwise this doesn't work for private repositories that require authentication.
2022-07-12 21:11:57 +02:00
Ivv
8168651288
Merge pull request #178446 from zimbatm/dotnet-nugetdeps
buildDotnetModule: allow passing derivations to nugetDeps
2022-06-21 16:00:48 +02:00
zimbatm
ba2f31b6db
buildDotnetModule: allow passing derivations to nugetDeps
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.
2022-06-21 15:45:52 +02:00
mdarocha
5b7f8d2e43 buildDotnetModule: use src-only in fetch-deps script 2022-06-21 12:13:39 +02:00