mirror of
https://git.adityakumar.xyz/flakes.git
synced 2024-11-09 22:19:45 +00:00
add dotnet flake
This commit is contained in:
parent
d610024483
commit
3381973219
13 changed files with 712 additions and 0 deletions
37
dotnet/.editorconfig
Normal file
37
dotnet/.editorconfig
Normal file
|
@ -0,0 +1,37 @@
|
|||
root=true
|
||||
|
||||
[*]
|
||||
charset=utf-8
|
||||
trim_trailing_whitespace=true
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
|
||||
# ReSharper properties
|
||||
resharper_xml_indent_size=2
|
||||
resharper_xml_max_line_length=100
|
||||
resharper_xml_tab_width=2
|
||||
|
||||
[*.{csproj,fsproj,sqlproj,targets,props,ts,tsx,css,json}]
|
||||
indent_size=2
|
||||
|
||||
[*.{fs,fsi}]
|
||||
fsharp_bar_before_discriminated_union_declaration=true
|
||||
fsharp_space_before_uppercase_invocation=true
|
||||
fsharp_space_before_class_constructor=true
|
||||
fsharp_space_before_member=true
|
||||
fsharp_space_before_colon=true
|
||||
fsharp_space_before_semicolon=true
|
||||
fsharp_multiline_block_brackets_on_same_column=true
|
||||
fsharp_newline_between_type_definition_and_members=true
|
||||
fsharp_align_function_signature_to_indentation=true
|
||||
fsharp_alternative_long_member_definitions=true
|
||||
fsharp_multi_line_lambda_closing_newline=true
|
||||
fsharp_experimental_keep_indent_in_branch=true
|
||||
fsharp_max_value_binding_width=80
|
||||
fsharp_max_record_width=0
|
||||
max_line_length=120
|
||||
|
||||
[*.{appxmanifest,build,dtd,nuspec,xaml,xamlx,xoml,xsd}]
|
||||
indent_size=2
|
||||
tab_width=2
|
3
dotnet/.gitattributes
vendored
Normal file
3
dotnet/.gitattributes
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
* eol=auto
|
||||
*.sh eol=lf
|
||||
*.nix eol=lf
|
5
dotnet/.gitignore
vendored
Normal file
5
dotnet/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
bin/
|
||||
obj/
|
||||
result
|
||||
*.DotSettings.user
|
||||
.idea/
|
26
dotnet/HelloWorld.Test/HelloWorld.Test.fsproj
Normal file
26
dotnet/HelloWorld.Test/HelloWorld.Test.fsproj
Normal file
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsPublishable>false</IsPublishable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="TestProgram.fs"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FsUnit" Version="5.0.0"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0"/>
|
||||
<PackageReference Include="NUnit" Version="3.13.3"/>
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/>
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.3.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\HelloWorld\HelloWorld.fsproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
dotnet/HelloWorld.Test/TestProgram.fs
Normal file
12
dotnet/HelloWorld.Test/TestProgram.fs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace HelloWorld.Test
|
||||
|
||||
open HelloWorld
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
|
||||
[<TestFixture>]
|
||||
module TestSchema =
|
||||
|
||||
[<Test>]
|
||||
let ``Interpolates correctly`` () =
|
||||
Program.construct "Nix" |> shouldEqual "Hello, Nix!"
|
22
dotnet/HelloWorld.sln
Normal file
22
dotnet/HelloWorld.sln
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloWorld", "HelloWorld\HelloWorld.fsproj", "{289B2402-80C5-47EB-896F-BEF9A751DE61}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloWorld.Test", "HelloWorld.Test\HelloWorld.Test.fsproj", "{4F472FBB-36FB-4073-A7B1-FC102D2D209E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{289B2402-80C5-47EB-896F-BEF9A751DE61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{289B2402-80C5-47EB-896F-BEF9A751DE61}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{289B2402-80C5-47EB-896F-BEF9A751DE61}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{289B2402-80C5-47EB-896F-BEF9A751DE61}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4F472FBB-36FB-4073-A7B1-FC102D2D209E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
13
dotnet/HelloWorld/HelloWorld.fsproj
Normal file
13
dotnet/HelloWorld/HelloWorld.fsproj
Normal file
|
@ -0,0 +1,13 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.fs"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
16
dotnet/HelloWorld/Program.fs
Normal file
16
dotnet/HelloWorld/Program.fs
Normal file
|
@ -0,0 +1,16 @@
|
|||
namespace HelloWorld
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module Program =
|
||||
|
||||
let construct (name : string) : string = sprintf "Hello, %s!" name
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
match argv |> Array.tryExactlyOne with
|
||||
| Some name ->
|
||||
printfn "%s" (construct name)
|
||||
0
|
||||
| None ->
|
||||
eprintfn "Expected exactly one argument"
|
||||
1
|
24
dotnet/README.md
Normal file
24
dotnet/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Hello, World in .NET
|
||||
|
||||
This flake defines:
|
||||
|
||||
* `nix run .#fantomas -- -r .` to run the [Fantomas](https://fsprojects.github.io/fantomas/) F# source formatter.
|
||||
* `nix develop . --command alejandra .` to run the [Alejandra](https://github.com/kamadorueda/alejandra) Nix source formatter.
|
||||
* `nix develop . --command markdown-link-check README.md` to check that this README's links are not broken.
|
||||
* `nix develop . --command bash -c "find . -type f -name '*.sh' | xargs shellcheck"` to check all shell scripts in this repository.
|
||||
* `nix run . --` to run the application.
|
||||
* `nix run .#fetchDeps` to collect the [NuGet] dependencies of the project into the [lockfile](./nix/deps.nix). (You only have to run this after you change the NuGet dependencies of the .NET projects.)
|
||||
|
||||
## Development
|
||||
|
||||
When you want to add a [NuGet] dependency, you will have to rerun `nix run .#fetchDeps`, whose final line of output will tell you which file in your machine's temporary storage it's written its output to.
|
||||
Copy that file to `./nix/deps.nix`.
|
||||
If you forget to do this, you'll see `nix build` fail at the NuGet restore stage, because it's not talking to NuGet but instead is using the dependencies present in the Nix store; if you haven't run `fetchDeps`, those dependencies will not be in the store.
|
||||
(Note that the file as generated does not conform to Alejandra's formatting requirements, so you will probably also want to `nix develop . --command alejandra .` afterwards.)
|
||||
|
||||
## Style guidelines
|
||||
|
||||
This template is *opinionated* about the style guidelines it uses.
|
||||
The F# community at large tends to disagree with these guidelines, and you may wish to adjust the [editorconfig](./.editorconfig) file to suit your own needs.
|
||||
|
||||
[NuGet](https://www.nuget.org)
|
42
dotnet/flake.lock
Normal file
42
dotnet/flake.lock
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1672350804,
|
||||
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
80
dotnet/flake.nix
Normal file
80
dotnet/flake.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
description = "Hello World in .NET";
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
projectFile = "./HelloWorld/HelloWorld.fsproj";
|
||||
testProjectFile = "./HelloWorld.Test/HelloWorld.Test.fsproj";
|
||||
pname = "dotnet-helloworld";
|
||||
dotnet-sdk = pkgs.dotnet-sdk_7;
|
||||
dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0;
|
||||
version = "0.0.1";
|
||||
dotnetSixTool = toolName: toolVersion: sha256:
|
||||
pkgs.stdenvNoCC.mkDerivation rec {
|
||||
name = toolName;
|
||||
version = toolVersion;
|
||||
nativeBuildInputs = [pkgs.makeWrapper];
|
||||
src = pkgs.fetchNuGet {
|
||||
pname = name;
|
||||
version = version;
|
||||
sha256 = sha256;
|
||||
installPhase = ''mkdir -p $out/bin && cp -r tools/net6.0/any/* $out/bin'';
|
||||
};
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p "$out/lib"
|
||||
cp -r ./bin/* "$out/lib"
|
||||
makeWrapper "${dotnet-runtime}/bin/dotnet" "$out/bin/${name}" --add-flags "$out/lib/${name}.dll"
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
fantomas = dotnetSixTool "fantomas" "5.1.5" "sha256-qzIs6JiZV9uHUS0asrgWLAbaKJsNtr5h01fJxmOR2Mc=";
|
||||
fetchDeps = let
|
||||
flags = [];
|
||||
runtimeIds = map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
|
||||
in
|
||||
pkgs.writeShellScriptBin "fetch-${pname}-deps" (builtins.readFile (pkgs.substituteAll {
|
||||
src = ./nix/fetchDeps.sh;
|
||||
pname = pname;
|
||||
binPath = pkgs.lib.makeBinPath [pkgs.coreutils dotnet-sdk (pkgs.nuget-to-nix.override {inherit dotnet-sdk;})];
|
||||
projectFiles = toString (pkgs.lib.toList projectFile);
|
||||
testProjectFiles = toString (pkgs.lib.toList testProjectFile);
|
||||
rids = pkgs.lib.concatStringsSep "\" \"" runtimeIds;
|
||||
packages = dotnet-sdk.packages;
|
||||
storeSrc = pkgs.srcOnly {
|
||||
src = ./.;
|
||||
pname = pname;
|
||||
version = version;
|
||||
};
|
||||
}));
|
||||
default = pkgs.buildDotnetModule {
|
||||
pname = "HelloWorld";
|
||||
version = version;
|
||||
src = ./.;
|
||||
projectFile = projectFile;
|
||||
nugetDeps = ./nix/deps.nix;
|
||||
doCheck = true;
|
||||
dotnet-sdk = dotnet-sdk;
|
||||
dotnet-runtime = dotnet-runtime;
|
||||
};
|
||||
};
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [pkgs.dotnet-sdk_7 pkgs.git pkgs.alejandra pkgs.nodePackages.markdown-link-check];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
359
dotnet/nix/deps.nix
Normal file
359
dotnet/nix/deps.nix
Normal file
|
@ -0,0 +1,359 @@
|
|||
# This file was automatically generated.
|
||||
# Please don't edit it manually; your changes might get overwritten!
|
||||
{fetchNuGet}: [
|
||||
(fetchNuGet {
|
||||
pname = "FSharp.Core";
|
||||
version = "7.0.0";
|
||||
sha256 = "1pgk3qk9p1s53wvja17744x4bf7zs3a3wf0dmxi66w1w06z7i85x";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "FsUnit";
|
||||
version = "5.0.0";
|
||||
sha256 = "0r535cw9ikm8xmyla6ah7qx3hb7nvz5m9fi0dqgbkd3wsrc8jlpl";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.CodeCoverage";
|
||||
version = "17.1.0";
|
||||
sha256 = "1ijl3w14lnj15hi052jlshf5k8vb90x0py7yrs897mf126qp8ivy";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.CSharp";
|
||||
version = "4.0.1";
|
||||
sha256 = "0zxc0apx1gcx361jlq8smc9pfdgmyjh6hpka8dypc9w23nlsh6yj";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.NET.Test.Sdk";
|
||||
version = "17.1.0";
|
||||
sha256 = "1jaq11fhcfiylnn6wvbp2k9hrgq4cz755sfqjqjqcdxlkiyj2dkw";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.NETCore.Platforms";
|
||||
version = "1.0.1";
|
||||
sha256 = "01al6cfxp68dscl15z7rxfw9zvhm64dncsw09a1vmdkacsa2v6lr";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.NETCore.Platforms";
|
||||
version = "1.1.0";
|
||||
sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.NETCore.Targets";
|
||||
version = "1.0.1";
|
||||
sha256 = "0ppdkwy6s9p7x9jix3v4402wb171cdiibq7js7i13nxpdky7074p";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.TestPlatform.ObjectModel";
|
||||
version = "17.1.0";
|
||||
sha256 = "0jw577vbrplv9kga22lsipz91ww9iqi6j1wgpwga0vrayhggjsk2";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Microsoft.TestPlatform.TestHost";
|
||||
version = "17.1.0";
|
||||
sha256 = "0j9i078hv4qqrg2433p20pykmcjvmzarc1cy1k5f7kc7739q6vx5";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NETStandard.Library";
|
||||
version = "2.0.0";
|
||||
sha256 = "1bc4ba8ahgk15m8k4nd7x406nhi0kwqzbgjk2dmw52ss553xz7iy";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NETStandard.Library";
|
||||
version = "2.0.3";
|
||||
sha256 = "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "Newtonsoft.Json";
|
||||
version = "9.0.1";
|
||||
sha256 = "0mcy0i7pnfpqm4pcaiyzzji4g0c8i3a5gjz28rrr28110np8304r";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NuGet.Frameworks";
|
||||
version = "5.11.0";
|
||||
sha256 = "0wv26gq39hfqw9md32amr5771s73f5zn1z9vs4y77cgynxr73s4z";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NUnit";
|
||||
version = "3.13.3";
|
||||
sha256 = "0wdzfkygqnr73s6lpxg5b1pwaqz9f414fxpvpdmf72bvh4jaqzv6";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NUnit.Analyzers";
|
||||
version = "3.3.0";
|
||||
sha256 = "00wp5q361f845aywrhhfbrpwd2srgygiam30pvn846b5dbl41vy0";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "NUnit3TestAdapter";
|
||||
version = "4.2.1";
|
||||
sha256 = "0gildh4xcb6gkxcrrgh5a1j7lq0a7l670jpbs71akl5b5bgy5gc3";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Collections";
|
||||
version = "4.0.11";
|
||||
sha256 = "1x44bm1cgv28zmrp095wf9mn8a6a0ivnzp9v14dcbhx06igxzgg0";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Diagnostics.Tools";
|
||||
version = "4.0.1";
|
||||
sha256 = "0qcpm90hrm9gx9pmxlvfml65jm0bwpr5dg3r7l7xm9nvmibvc7n7";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Globalization";
|
||||
version = "4.0.11";
|
||||
sha256 = "0240rp66pi5bw1xklmh421hj7arwcdmjmgfkiq1cbc6nrm8ah286";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.IO";
|
||||
version = "4.1.0";
|
||||
sha256 = "0kasfkjiml2kk8prnyn1990nhsahnjggvqwszqjdsfwfl43vpcb5";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Reflection";
|
||||
version = "4.1.0";
|
||||
sha256 = "06kcs059d5czyakx75rvlwa2mr86156w18fs7chd03f7084l7mq6";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Reflection.Extensions";
|
||||
version = "4.0.1";
|
||||
sha256 = "05k34ijz9g9csh0vbbv3g3lrxl163izwcfncmbcl7k073h32rzkr";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Reflection.Primitives";
|
||||
version = "4.0.1";
|
||||
sha256 = "1zxrpvixr5fqzkxpnin6g6gjq6xajy1snghz99ds2dwbhm276rhz";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Resources.ResourceManager";
|
||||
version = "4.0.1";
|
||||
sha256 = "1jmgs7hynb2rff48623wnyb37558bbh1q28k9c249j5r5sgsr5kr";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Runtime";
|
||||
version = "4.1.0";
|
||||
sha256 = "0mjr2bi7wvnkphfjqgkyf8vfyvy15a829jz6mivl6jmksh2bx40m";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Runtime.Handles";
|
||||
version = "4.0.1";
|
||||
sha256 = "1kswgqhy34qvc49i981fk711s7knd6z13bp0rin8ms6axkh98nas";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Runtime.InteropServices";
|
||||
version = "4.1.0";
|
||||
sha256 = "0gm8if0hcmp1qys1wmx4970k2x62pqvldgljsyzbjhiy5644vl8z";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Text.Encoding";
|
||||
version = "4.0.11";
|
||||
sha256 = "0m4vgmzi1ky8xlj0r7xcyazxln3j9dlialnk6d2gmgrfnzf8f9m7";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Text.Encoding.Extensions";
|
||||
version = "4.0.11";
|
||||
sha256 = "0d1rxxpvg9v7wlibsfgz0r4hwigpadas822qf8m8fs1gma9gs877";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.any.System.Threading.Tasks";
|
||||
version = "4.0.11";
|
||||
sha256 = "1qzdp09qs8br5qxzlm1lgbjn4n57fk8vr1lzrmli2ysdg6x1xzvk";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.native.System";
|
||||
version = "4.0.0";
|
||||
sha256 = "1ppk69xk59ggacj9n7g6fyxvzmk1g5p4fkijm0d7xqfkig98qrkf";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.native.System.Security.Cryptography";
|
||||
version = "4.0.0";
|
||||
sha256 = "0k57aa2c3b10wl3hfqbgrl7xq7g8hh3a3ir44b31dn5p61iiw3z9";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.unix.System.Diagnostics.Debug";
|
||||
version = "4.0.11";
|
||||
sha256 = "05ndbai4vpqrry0ghbfgqc8xblmplwjgndxmdn1zklqimczwjg2d";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.unix.System.IO.FileSystem";
|
||||
version = "4.0.1";
|
||||
sha256 = "02wnlydnbhai0zy7c3kihg0cis0l1b2z78kyi1ci47c5v0jklwha";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.unix.System.Private.Uri";
|
||||
version = "4.0.1";
|
||||
sha256 = "0ic5dgc45jkhcr1g9xmmzjm7ffiw4cymm0fprczlx4fnww4783nm";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "runtime.unix.System.Runtime.Extensions";
|
||||
version = "4.1.0";
|
||||
sha256 = "0x1cwd7cvifzmn5x1wafvj75zdxlk3mxy860igh3x1wx0s8167y4";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Collections";
|
||||
version = "4.0.11";
|
||||
sha256 = "1ga40f5lrwldiyw6vy67d0sg7jd7ww6kgwbksm19wrvq9hr0bsm6";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Diagnostics.Debug";
|
||||
version = "4.0.11";
|
||||
sha256 = "0gmjghrqmlgzxivd2xl50ncbglb7ljzb66rlx8ws6dv8jm0d5siz";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Diagnostics.Tools";
|
||||
version = "4.0.1";
|
||||
sha256 = "19cknvg07yhakcvpxg3cxa0bwadplin6kyxd8mpjjpwnp56nl85x";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Dynamic.Runtime";
|
||||
version = "4.0.11";
|
||||
sha256 = "1pla2dx8gkidf7xkciig6nifdsb494axjvzvann8g2lp3dbqasm9";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Globalization";
|
||||
version = "4.0.11";
|
||||
sha256 = "070c5jbas2v7smm660zaf1gh0489xanjqymkvafcs4f8cdrs1d5d";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.IO";
|
||||
version = "4.1.0";
|
||||
sha256 = "1g0yb8p11vfd0kbkyzlfsbsp5z44lwsvyc0h3dpw6vqnbi035ajp";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.IO.FileSystem";
|
||||
version = "4.0.1";
|
||||
sha256 = "0kgfpw6w4djqra3w5crrg8xivbanh1w9dh3qapb28q060wb9flp1";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.IO.FileSystem.Primitives";
|
||||
version = "4.0.1";
|
||||
sha256 = "1s0mniajj3lvbyf7vfb5shp4ink5yibsx945k6lvxa96r8la1612";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Linq";
|
||||
version = "4.1.0";
|
||||
sha256 = "1ppg83svb39hj4hpp5k7kcryzrf3sfnm08vxd5sm2drrijsla2k5";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Linq.Expressions";
|
||||
version = "4.1.0";
|
||||
sha256 = "1gpdxl6ip06cnab7n3zlcg6mqp7kknf73s8wjinzi4p0apw82fpg";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.ObjectModel";
|
||||
version = "4.0.12";
|
||||
sha256 = "1sybkfi60a4588xn34nd9a58png36i0xr4y4v4kqpg8wlvy5krrj";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Private.Uri";
|
||||
version = "4.0.1";
|
||||
sha256 = "0k57qhawjysm4cpbfpc49kl4av7lji310kjcamkl23bwgij5ld9j";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection";
|
||||
version = "4.1.0";
|
||||
sha256 = "1js89429pfw79mxvbzp8p3q93il6rdff332hddhzi5wqglc4gml9";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Emit";
|
||||
version = "4.0.1";
|
||||
sha256 = "0ydqcsvh6smi41gyaakglnv252625hf29f7kywy2c70nhii2ylqp";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Emit.ILGeneration";
|
||||
version = "4.0.1";
|
||||
sha256 = "1pcd2ig6bg144y10w7yxgc9d22r7c7ww7qn1frdfwgxr24j9wvv0";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Emit.Lightweight";
|
||||
version = "4.0.1";
|
||||
sha256 = "1s4b043zdbx9k39lfhvsk68msv1nxbidhkq6nbm27q7sf8xcsnxr";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Extensions";
|
||||
version = "4.0.1";
|
||||
sha256 = "0m7wqwq0zqq9gbpiqvgk3sr92cbrw7cp3xn53xvw7zj6rz6fdirn";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Metadata";
|
||||
version = "1.6.0";
|
||||
sha256 = "1wdbavrrkajy7qbdblpbpbalbdl48q3h34cchz24gvdgyrlf15r4";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.Primitives";
|
||||
version = "4.0.1";
|
||||
sha256 = "1bangaabhsl4k9fg8khn83wm6yial8ik1sza7401621jc6jrym28";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Reflection.TypeExtensions";
|
||||
version = "4.1.0";
|
||||
sha256 = "1bjli8a7sc7jlxqgcagl9nh8axzfl11f4ld3rjqsyxc516iijij7";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Resources.ResourceManager";
|
||||
version = "4.0.1";
|
||||
sha256 = "0b4i7mncaf8cnai85jv3wnw6hps140cxz8vylv2bik6wyzgvz7bi";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Runtime";
|
||||
version = "4.1.0";
|
||||
sha256 = "02hdkgk13rvsd6r9yafbwzss8kr55wnj8d5c7xjnp8gqrwc8sn0m";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Runtime.Extensions";
|
||||
version = "4.1.0";
|
||||
sha256 = "0rw4rm4vsm3h3szxp9iijc3ksyviwsv6f63dng3vhqyg4vjdkc2z";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Runtime.Handles";
|
||||
version = "4.0.1";
|
||||
sha256 = "1g0zrdi5508v49pfm3iii2hn6nm00bgvfpjq1zxknfjrxxa20r4g";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Runtime.InteropServices";
|
||||
version = "4.1.0";
|
||||
sha256 = "01kxqppx3dr3b6b286xafqilv4s2n0gqvfgzfd4z943ga9i81is1";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Runtime.Serialization.Primitives";
|
||||
version = "4.1.1";
|
||||
sha256 = "042rfjixknlr6r10vx2pgf56yming8lkjikamg3g4v29ikk78h7k";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Text.Encoding";
|
||||
version = "4.0.11";
|
||||
sha256 = "1dyqv0hijg265dwxg6l7aiv74102d6xjiwplh2ar1ly6xfaa4iiw";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Text.Encoding.Extensions";
|
||||
version = "4.0.11";
|
||||
sha256 = "08nsfrpiwsg9x5ml4xyl3zyvjfdi4mvbqf93kjdh11j4fwkznizs";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Text.RegularExpressions";
|
||||
version = "4.1.0";
|
||||
sha256 = "1mw7vfkkyd04yn2fbhm38msk7dz2xwvib14ygjsb8dq2lcvr18y7";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Threading";
|
||||
version = "4.0.11";
|
||||
sha256 = "19x946h926bzvbsgj28csn46gak2crv2skpwsx80hbgazmkgb1ls";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Threading.Tasks";
|
||||
version = "4.0.11";
|
||||
sha256 = "0nr1r41rak82qfa5m0lhk9mp0k93bvfd7bbd9sdzwx9mb36g28p5";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Threading.Tasks.Extensions";
|
||||
version = "4.0.0";
|
||||
sha256 = "1cb51z062mvc2i8blpzmpn9d9mm4y307xrwi65di8ri18cz5r1zr";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Xml.ReaderWriter";
|
||||
version = "4.0.11";
|
||||
sha256 = "0c6ky1jk5ada9m94wcadih98l6k1fvf6vi7vhn1msjixaha419l5";
|
||||
})
|
||||
(fetchNuGet {
|
||||
pname = "System.Xml.XDocument";
|
||||
version = "4.0.11";
|
||||
sha256 = "0n4lvpqzy9kc7qy1a4acwwd7b7pnvygv895az5640idl2y9zbz18";
|
||||
})
|
||||
]
|
73
dotnet/nix/fetchDeps.sh
Normal file
73
dotnet/nix/fetchDeps.sh
Normal file
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This file was adapted from
|
||||
# https://github.com/NixOS/nixpkgs/blob/b981d811453ab84fb3ea593a9b33b960f1ab9147/pkgs/build-support/dotnet/build-dotnet-module/default.nix#L173
|
||||
set -euo pipefail
|
||||
export PATH="@binPath@"
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--keep-sources|-k)
|
||||
keepSources=1
|
||||
shift
|
||||
;;
|
||||
--help|-h)
|
||||
echo "usage: $0 [--keep-sources] [--help] <output path>"
|
||||
echo " <output path> The path to write the lockfile to. A temporary file is used if this is not set"
|
||||
echo " --keep-sources Don't remove temporary directories upon exit; useful for debugging"
|
||||
echo " --help Show this help message"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
tmp=$(mktemp -td "@pname@-tmp-XXXXXX")
|
||||
export tmp
|
||||
HOME=$tmp/home
|
||||
exitTrap() {
|
||||
test -n "${ranTrap-}" && return
|
||||
ranTrap=1
|
||||
if test -n "${keepSources-}"; then
|
||||
echo -e "Path to the source: $tmp/src\nPath to the fake home: $tmp/home"
|
||||
else
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
# Since mktemp is used this will be empty if the script didn't successfully complete
|
||||
if ! test -s "$depsFile"; then
|
||||
rm -rf "$depsFile"
|
||||
fi
|
||||
}
|
||||
trap exitTrap EXIT INT TERM
|
||||
dotnetRestore() {
|
||||
local -r project="${1-}"
|
||||
local -r rid="$2"
|
||||
dotnet restore "${project-}" \
|
||||
-p:ContinuousIntegrationBuild=true \
|
||||
-p:Deterministic=true \
|
||||
--packages "$tmp/nuget_pkgs" \
|
||||
--runtime "$rid" \
|
||||
--no-cache \
|
||||
--force
|
||||
}
|
||||
declare -a projectFiles=( @projectFiles@ )
|
||||
declare -a testProjectFiles=( @testProjectFiles@ )
|
||||
export DOTNET_NOLOGO=1
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
depsFile=$(realpath "${1:-$(mktemp -t "@pname@-deps-XXXXXX.nix")}")
|
||||
mkdir -p "$tmp/nuget_pkgs"
|
||||
storeSrc="@storeSrc@"
|
||||
src="$tmp/src"
|
||||
cp -rT "$storeSrc" "$src"
|
||||
chmod -R +w "$src"
|
||||
cd "$src"
|
||||
echo "Restoring project..."
|
||||
rids=("@rids@")
|
||||
for rid in "${rids[@]}"; do
|
||||
(( ${#projectFiles[@]} == 0 )) && dotnetRestore "" "$rid"
|
||||
for project in "${projectFiles[@]-}" "${testProjectFiles[@]-}"; do
|
||||
dotnetRestore "$project" "$rid"
|
||||
done
|
||||
done
|
||||
echo "Successfully restored project"
|
||||
echo "Writing lockfile..."
|
||||
echo -e "# This file was automatically generated.\n# Please don't edit it manually; your changes might get overwritten!\n" > "$depsFile"
|
||||
nuget-to-nix "$tmp/nuget_pkgs" "@packages@" >> "$depsFile"
|
||||
echo "Successfully wrote lockfile to $depsFile"
|
Loading…
Reference in a new issue