nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 85 lines 2.0 kB view raw
1{ lib, stdenv, dotnetfx }: 2{ name 3, src 4, baseDir ? "." 5, slnFile 6, targets ? "ReBuild" 7, verbosity ? "detailed" 8, options ? "/p:Configuration=Debug;Platform=Win32" 9, assemblyInputs ? [] 10, preBuild ? "" 11, modifyPublicMain ? false 12, mainClassFile ? null 13}: 14 15assert modifyPublicMain -> mainClassFile != null; 16 17stdenv.mkDerivation { 18 inherit name src; 19 20 buildInputs = [ dotnetfx ]; 21 22 preConfigure = '' 23 cd ${baseDir} 24 ''; 25 26 preBuild = '' 27 ${lib.optionalString modifyPublicMain '' 28 sed -i -e "s|static void Main|public static void Main|" ${mainClassFile} 29 ''} 30 ${preBuild} 31 ''; 32 33 installPhase = '' 34 addDeps() 35 { 36 if [ -f $1/nix-support/dotnet-assemblies ] 37 then 38 for i in $(cat $1/nix-support/dotnet-assemblies) 39 do 40 windowsPath=$(cygpath --windows $i) 41 assemblySearchPaths="$assemblySearchPaths;$windowsPath" 42 43 addDeps $i 44 done 45 fi 46 } 47 48 for i in ${toString assemblyInputs} 49 do 50 windowsPath=$(cygpath --windows $i) 51 echo "Using assembly path: $windowsPath" 52 53 if [ "$assemblySearchPaths" = "" ] 54 then 55 assemblySearchPaths="$windowsPath" 56 else 57 assemblySearchPaths="$assemblySearchPaths;$windowsPath" 58 fi 59 60 addDeps $i 61 done 62 63 echo "Assembly search paths are: $assemblySearchPaths" 64 65 if [ "$assemblySearchPaths" != "" ] 66 then 67 echo "Using assembly search paths args: $assemblySearchPathsArg" 68 export AssemblySearchPaths=$assemblySearchPaths 69 fi 70 71 mkdir -p $out 72 MSBuild.exe ${toString slnFile} /nologo /t:${targets} /p:IntermediateOutputPath=$(cygpath --windows $out)\\ /p:OutputPath=$(cygpath --windows $out)\\ /verbosity:${verbosity} ${options} 73 74 # Because .NET assemblies store strings as UTF-16 internally, we cannot detect 75 # hashes. Therefore a text files containing the proper paths is created 76 # We can also use this file the propagate transitive dependencies. 77 78 mkdir -p $out/nix-support 79 80 for i in ${toString assemblyInputs} 81 do 82 echo $i >> $out/nix-support/dotnet-assemblies 83 done 84 ''; 85}