about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-06-23 00:32:22 +0200
committerAlyssa Ross <hi@alyssa.is>2024-06-23 00:32:22 +0200
commit6402b188ddd100b3cd6afe7b8a3e553365203f43 (patch)
tree676b85e4a6ffee092e413e723f7dce8ba01bb48f /nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix
parent5a1826585861b32ce2509c0643e793196d81893e (diff)
parentd603719ec6e294f034936c0d0dc06f689d91b6c3 (diff)
downloadnixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar.gz
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar.bz2
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar.lz
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar.xz
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.tar.zst
nixlib-6402b188ddd100b3cd6afe7b8a3e553365203f43.zip
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix40
1 files changed, 25 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix
index 4548616c7d80..7b88b16064bc 100644
--- a/nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix
+++ b/nixpkgs/pkgs/build-support/dotnet/build-dotnet-module/default.nix
@@ -69,7 +69,7 @@
 , disabledTests ? [ ]
   # The project file to run unit tests against. This is usually referenced in the regular project file, but sometimes it needs to be manually set.
   # It gets restored and build, but not installed. You may need to regenerate your nuget lockfile after setting this.
-, testProjectFile ? ""
+, testProjectFile ? null
 
   # The type of build to perform. This is passed to `dotnet` with the `--configuration` flag. Possible values are `Release`, `Debug`, etc.
 , buildType ? "Release"
@@ -84,23 +84,22 @@
 , dotnet-sdk ? dotnetCorePackages.sdk_6_0
   # The dotnet runtime to use.
 , dotnet-runtime ? dotnetCorePackages.runtime_6_0
-  # The dotnet SDK to run tests against. This can differentiate from the SDK compiled against.
-, dotnet-test-sdk ? dotnet-sdk
 , ...
 } @ args:
 
 let
+  projectFiles =
+    lib.optionals (projectFile != null) (lib.toList projectFile);
+  testProjectFiles =
+    lib.optionals (testProjectFile != null) (lib.toList testProjectFile);
+
   platforms =
     if args ? meta.platforms
     then lib.intersectLists args.meta.platforms dotnet-sdk.meta.platforms
     else dotnet-sdk.meta.platforms;
 
   inherit (callPackage ./hooks {
-    inherit dotnet-sdk dotnet-test-sdk disabledTests nuget-source dotnet-runtime runtimeDeps buildType;
-    runtimeId =
-      if runtimeId != null
-      then runtimeId
-      else dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system;
+    inherit dotnet-sdk dotnet-runtime;
   }) dotnetConfigureHook dotnetBuildHook dotnetCheckHook dotnetInstallHook dotnetFixupHook;
 
   localDeps =
@@ -121,7 +120,7 @@ let
   # contains the actual package dependencies
   dependenciesSource = mkNugetSource {
     name = "${name}-dependencies-source";
-    description = "A Nuget source with the dependencies for ${name}";
+    description = "Nuget source with the dependencies for ${name}";
     deps = [ _nugetDeps ] ++ lib.optional (localDeps != null) localDeps;
   };
 
@@ -145,6 +144,19 @@ let
   nugetDepsFile = _nugetDeps.sourceFile;
 in
 stdenvNoCC.mkDerivation (args // {
+  dotnetInstallPath = installPath;
+  dotnetExecutables = executables;
+  dotnetBuildType = buildType;
+  dotnetProjectFiles = projectFiles;
+  dotnetTestProjectFiles = testProjectFiles;
+  dotnetDisabledTests = disabledTests;
+  dotnetRuntimeId = runtimeId;
+  nugetSource = nuget-source;
+  dotnetRuntimeDeps = map lib.getLib runtimeDeps;
+  dotnetSelfContainedBuild = selfContainedBuild;
+  dotnetUseAppHost = useAppHost;
+  inherit useDotnetFromEnv;
+
   nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [
     dotnetConfigureHook
     dotnetBuildHook
@@ -174,7 +186,7 @@ stdenvNoCC.mkDerivation (args // {
        else [ ]));
 
   makeWrapperArgs = args.makeWrapperArgs or [ ] ++ [
-    "--prefix LD_LIBRARY_PATH : ${dotnet-sdk.icu}/lib"
+    "--prefix" "LD_LIBRARY_PATH" ":" "${dotnet-sdk.icu}/lib"
   ];
 
   # Stripping breaks the executable
@@ -183,8 +195,6 @@ stdenvNoCC.mkDerivation (args // {
   # gappsWrapperArgs gets included when wrapping for dotnet, as to avoid double wrapping
   dontWrapGApps = args.dontWrapGApps or true;
 
-  inherit selfContainedBuild useAppHost useDotnetFromEnv;
-
   # propagate the runtime sandbox profile since the contents apply to published
   # executables
   propagatedSandboxProfile = toString dotnet-runtime.__propagatedSandboxProfile;
@@ -269,11 +279,11 @@ stdenvNoCC.mkDerivation (args // {
                 --no-cache \
                 --force \
                 ${lib.optionalString (!enableParallelBuilding) "--disable-parallel"} \
-                ${lib.optionalString (flags != []) (toString flags)}
+                ${lib.escapeShellArgs flags}
         }
 
-        declare -a projectFiles=( ${toString (lib.toList projectFile)} )
-        declare -a testProjectFiles=( ${toString (lib.toList testProjectFile)} )
+        declare -a projectFiles=( ${lib.escapeShellArgs projectFiles} )
+        declare -a testProjectFiles=( ${lib.escapeShellArgs testProjectFiles} )
 
         export DOTNET_NOLOGO=1
         export DOTNET_CLI_TELEMETRY_OPTOUT=1