summary refs log tree commit diff
path: root/pkgs/build-support/fetchnuget/default.nix
diff options
context:
space:
mode:
authorobadz <dav-github@odav.org>2015-05-22 14:25:02 +0100
committerobadz <dav-github@odav.org>2015-06-06 09:06:22 -0400
commitd4681bf62672083f92545e02e00b8cf040247e8d (patch)
tree24f50b3dfad442cf340db277740ec2e7fe0b7239 /pkgs/build-support/fetchnuget/default.nix
parent4cf3596fdae5982b5c549c52977662ace7bff26a (diff)
downloadnixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar.gz
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar.bz2
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar.lz
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar.xz
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.tar.zst
nixlib-d4681bf62672083f92545e02e00b8cf040247e8d.zip
Lay down the foundation for packaging the .NET echosystem
- fetchNuGet can fetch binaries from nuget servers
- buildDotnetPackage can build .NET packages using mono/xbuild
  - Places nuget & paket as they would clash with nix
  - Patch project files because F# targets are expected to be found in
    the mono directory (and we know that's not going to happen on nix)
  - Find DLLs that were copied from buildInputs and replace by symlink
    for sharing
  - Export produced DLL via the pkg-config mechanism
  - Create wrappers for produced EXEs
- Repackaged this new infrastructure: keepass, monodevelop
- Newly packaged: ExtCore, UnionArgParser, FSharp.Data, Paket, and a
  bunch more..

This is a combination of 73 commits.
Diffstat (limited to 'pkgs/build-support/fetchnuget/default.nix')
-rw-r--r--pkgs/build-support/fetchnuget/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchnuget/default.nix b/pkgs/build-support/fetchnuget/default.nix
new file mode 100644
index 000000000000..803db27c9d56
--- /dev/null
+++ b/pkgs/build-support/fetchnuget/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, buildDotnetPackage, unzip }:
+
+attrs @
+{ baseName
+, version
+, url ? "https://www.nuget.org/api/v2/package/${baseName}/${version}"
+, sha256 ? ""
+, md5 ? ""
+, ...
+}:
+  buildDotnetPackage ({
+    src = fetchurl {
+      inherit url sha256 md5;
+      name = "${baseName}.${version}.zip";
+    };
+
+    sourceRoot = ".";
+
+    buildInputs = [ unzip ];
+
+    phases = [ "unpackPhase" "installPhase" ];
+
+    preInstall = ''
+      function traverseRename () {
+        for e in *
+        do
+          t="$(echo "$e" | sed -e "s/%20/\ /g" -e "s/%2B/+/g")"
+          [ "$t" != "$e" ] && mv -vn "$e" "$t"
+          if [ -d "$t" ]
+          then
+            cd "$t"
+            traverseRename
+            cd ..
+          fi
+        done
+      }
+
+      traverseRename
+   '';
+  } // attrs)