diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-10-29 18:01:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-29 18:01:00 +0000 |
commit | 6317a19147f759a91e0cc37a236f1a070357a966 (patch) | |
tree | 645ec3f294dfe3402c27fbfcdb8cd0a6ce3ede4a /pkgs/build-support | |
parent | 97b60b1800c22850bc7e52596777c8c60dbbd9e6 (diff) | |
parent | 7b77cca268d1c0de2c22c13baf19654a47abe562 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/appimage/default.nix | 9 | ||||
-rw-r--r-- | pkgs/build-support/build-dotnet-module/default.nix | 40 |
2 files changed, 33 insertions, 16 deletions
diff --git a/pkgs/build-support/appimage/default.nix b/pkgs/build-support/appimage/default.nix index 9df241a48cadc..8a2b2324574b6 100644 --- a/pkgs/build-support/appimage/default.nix +++ b/pkgs/build-support/appimage/default.nix @@ -1,5 +1,4 @@ { lib - , bash , binutils-unwrapped , coreutils @@ -27,7 +26,7 @@ rec { ]; }; - extract = { name, src }: pkgs.runCommand "${name}-extracted" { + extract = args@{ name ? "${args.pname}-${args.version}", src, ... }: pkgs.runCommand "${name}-extracted" { buildInputs = [ appimage-exec ]; } '' appimage-exec.sh -x $out ${src} @@ -38,7 +37,7 @@ rec { extractType2 = extract; wrapType1 = wrapType2; - wrapAppImage = args@{ name, src, extraPkgs, ... }: buildFHSUserEnv + wrapAppImage = args@{ name ? "${args.pname}-${args.version}", src, extraPkgs, ... }: buildFHSUserEnv (defaultFhsEnvArgs // { inherit name; @@ -46,9 +45,9 @@ rec { ++ defaultFhsEnvArgs.targetPkgs pkgs ++ extraPkgs pkgs; runScript = "appimage-exec.sh -w ${src} --"; - } // (removeAttrs args (builtins.attrNames (builtins.functionArgs wrapAppImage)))); + } // (removeAttrs args ([ "pname" "version" ] ++ (builtins.attrNames (builtins.functionArgs wrapAppImage))))); - wrapType2 = args@{ name, src, extraPkgs ? pkgs: [ ], ... }: wrapAppImage + wrapType2 = args@{ name ? "${args.pname}-${args.version}", src, extraPkgs ? pkgs: [ ], ... }: wrapAppImage (args // { inherit name extraPkgs; src = extract { inherit name src; }; diff --git a/pkgs/build-support/build-dotnet-module/default.nix b/pkgs/build-support/build-dotnet-module/default.nix index 3701f254d0ca4..b6330b90775c5 100644 --- a/pkgs/build-support/build-dotnet-module/default.nix +++ b/pkgs/build-support/build-dotnet-module/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, makeWrapper, dotnetCorePackages, dotnetPackages, cacert, linkFarmFromDrvs, fetchurl }: +{ lib, stdenvNoCC, linkFarmFromDrvs, makeWrapper, fetchurl, xml2, dotnetCorePackages, dotnetPackages, cacert }: { name ? "${args.pname}-${args.version}" , enableParallelBuilding ? true @@ -50,10 +50,35 @@ let }; }); - package = stdenv.mkDerivation (args // { + nuget-source = stdenvNoCC.mkDerivation rec { + name = "${args.pname}-nuget-source"; + meta.description = "A Nuget source with the dependencies for ${args.pname}"; + + nativeBuildInputs = [ dotnetPackages.Nuget xml2 ]; + buildCommand = '' + export HOME=$(mktemp -d) + mkdir -p $out/{lib,share} + + nuget sources Add -Name nixos -Source "$out/lib" + nuget init "${_nugetDeps}" "$out/lib" + + # Generates a list of all unique licenses' spdx ids. + find "$out/lib" -name "*.nuspec" -exec sh -c \ + "xml2 < {} | grep "license=" | cut -d'=' -f2" \; | sort -u > $out/share/licenses + ''; + } // { # This is done because we need data from `$out` for `meta`. We have to use overrides as to not hit infinite recursion. + meta.licence = let + depLicenses = lib.splitString "\n" (builtins.readFile "${nuget-source}/share/licenses"); + getLicence = spdx: lib.filter (license: license.spdxId or null == spdx) (builtins.attrValues lib.licenses); + in (lib.flatten (lib.forEach depLicenses (spdx: + if (getLicence spdx) != [] then (getLicence spdx) else [] ++ lib.optional (spdx != "") spdx + ))); + }; + + package = stdenvNoCC.mkDerivation (args // { inherit buildType; - nativeBuildInputs = args.nativeBuildInputs or [] ++ [ dotnet-sdk dotnetPackages.Nuget cacert makeWrapper ]; + nativeBuildInputs = args.nativeBuildInputs or [] ++ [ dotnet-sdk cacert makeWrapper ]; # Stripping breaks the executable dontStrip = true; @@ -66,18 +91,11 @@ let export HOME=$(mktemp -d) - nuget sources Add -Name nixos -Source "$PWD/nixos" - nuget init "${_nugetDeps}" "$PWD/nixos" - - # This is required due to https://github.com/NuGet/Home/issues/4413. - mkdir -p $HOME/.nuget/NuGet - cp $HOME/.config/NuGet/NuGet.Config $HOME/.nuget/NuGet - dotnet restore "$projectFile" \ ${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \ -p:ContinuousIntegrationBuild=true \ -p:Deterministic=true \ - --source "$PWD/nixos" \ + --source "${nuget-source}/lib" \ "''${dotnetRestoreFlags[@]}" \ "''${dotnetFlags[@]}" |