Skip to content

Instantly share code, notes, and snippets.

@betaboon
Created April 2, 2019 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaboon/a2ca89e66a55beec23a242d402f15121 to your computer and use it in GitHub Desktop.
Save betaboon/a2ca89e66a55beec23a242d402f15121 to your computer and use it in GitHub Desktop.
eventstore5.nix
# 1. create a log with `dotnet restore -v m MyPackage.sln > mypackage-restore.log
# 2. then call ./create-deps.sh mypackage-restore.log
urlbase="https://www.nuget.org/api/v2/package"
cat << EOL
{ fetchurl }: let
fetchNuGet = { name, version, sha256 }: fetchurl {
inherit sha256;
url = "$urlbase/\${name}/\${version}";
};
in [
EOL
IFS=''
while read line; do
if echo $line | grep -q "Installing "; then
name=$(echo $line | sed -r 's/ Installing ([^ ]+) (.+)./\1/')
version=$(echo $line | sed -r 's/ Installing ([^ ]+) (.+)./\2/')
sha256=$(nix-prefetch-url "$urlbase/$name/$version" 2>/dev/null)
cat << EOL
(fetchNuGet {
name = "$name";
version = "$version";
sha256 = "$sha256";
})
EOL
fi
done < $1
cat << EOL
]
EOL
{ stdenv
, fetchFromGitHub
, fetchurl
, dotnet-sdk
, dotnetPackages
, mono
, curl
, git
, pkgconfig
, makeWrapper
}:
let
deps = import ./deps.nix { inherit fetchurl; };
in
stdenv.mkDerivation rec {
name = "EventStore-${version}";
version = "5.0.0";
src = fetchFromGitHub {
owner = "EventStore";
repo = "EventStore";
rev = "oss-v${version}";
sha256 = "1qdnkaxiryyz8yhwqncmshsg8wi4v69dcxnvgvl4hn81zsj6fasw";
};
buildInputs = [
dotnet-sdk
dotnetPackages.Nuget
mono
makeWrapper
curl
git
pkgconfig
];
# that dependency seems to not be required for building, but pulls in libcurl which fails to be located.
patchPhase = ''
for f in $(find . -iname "*.csproj"); do
sed -i '/Include="Microsoft.SourceLink.GitHub"/d' $f
done
'';
buildPhase = ''
mkdir home
export HOME=$PWD/home
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export FrameworkPathOverride=${mono}/lib/mono/4.7.1-api
# disable default-source so nuget does not try to download from online-repo
nuget sources Disable -Name "nuget.org"
# add all dependencies to a source called 'nixos'
for package in ${toString deps}; do
nuget add $package -Source nixos
done
dotnet restore --source nixos src/EventStore.sln
dotnet build --no-restore -c Release src/EventStore.sln
'';
installPhase = ''
mkdir -p $out/{bin,lib/eventstore}
cp -r bin/Release/* $out/lib/eventstore
makeWrapper "${mono}/bin/mono" $out/bin/eventstored \
--add-flags "$out/lib/eventstore/EventStore.ClusterNode/net471/EventStore.ClusterNode.exe"
'';
meta = {
homepage = https://geteventstore.com/;
description = "Event sourcing database with processing logic in JavaScript";
license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ puffnfresh ];
platforms = [ "x86_64-linux" ];
};
}
{ fetchurl }: let
fetchNuGet = { name, version, sha256 }: fetchurl {
inherit sha256;
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
};
in [
(fetchNuGet {
name = "YamlDotNet";
version = "5.2.1";
sha256 = "0nb34qcdhs5qn4783idg28f2kr89vaiyjn4v2barhv7i75zhym6y";
})
(fetchNuGet {
name = "NLog";
version = "4.5.10";
sha256 = "0d4yqxrhqn2k36h3v1f5pn6qqlagbzg67v6gvxqhz3s4zyc3b8rg";
})
(fetchNuGet {
name = "Newtonsoft.Json";
version = "11.0.2";
sha256 = "1784xi44f4k8v1fr696hsccmwpy94bz7kixxqlri98zhcxn406b2";
})
(fetchNuGet {
name = "System.Threading.Tasks.Extensions";
version = "4.3.0";
sha256 = "1xxcx2xh8jin360yjwm4x4cf5y3a2bwpn2ygkfkwkicz7zk50s2z";
})
(fetchNuGet {
name = "Microsoft.CodeCoverage";
version = "15.9.0";
sha256 = "10v5xrdilnm362g9545qxvlrbwc9vn65jhpb1i0jlhyqsj6bfwzg";
})
(fetchNuGet {
name = "System.Text.Encoding.Extensions";
version = "4.3.0";
sha256 = "11q1y8hh5hrp5a3kw25cb6l00v5l5dvirkz8jr3sq00h1xgcgrxy";
})
(fetchNuGet {
name = "protobuf-net";
version = "2.4.0";
sha256 = "106lxm9afga7ihlknyy7mlfplyq40mrndksqrsn8ia2a47fbqqld";
})
(fetchNuGet {
name = "NUnit3TestAdapter";
version = "3.10.0";
sha256 = "0ahzfk9y2dq0wl91ll5hss89hqw7la85ndll5030nslizsgm5q2i";
})
(fetchNuGet {
name = "System.Security.Principal.Windows";
version = "4.5.0";
sha256 = "0rmj89wsl5yzwh0kqjgx45vzf694v9p92r4x4q6yxldk1cv1hi86";
})
(fetchNuGet {
name = "NUnit";
version = "3.11.0";
sha256 = "0mmc8snwjjmbkhk6cv5c0ha77czzy9bca4q59244rxciw9sxk1cz";
})
(fetchNuGet {
name = "System.Reflection.DispatchProxy";
version = "4.5.0";
sha256 = "0v9sg38h91aljvjyc77m1y5v34p50hjdbxvvxwa1whlajhafadcn";
})
(fetchNuGet {
name = "Microsoft.NET.Test.Sdk";
version = "15.9.0";
sha256 = "0g7wjgiigs4v8qa32g9ysqgx8bx55dzmbxfkc4ic95mpd1vkjqxw";
})
(fetchNuGet {
name = "Microsoft.NETCore.Platforms";
version = "2.1.0";
sha256 = "0nmdnkmwyxj8cp746hs9an57zspqlmqdm55b00i7yk8a22s6akxz";
})
(fetchNuGet {
name = "HdrHistogram";
version = "2.5.0";
sha256 = "1s2np7m3pp17rgambax9a3x5pd2grx74cr325q3xapjz2gd58sj1";
})
(fetchNuGet {
name = "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple";
version = "4.3.0";
sha256 = "10yc8jdrwgcl44b4g93f1ds76b176bajd3zqi2faf5rvh1vy9smi";
})
(fetchNuGet {
name = "System.Xml.XmlDocument";
version = "4.3.0";
sha256 = "0bmz1l06dihx52jxjr22dyv5mxv6pj4852lx68grjm7bivhrbfwi";
})
(fetchNuGet {
name = "System.Xml.ReaderWriter";
version = "4.3.0";
sha256 = "0c47yllxifzmh8gq6rq6l36zzvw4kjvlszkqa9wq3fr59n0hl3s1";
})
(fetchNuGet {
name = "System.Text.RegularExpressions";
version = "4.3.0";
sha256 = "1bgq51k7fwld0njylfn7qc5fmwrk2137gdq7djqdsw347paa9c2l";
})
(fetchNuGet {
name = "System.Reflection.Extensions";
version = "4.3.0";
sha256 = "02bly8bdc98gs22lqsfx9xicblszr2yan7v2mmw3g7hy6miq5hwq";
})
(fetchNuGet {
name = "System.Private.ServiceModel";
version = "4.5.3";
sha256 = "0nyw9m9dj327hn0qb0jmgwpch0f40jv301fk4mrchga8g99xbpng";
})
(fetchNuGet {
name = "System.Reflection.Emit.ILGeneration";
version = "4.3.0";
sha256 = "0w1n67glpv8241vnpz1kl14sy7zlnw414aqwj4hcx5nd86f6994q";
})
(fetchNuGet {
name = "System.Security.Cryptography.Csp";
version = "4.3.0";
sha256 = "1x5wcrddf2s3hb8j78cry7yalca4lb5vfnkrysagbn6r9x6xvrx1";
})
(fetchNuGet {
name = "System.Security.Cryptography.Cng";
version = "4.3.0";
sha256 = "1k468aswafdgf56ab6yrn7649kfqx2wm9aslywjam1hdmk5yypmv";
})
(fetchNuGet {
name = "System.Globalization.Calendars";
version = "4.3.0";
sha256 = "1xwl230bkakzzkrggy1l1lxmm3xlhk4bq2pkv790j5lm8g887lxq";
})
(fetchNuGet {
name = "System.Linq";
version = "4.3.0";
sha256 = "1w0gmba695rbr80l1k2h4mrwzbzsyfl2z4klmpbsvsg5pm4a56s7";
})
(fetchNuGet {
name = "Microsoft.Build.Tasks.Git";
version = "1.0.0-beta-63127-02";
sha256 = "10avjhp4vjbmix4rwacbw6cim2d4kbmz64q4n7r6zz94395l61b6";
})
(fetchNuGet {
name = "Microsoft.SourceLink.Common";
version = "1.0.0-beta-63127-02";
sha256 = "0y29xx3x9nd14n1sr8ycxhf6y1a83pv3sayfxjib8wi6s866lagb";
})
(fetchNuGet {
name = "Microsoft.SourceLink.GitHub";
version = "1.0.0-beta-63127-02";
sha256 = "1096d5n7mfvgm1apdmafjkxkqray6r2cw6zjhhxj2zn98836w1n2";
})
(fetchNuGet {
name = "System.Runtime.Numerics";
version = "4.3.0";
sha256 = "19rav39sr5dky7afygh309qamqqmi9kcwvz3i0c5700v0c5cg61z";
})
(fetchNuGet {
name = "runtime.native.System.Security.Cryptography.Apple";
version = "4.3.0";
sha256 = "1b61p6gw1m02cc1ry996fl49liiwky6181dzr873g9ds92zl326q";
})
(fetchNuGet {
name = "System.Reflection.Primitives";
version = "4.3.0";
sha256 = "04xqa33bld78yv5r93a8n76shvc8wwcdgr1qvvjh959g3rc31276";
})
(fetchNuGet {
name = "System.IO.FileSystem.Primitives";
version = "4.3.0";
sha256 = "0j6ndgglcf4brg2lz4wzsh1av1gh8xrzdsn9f0yznskhqn1xzj9c";
})
(fetchNuGet {
name = "NETStandard.Library";
version = "2.0.3";
sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y";
})
(fetchNuGet {
name = "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "1x0g58pbpjrmj2x2qw17rdwwnrcl0wvim2hdwz48lixvwvp22n9c";
})
(fetchNuGet {
name = "System.Net.Requests";
version = "4.3.0";
sha256 = "0pcznmwqqk0qzp0gf4g4xw7arhb0q8v9cbzh3v8h8qp6rjcr339a";
})
(fetchNuGet {
name = "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "0q0n5q1r1wnqmr5i5idsrd9ywl33k0js4pngkwq9p368mbxp8x1w";
})
(fetchNuGet {
name = "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "15gsm1a8jdmgmf8j5v1slfz8ks124nfdhk2vxs2rw3asrxalg8hi";
})
(fetchNuGet {
name = "System.Net.Http";
version = "4.3.4";
sha256 = "0kdp31b8819v88l719j6my0yas6myv9d1viql3qz5577mv819jhl";
})
(fetchNuGet {
name = "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "1cpx56mcfxz7cpn57wvj18sjisvzq8b5vd9rw16ihd2i6mcp3wa1";
})
(fetchNuGet {
name = "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "1m9z1k9kzva9n9kwinqxl97x2vgl79qhqjlv17k9s2ymcyv2bwr6";
})
(fetchNuGet {
name = "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "1dm8fifl7rf1gy7lnwln78ch4rw54g0pl5g1c189vawavll7p6rj";
})
(fetchNuGet {
name = "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "096ch4n4s8k82xga80lfmpimpzahd2ip1mgwdqgar0ywbbl6x438";
})
(fetchNuGet {
name = "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "0404wqrc7f2yc0wxv71y3nnybvqx8v4j9d47hlscxy759a525mc3";
})
(fetchNuGet {
name = "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "1n06gxwlinhs0w7s8a94r1q3lwqzvynxwd3mp10ws9bg6gck8n4r";
})
(fetchNuGet {
name = "System.Net.Security";
version = "4.3.2";
sha256 = "1aw1ca1vssqrillrh4qkarx0lxwc8wcaqdkfdima8376wb98j2q8";
})
(fetchNuGet {
name = "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "0rwpqngkqiapqc5c2cpkj7idhngrgss5qpnqg0yh40mbyflcxf8i";
})
(fetchNuGet {
name = "Microsoft.NETCore.Platforms";
version = "1.1.0";
sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm";
})
(fetchNuGet {
name = "System.Reflection";
version = "4.3.0";
sha256 = "0xl55k0mw8cd8ra6dxzh974nxif58s3k1rjv1vbd7gjbjr39j11m";
})
(fetchNuGet {
name = "System.Collections";
version = "4.3.0";
sha256 = "19r4y64dqyrq6k4706dnyhhw7fs24kpp3awak7whzss39dakpxk9";
})
(fetchNuGet {
name = "System.Diagnostics.Debug";
version = "4.3.0";
sha256 = "00yjlf19wjydyr6cfviaph3vsjzg3d5nvnya26i2fvfg53sknh3y";
})
(fetchNuGet {
name = "System.Diagnostics.Tracing";
version = "4.3.0";
sha256 = "1m3bx6c2s958qligl67q7grkwfz3w53hpy7nc97mh6f7j5k168c4";
})
(fetchNuGet {
name = "System.Globalization";
version = "4.3.0";
sha256 = "1cp68vv683n6ic2zqh2s1fn4c2sd87g5hpp6l4d4nj4536jz98ki";
})
(fetchNuGet {
name = "Microsoft.NETCore.Targets";
version = "1.1.0";
sha256 = "193xwf33fbm0ni3idxzbr5fdq3i2dlfgihsac9jj7whj0gd902nh";
})
(fetchNuGet {
name = "System.Threading.ThreadPool";
version = "4.3.0";
sha256 = "027s1f4sbx0y1xqw2irqn6x161lzj8qwvnh2gn78ciiczdv10vf1";
})
(fetchNuGet {
name = "System.IO";
version = "4.3.0";
sha256 = "05l9qdrzhm4s5dixmx68kxwif4l99ll5gqmh7rqgw554fx0agv5f";
})
(fetchNuGet {
name = "System.Security.Principal";
version = "4.3.0";
sha256 = "12cm2zws06z4lfc4dn31iqv7072zyi4m910d4r6wm8yx85arsfxf";
})
(fetchNuGet {
name = "System.Net.Primitives";
version = "4.3.0";
sha256 = "0c87k50rmdgmxx7df2khd9qj7q35j9rzdmm2572cc55dygmdk3ii";
})
(fetchNuGet {
name = "System.Net.WebHeaderCollection";
version = "4.3.0";
sha256 = "0ms3ddjv1wn8sqa5qchm245f3vzzif6l6fx5k92klqpn7zf4z562";
})
(fetchNuGet {
name = "System.Security.Claims";
version = "4.3.0";
sha256 = "0jvfn7j22l3mm28qjy3rcw287y9h65ha4m940waaxah07jnbzrhn";
})
(fetchNuGet {
name = "System.Resources.ResourceManager";
version = "4.3.0";
sha256 = "0sjqlzsryb0mg4y4xzf35xi523s4is4hz9q4qgdvlvgivl7qxn49";
})
(fetchNuGet {
name = "System.Collections.Concurrent";
version = "4.3.0";
sha256 = "0wi10md9aq33jrkh2c24wr2n9hrpyamsdhsxdcnf43b7y86kkii8";
})
(fetchNuGet {
name = "System.Runtime";
version = "4.3.0";
sha256 = "066ixvgbf2c929kgknshcxqj6539ax7b9m570cp8n179cpfkapz7";
})
(fetchNuGet {
name = "System.Threading";
version = "4.3.0";
sha256 = "0rw9wfamvhayp5zh3j7p1yfmx9b5khbf4q50d8k5rk993rskfd34";
})
(fetchNuGet {
name = "System.Threading.Tasks";
version = "4.3.0";
sha256 = "134z3v9abw3a6jsw17xl3f6hqjpak5l682k2vz39spj4kmydg6k7";
})
(fetchNuGet {
name = "Microsoft.NETCore.Platforms";
version = "1.1.1";
sha256 = "164wycgng4mi9zqi2pnsf1pq6gccbqvw6ib916mqizgjmd8f44pj";
})
(fetchNuGet {
name = "runtime.native.System";
version = "4.3.0";
sha256 = "15hgf6zaq9b8br2wi1i3x0zvmk410nlmsmva9p0bbg73v6hml5k4";
})
(fetchNuGet {
name = "runtime.native.System.Net.Http";
version = "4.3.0";
sha256 = "1n6rgz5132lcibbch1qlf0g9jk60r0kqv087hxc0lisy50zpm7kk";
})
(fetchNuGet {
name = "runtime.native.System.Net.Security";
version = "4.3.0";
sha256 = "0dnqjhw445ay3chpia9p6vy4w2j6s9vy3hxszqvdanpvvyaxijr3";
})
(fetchNuGet {
name = "runtime.native.System.Security.Cryptography.OpenSsl";
version = "4.3.2";
sha256 = "0zy5r25jppz48i2bkg8b9lfig24xixg6nm3xyr1379zdnqnpm8f6";
})
(fetchNuGet {
name = "Microsoft.Win32.Primitives";
version = "4.3.0";
sha256 = "0j0c1wj4ndj21zsgivsc24whiya605603kxrbiw6wkfdync464wq";
})
(fetchNuGet {
name = "System.Diagnostics.DiagnosticSource";
version = "4.3.0";
sha256 = "0z6m3pbiy0qw6rn3n209rrzf9x1k4002zh90vwcrsym09ipm2liq";
})
(fetchNuGet {
name = "System.Xml.XmlSerializer";
version = "4.3.0";
sha256 = "07pa4sx196vxkgl3csvdmw94nydlsm9ir38xxcs84qjn8cycd912";
})
(fetchNuGet {
name = "System.Globalization.Extensions";
version = "4.3.0";
sha256 = "02a5zfxavhv3jd437bsncbhd2fp1zv4gxzakp1an9l6kdq1mcqls";
})
(fetchNuGet {
name = "System.IO.FileSystem";
version = "4.3.0";
sha256 = "0z2dfrbra9i6y16mm9v1v6k47f0fm617vlb7s5iybjjsz6g1ilmw";
})
(fetchNuGet {
name = "System.Runtime.Extensions";
version = "4.3.0";
sha256 = "1ykp3dnhwvm48nap8q23893hagf665k0kn3cbgsqpwzbijdcgc60";
})
(fetchNuGet {
name = "System.Runtime.Handles";
version = "4.3.0";
sha256 = "0sw2gfj2xr7sw9qjn0j3l9yw07x73lcs97p8xfc9w1x9h5g5m7i8";
})
(fetchNuGet {
name = "System.Runtime.InteropServices";
version = "4.3.0";
sha256 = "00hywrn4g7hva1b2qri2s6rabzwgxnbpw9zfxmz28z09cpwwgh7j";
})
(fetchNuGet {
name = "System.Security.Cryptography.Algorithms";
version = "4.3.0";
sha256 = "03sq183pfl5kp7gkvq77myv7kbpdnq3y0xj7vi4q1kaw54sny0ml";
})
(fetchNuGet {
name = "System.Security.Cryptography.Encoding";
version = "4.3.0";
sha256 = "1jr6w70igqn07k5zs1ph6xja97hxnb3mqbspdrff6cvssgrixs32";
})
(fetchNuGet {
name = "System.ServiceModel.Primitives";
version = "4.5.3";
sha256 = "1v90pci049cn44y0km885k1vrilhb34w6q2zva4y6f3ay84klrih";
})
(fetchNuGet {
name = "System.Security.Cryptography.OpenSsl";
version = "4.3.0";
sha256 = "0givpvvj8yc7gv4lhb6s1prq6p2c4147204a0wib89inqzd87gqc";
})
(fetchNuGet {
name = "System.Security.Cryptography.Primitives";
version = "4.3.0";
sha256 = "0pyzncsv48zwly3lw4f2dayqswcfvdwq2nz0dgwmi7fj3pn64wby";
})
(fetchNuGet {
name = "System.Security.Cryptography.X509Certificates";
version = "4.3.0";
sha256 = "0valjcz5wksbvijylxijjxb1mp38mdhv03r533vnx1q3ikzdav9h";
})
(fetchNuGet {
name = "System.Text.Encoding";
version = "4.3.0";
sha256 = "1f04lkir4iladpp51sdgmis9dj4y8v08cka0mbmsy0frc9a4gjqr";
})
(fetchNuGet {
name = "System.Reflection.Emit";
version = "4.3.0";
sha256 = "11f8y3qfysfcrscjpjym9msk7lsfxkk4fmz9qq95kn3jd0769f74";
})
(fetchNuGet {
name = "System.Reflection.TypeExtensions";
version = "4.4.0";
sha256 = "0n9r1w4lp2zmadyqkgp4sk9wy90sj4ygq4dh7kzamx26i9biys5h";
})
(fetchNuGet {
name = "System.Reflection.Emit.Lightweight";
version = "4.3.0";
sha256 = "0ql7lcakycrvzgi9kxz1b3lljd990az1x6c4jsiwcacrvimpib5c";
})
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment