diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2023-06-28 23:41:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 23:41:18 +0200 |
commit | 198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c (patch) | |
tree | 1eb1cec186e41f0f2bbed767dff2c5fe906230cb /pkgs/build-support/dotnet/build-dotnet-module/default.nix | |
parent | 37bceead9019439c608464e87377626608becb09 (diff) | |
parent | 7af46fb0476330aaa2fe7a1627827007005918ef (diff) | |
download | nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar.gz nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar.bz2 nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar.lz nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar.xz nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.tar.zst nixpkgs-198bd0a4a7dbf059b4bbb307c0b389ee8d8e5d1c.zip |
Merge pull request #239622 from corngood/dotnet-misc
dotnet: misc fixes
Diffstat (limited to 'pkgs/build-support/dotnet/build-dotnet-module/default.nix')
-rw-r--r-- | pkgs/build-support/dotnet/build-dotnet-module/default.nix | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index a9c49d1e526..686d89f8c11 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -112,7 +112,11 @@ let if (nugetDeps != null) then if lib.isDerivation nugetDeps then nugetDeps - else mkNugetDeps { inherit name; nugetDeps = import nugetDeps; } + else mkNugetDeps { + inherit name; + nugetDeps = import nugetDeps; + sourceFile = nugetDeps; + } else throw "Defining the `nugetDeps` attribute is required, as to lock the NuGet dependencies. This file can be generated by running the `passthru.fetch-deps` script."; # contains the actual package dependencies @@ -138,6 +142,8 @@ let name = "${name}-nuget-source"; paths = [ dependenciesSource sdkSource ]; }; + + nugetDepsFile = _nugetDeps.sourceFile; in stdenvNoCC.mkDerivation (args // { nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ @@ -166,7 +172,7 @@ stdenvNoCC.mkDerivation (args // { passthru = { inherit nuget-source; - + } // lib.optionalAttrs (nugetDepsFile != null) { fetch-deps = let flags = dotnetFlags ++ dotnetRestoreFlags; @@ -180,8 +186,8 @@ stdenvNoCC.mkDerivation (args // { # Note that toString is necessary here as it results in the path at # eval time (i.e. to the file in your local Nixpkgs checkout) rather # than the Nix store path of the path after it's been imported. - if lib.isPath nugetDeps && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDeps) - then toString nugetDeps + if lib.isPath nugetDepsFile && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDepsFile) + then toString nugetDepsFile else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")''; in writeShellScript "fetch-${pname}-deps" '' @@ -208,7 +214,7 @@ stdenvNoCC.mkDerivation (args // { if [[ ''${TMPDIR:-} == /run/user/* ]]; then # /run/user is usually a tmpfs in RAM, which may be too small # to store all downloaded dotnet packages - TMPDIR= + unset TMPDIR fi export tmp=$(mktemp -td "deps-${pname}-XXXXXX") @@ -281,13 +287,15 @@ stdenvNoCC.mkDerivation (args // { echo "Succesfully restored project" echo "Writing lockfile..." - echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$depsFile" excluded_sources="${lib.concatStringsSep " " sdkDeps}" for excluded_source in ''${excluded_sources[@]}; do ls "$excluded_source" >> "$tmp/excluded_list" done - nuget-to-nix "$tmp/nuget_pkgs" "$tmp/excluded_list" >> "$depsFile" + tmpFile="$tmp"/deps.nix + echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n" > "$tmpFile" + nuget-to-nix "$tmp/nuget_pkgs" "$tmp/excluded_list" >> "$tmpFile" + mv "$tmpFile" "$depsFile" echo "Succesfully wrote lockfile to $depsFile" ''; } // args.passthru or { }; |