Compare commits

5 Commits

Author SHA1 Message Date
Smaug123
58a042c3ee Bump stuff 2024-12-24 20:29:10 +00:00
Smaug123
3f426728ad Use non-deprecated nixpkgs methods 2024-12-24 20:18:13 +00:00
Patrick Stevens
38bb5c94f2 Fix workflow (#16) 2024-07-14 13:06:41 +01:00
Patrick Stevens
b2df9db225 Do less progress reporting (#15) 2023-05-06 23:52:23 +01:00
Patrick Stevens
a2d40daef2 Remove most asyncs (#14) 2023-05-06 23:40:09 +01:00
22 changed files with 346 additions and 745 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "5.2.0-alpha-010",
"version": "6.3.15",
"commands": [
"fantomas"
]

View File

@@ -2,7 +2,6 @@ root=true
[*]
charset=utf-8
end_of_line=crlf
trim_trailing_whitespace=true
insert_final_newline=true
indent_style=space
@@ -24,7 +23,7 @@ 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_multiline_bracket_style=aligned
fsharp_newline_between_type_definition_and_members=true
fsharp_align_function_signature_to_indentation=true
fsharp_alternative_long_member_definitions=true

View File

@@ -88,7 +88,10 @@ jobs:
run: nix develop --command markdown-link-check README.md
all-required-checks-complete:
if: ${{ always() }}
needs: [check-dotnet-format, check-nix-format, build, shellcheck, linkcheck]
runs-on: ubuntu-latest
steps:
- run: echo "All required checks complete."
- uses: Smaug123/all-required-checks-complete-action@05b40a8c47ef0b175ea326e9abb09802cb67b44e
with:
needs-context: ${{ toJSON(needs) }}

View File

@@ -15,12 +15,11 @@ module Program =
let go (sample : SampleImages) (pngOutput : IFileInfo) (ctx : ProgressContext) =
let renderTask = ctx.AddTask "[green]Generating image[/]"
let writeUnorderedTask = ctx.AddTask "[green]Writing unordered pixels[/]"
let readTask = ctx.AddTask "[green]Reading in serialised pixels[/]"
let writeTask = ctx.AddTask "[green]Writing PPM file[/]"
let logFile =
pngOutput.FileSystem.Path.GetTempFileName ()
|> pngOutput.FileSystem.FileInfo.FromFileName
|> pngOutput.FileSystem.FileInfo.New
use stream = logFile.OpenWrite ()
use writer = new StreamWriter (stream)
@@ -35,7 +34,6 @@ module Program =
let maxProgress, image = SampleImages.get sample renderTask.Increment write
renderTask.MaxValue <- maxProgress / 1.0<progress>
writeUnorderedTask.MaxValue <- maxProgress / 1.0<progress>
readTask.MaxValue <- maxProgress / 1.0<progress>
writeTask.MaxValue <- maxProgress / 1.0<progress>
let tempOutput, await =
@@ -46,8 +44,7 @@ module Program =
async {
do! Async.AwaitTask await
let! pixelMap =
ImageOutput.readPixelMap readTask.Increment tempOutput (Image.rowCount image) (Image.colCount image)
let! pixelMap = ImageOutput.readPixelMap tempOutput (Image.rowCount image) (Image.colCount image)
let pixelMap = ImageOutput.assertComplete pixelMap
do! Png.write true writeTask.Increment pixelMap pngOutput
@@ -67,8 +64,8 @@ module Program =
| [| name |] ->
SampleImages.Parse name,
fs.Path.GetTempFileName ()
|> fun i -> fs.Path.ChangeExtension (i, ".png") |> fs.FileInfo.FromFileName
| [| name ; output |] -> SampleImages.Parse name, fs.FileInfo.FromFileName output
|> fun i -> fs.Path.ChangeExtension (i, ".png") |> fs.FileInfo.New
| [| name ; output |] -> SampleImages.Parse name, fs.FileInfo.New output
| _ -> failwithf "Expected two args 'sample name' 'output file', got %+A" argv
let progress =

View File

@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="LoadImage.fs" />
<Compile Include="SampleImages.fs" />
<Compile Include="Program.fs" />
<EmbeddedResource Include="earthmap.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RayTracing\RayTracing.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.38.1-preview.0.17" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="LoadImage.fs" />
<Compile Include="SampleImages.fs" />
<Compile Include="Program.fs" />
<EmbeddedResource Include="earthmap.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RayTracing\RayTracing.fsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Spectre.Console" Version="0.49.2-preview.0.9" />
</ItemGroup>
</Project>

View File

@@ -43,12 +43,14 @@ module SampleImages =
}
let image =
Array.init
Seq.init
256
(fun height ->
let output = Array.init 256 (fun i -> async { return pixelAt height i })
progressIncrement 1.0<progress>
output
async {
let output = Array.init 256 (pixelAt height)
progressIncrement 1.0<progress>
return output
}
)
|> Image.make 256 256

View File

@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="TestUtils.fs" />
<Compile Include="TestPpmOutput.fs" />
<Compile Include="TestRay.fs" />
<Compile Include="TestSphereIntersection.fs" />
<EmbeddedResource Include="PpmOutputExample.txt" />
<Compile Include="TestPixel.fs" />
<Compile Include="TestPlane.fs" />
<Compile Include="TestSphere.fs" />
<Compile Include="TestRandom.fs" />
<Compile Include="TestBoundingBox.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FsCheck" Version="3.0.0-alpha5" />
<PackageReference Include="FsUnit" Version="4.0.4" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0-beta.1" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="13.2.28" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RayTracing\RayTracing.fsproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="TestUtils.fs" />
<Compile Include="TestPpmOutput.fs" />
<Compile Include="TestRay.fs" />
<Compile Include="TestSphereIntersection.fs" />
<EmbeddedResource Include="PpmOutputExample.txt" />
<Compile Include="TestPixel.fs" />
<Compile Include="TestPlane.fs" />
<Compile Include="TestSphere.fs" />
<Compile Include="TestRandom.fs" />
<Compile Include="TestBoundingBox.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FsCheck" Version="3.0.0-rc3" />
<PackageReference Include="FsUnit" Version="7.0.0" />
<PackageReference Include="NUnit" Version="4.3.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="21.1.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RayTracing\RayTracing.fsproj" />
</ItemGroup>
</Project>

View File

@@ -2,6 +2,7 @@ namespace RayTracing.Test
open NUnit.Framework
open FsCheck
open FsCheck.FSharp
open RayTracing
[<TestFixture>]

View File

@@ -16,33 +16,27 @@ module TestRayTracing =
let image =
[|
[| Colour.Red ; Colour.Green ; Colour.Blue |]
[|
async { return Colour.Red }
async { return Colour.Green }
async { return Colour.Blue }
|]
[|
async {
return
{
Red = 255uy
Blue = 0uy
Green = 255uy
}
{
Red = 255uy
Blue = 0uy
Green = 255uy
}
async { return Colour.White }
async { return Colour.Black }
Colour.White
Colour.Black
|]
|]
|> Array.map async.Return
|> Image.make 2 3
let outputFile = fs.Path.GetTempFileName () |> fs.FileInfo.FromFileName
let outputFile = fs.Path.GetTempFileName () |> fs.FileInfo.New
let tempOutput, await = ImageOutput.toPpm ignore image fs
async {
do! Async.AwaitTask await
let! pixelMap = ImageOutput.readPixelMap ignore tempOutput (Image.rowCount image) (Image.colCount image)
let! pixelMap = ImageOutput.readPixelMap tempOutput (Image.rowCount image) (Image.colCount image)
let arr = ImageOutput.assertComplete pixelMap
do! ImageOutput.writePpm false ignore arr outputFile
return ()

View File

@@ -3,6 +3,7 @@ namespace RayTracing.Test
open RayTracing
open NUnit.Framework
open FsCheck
open FsCheck.FSharp
[<TestFixture>]
module TestRay =
@@ -32,7 +33,10 @@ module TestRay =
Vector.equal actual expected
let gen : Gen<float> = Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit
let gen : Gen<float> =
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit
let gen = Gen.zip (Gen.zip (Gen.two (Gen.three gen)) TestUtils.unitVectorGen) gen
@@ -49,7 +53,13 @@ module TestRay =
property
|> Prop.forAll (
Arb.fromGen (Gen.zip TestUtils.rayGen (Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit))
Arb.fromGen (
Gen.zip
TestUtils.rayGen
(ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit)
)
)
|> Check.QuickThrowOnFailure
@@ -61,6 +71,12 @@ module TestRay =
property
|> Prop.forAll (
Arb.fromGen (Gen.zip TestUtils.rayGen (Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit))
Arb.fromGen (
Gen.zip
TestUtils.rayGen
(ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit)
)
)
|> Check.QuickThrowOnFailure

View File

@@ -4,6 +4,7 @@ open System
open RayTracing
open NUnit.Framework
open FsCheck
open FsCheck.FSharp
open FsUnitTyped
[<TestFixture>]
@@ -23,9 +24,21 @@ module TestSphere =
let gen : Gen<Point * float * Point> =
gen {
let! centre = TestUtils.pointGen
let! radius = Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit
let! theta = Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit
let! phi = Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit
let! radius =
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit
let! theta =
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit
let! phi =
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit
let surfacePoint =
Point.make (radius * cos phi * sin theta) (radius * sin phi * sin theta) (radius * cos theta)
@@ -161,16 +174,17 @@ module TestSphere =
result
let boundedFloat upperBound =
Arb.generate<NormalFloat>
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map (fun i -> abs i.Get)
|> Gen.filter (fun i -> i <= upperBound)
let arb =
gen {
let! oX = Arb.generate<NormalFloat>
let! oY = Arb.generate<NormalFloat>
let! oZ = Arb.generate<NormalFloat>
let! radius = Arb.generate<NormalFloat>
let! oX = ArbMap.defaults |> ArbMap.generate<NormalFloat>
let! oY = ArbMap.defaults |> ArbMap.generate<NormalFloat>
let! oZ = ArbMap.defaults |> ArbMap.generate<NormalFloat>
let! radius = ArbMap.defaults |> ArbMap.generate<NormalFloat>
let! theta = boundedFloat 1.0
let! phi = boundedFloat 1.0
return ((oX, oY, oZ), radius), theta, phi

View File

@@ -2,6 +2,7 @@ namespace RayTracing.Test
open NUnit.Framework
open FsCheck
open FsCheck.FSharp
open FsUnitTyped
open RayTracing
@@ -12,7 +13,7 @@ module TestSphereIntersection =
let sphere : Gen<Sphere> =
gen {
let! origin = TestUtils.pointGen
let! radius = Arb.generate<NormalFloat>
let! radius = ArbMap.defaults |> ArbMap.generate<NormalFloat>
return Sphere.make (SphereStyle.LightSource (Texture.Colour Colour.White)) origin radius.Get
}

View File

@@ -4,13 +4,12 @@ open RayTracing
open System.IO
open System.Reflection
open FsCheck
open FsCheck.FSharp
[<RequireQualifiedAccess>]
module TestUtils =
type Dummy =
class
end
type Dummy = class end
let getEmbeddedResource (filename : string) : string =
let filename =
@@ -23,14 +22,17 @@ module TestUtils =
use reader = new StreamReader (stream)
reader.ReadToEnd().Replace ("\r\n", "\n")
let floatGen = Arb.generate<NormalFloat> |> Gen.map NormalFloat.op_Explicit
let floatGen =
ArbMap.defaults
|> ArbMap.generate<NormalFloat>
|> Gen.map NormalFloat.op_Explicit
let pointGen =
Gen.three Arb.generate<NormalFloat>
Gen.three (ArbMap.defaults |> ArbMap.generate<NormalFloat>)
|> Gen.map (fun (i, j, k) -> Point.make i.Get j.Get k.Get)
let vectorGen =
Gen.three Arb.generate<NormalFloat>
Gen.three (ArbMap.defaults |> ArbMap.generate<NormalFloat>)
|> Gen.map (fun (i, j, k) -> Vector.make i.Get j.Get k.Get)
let unitVectorGen =

View File

@@ -1,5 +1,6 @@
namespace RayTracing
open System.Threading.Tasks
open RayTracing
[<Measure>]
@@ -8,7 +9,7 @@ type progress
type Image =
private
{
Rows : Pixel Async[] seq
Rows : Async<Pixel[]> seq
RowCount : int
ColCount : int
}
@@ -19,34 +20,10 @@ module Image =
let colCount i = i.ColCount
let render (i : Image) : (Pixel * Async<unit>)[] seq =
i.Rows
|> Seq.map (fun imageRow ->
if imageRow.Length <> i.ColCount then
failwithf
"Thought the image had %i columns, got a pixel array with %i columns"
i.ColCount
imageRow.Length
let render (i : Image) : Pixel[][] Task =
i.Rows |> Async.Parallel |> Async.StartAsTask
let outputRow = Array.zeroCreate<Pixel * Async<unit>> i.ColCount
let doIt =
imageRow
|> Array.mapi (fun i p ->
async {
let! pixel = p
let _, a = outputRow.[i]
outputRow.[i] <- pixel, a
}
)
for k in 0 .. i.ColCount - 1 do
outputRow.[k] <- Unchecked.defaultof<_>, doIt.[k]
outputRow
)
let make (rowCount : int) (colCount : int) (pixels : Async<Pixel>[] seq) : Image =
let make (rowCount : int) (colCount : int) (pixels : Async<Pixel[]> seq) : Image =
{
RowCount = rowCount
ColCount = colCount

View File

@@ -1,11 +1,8 @@
namespace RayTracing
namespace RayTracing
open System
open System.Collections.Generic
open System.Collections.Immutable
open System.IO
open System.IO.Abstractions
open System.Text
open System.Threading.Tasks
open SkiaSharp
@@ -68,13 +65,7 @@ module ImageOutput =
toRet
let readPixelMap
(incrementProgress : float<progress> -> unit)
(progress : IFileInfo)
(numRows : int)
(numCols : int)
: Async<Pixel ValueOption[][]>
=
let readPixelMap (progress : IFileInfo) (numRows : int) (numCols : int) : Async<Pixel ValueOption[][]> =
let rec go (dict : _[][]) (reader : Stream) =
let row = consumeAsciiInteger reader
@@ -104,8 +95,6 @@ module ImageOutput =
dict
else
incrementProgress 1.0<progress>
dict.[row].[col] <-
ValueSome
{
@@ -141,53 +130,35 @@ module ImageOutput =
let resume
(incrementProgress : float<progress> -> unit)
(soFar : IReadOnlyDictionary<int * int, Pixel>)
(image : Image)
(fs : IFileSystem)
: IFileInfo * Task<unit>
=
let tempFile = fs.Path.GetTempFileName () |> fs.FileInfo.FromFileName
let tempFile = fs.Path.GetTempFileName () |> fs.FileInfo.New
tempFile,
task {
use outputStream = tempFile.OpenWrite ()
use enumerator = image.Rows.GetEnumerator ()
let mutable rowNum = 0
let task =
async {
use outputStream = tempFile.OpenWrite ()
let! pixels = image.Rows |> Async.Parallel
while enumerator.MoveNext () do
let row = enumerator.Current
let! _ =
pixels
|> Array.iteri (fun rowNum row ->
row
|> Array.mapi (fun colNum pixel ->
backgroundTask {
let! pixel =
match soFar.TryGetValue ((rowNum, colNum)) with
| false, _ -> pixel
| true, v -> async { return v }
lock
outputStream
(fun () ->
writeAsciiInt outputStream rowNum
outputStream.WriteByte 44uy // ','
writeAsciiInt outputStream colNum
outputStream.WriteByte 10uy // '\n'
outputStream.WriteByte pixel.Red
outputStream.WriteByte pixel.Green
outputStream.WriteByte pixel.Blue
)
incrementProgress 1.0<progress>
return ()
}
|> Array.iteri (fun colNum pixel ->
writeAsciiInt outputStream rowNum
outputStream.WriteByte 44uy // ','
writeAsciiInt outputStream colNum
outputStream.WriteByte 10uy // '\n'
outputStream.WriteByte pixel.Red
outputStream.WriteByte pixel.Green
outputStream.WriteByte pixel.Blue
)
|> Task.WhenAll
rowNum <- rowNum + 1
}
incrementProgress 1.0<progress>
)
}
tempFile, Async.StartAsTask task
let writePpm
(gammaCorrect : bool)
@@ -237,7 +208,7 @@ module ImageOutput =
(fs : IFileSystem)
: IFileInfo * Task<unit>
=
resume progressIncrement ImmutableDictionary.Empty image fs
resume progressIncrement image fs
[<RequireQualifiedAccess>]
module Png =
@@ -264,10 +235,10 @@ module Png =
let colour = PixelOutput.toSkia gammaCorrect pixels.[row].[pixels.[row].Length - 1]
img.SetPixel (pixels.[row].Length - 1, row, colour)
incrementProgress 1.0<progress>
for row = 0 to pixels.Length - 2 do
writeRow row
incrementProgress 1.0<progress>
writeRow (pixels.Length - 1)

View File

@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="Float.fs" />
<Compile Include="Point.fs" />
<Compile Include="Pixel.fs" />
<Compile Include="Texture.fs" />
<Compile Include="Domain.fs" />
<Compile Include="Ray.fsi" />
<Compile Include="Ray.fs" />
<Compile Include="Plane.fs" />
<Compile Include="LightRay.fs" />
<Compile Include="BoundingBox.fs" />
<Compile Include="Sphere.fs" />
<Compile Include="InfinitePlane.fs" />
<Compile Include="ImageOutput.fs" />
<Compile Include="Camera.fs" />
<Compile Include="Hittable.fs" />
<Compile Include="BoundingBoxTree.fs" />
<Compile Include="Scene.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.IO.Abstractions" Version="13.2.28" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="Float.fs" />
<Compile Include="Point.fs" />
<Compile Include="Pixel.fs" />
<Compile Include="Texture.fs" />
<Compile Include="Domain.fs" />
<Compile Include="Ray.fsi" />
<Compile Include="Ray.fs" />
<Compile Include="Plane.fs" />
<Compile Include="LightRay.fs" />
<Compile Include="BoundingBox.fs" />
<Compile Include="Sphere.fs" />
<Compile Include="InfinitePlane.fs" />
<Compile Include="ImageOutput.fs" />
<Compile Include="Camera.fs" />
<Compile Include="Hittable.fs" />
<Compile Include="BoundingBoxTree.fs" />
<Compile Include="Scene.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.IO.Abstractions" Version="21.1.7" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
</ItemGroup>
</Project>

View File

@@ -208,26 +208,29 @@ module Scene =
let rowsIter = 2 * maxHeightCoord + 1
let colsIter = 2 * maxWidthCoord + 1
1.0<progress> * float (rowsIter * colsIter),
1.0<progress> * float rowsIter,
{
RowCount = rowsIter
ColCount = colsIter
Rows =
Array.init
Seq.init
rowsIter
(fun row ->
let row = maxHeightCoord - row - 1
Array.init
colsIter
(fun col ->
let col = col - maxWidthCoord
async {
let result =
Array.init
colsIter
(fun col ->
let col = col - maxWidthCoord
async {
let ret = renderPixel print s rand camera maxWidthCoord maxHeightCoord row col
progressIncrement 1.0<progress>
return ret
}
)
let ret = renderPixel print s rand camera maxWidthCoord maxHeightCoord row col
ret
)
progressIncrement 1.0<progress>
return result
}
)
}

30
flake.lock generated
View File

@@ -1,12 +1,15 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@@ -17,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1672350804,
"narHash": "sha256-jo6zkiCabUBn3ObuKXHGqqORUMH27gYDIFFfLq5P4wg=",
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "677ed08a50931e38382dbef01cba08a8f7eac8f6",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"type": "github"
},
"original": {
@@ -35,6 +38,21 @@
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@@ -5,7 +5,6 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
...
@@ -16,8 +15,8 @@
projectFile = "./RayTracing.App/RayTracing.App.fsproj";
testProjectFile = "./RayTracing.Test/RayTracing.Test.fsproj";
pname = "RayTracing";
dotnet-sdk = pkgs.dotnet-sdk_7;
dotnet-runtime = pkgs.dotnetCorePackages.runtime_7_0;
dotnet-sdk = pkgs.dotnet-sdk_8;
dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0;
version = "0.0.1";
dotnetTool = toolName: toolVersion: sha256:
pkgs.stdenvNoCC.mkDerivation rec {
@@ -39,41 +38,25 @@
'';
};
in {
packages = {
fantomas = dotnetTool "fantomas" "5.2.0-alpha-010" "sha256-CuoROZBBhaK0IFjbKNLvzgX4GXwuIybqIvCtuqROBMk=";
fetchDeps = let
flags = [];
runtimeIds = map (system: pkgs.dotnetCorePackages.systemToDotnetRid system) dotnet-sdk.meta.platforms;
in
pkgs.writeShellScript "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;
};
}));
packages = let
deps = builtins.fromJSON (builtins.readFile ./nix/deps.json);
in {
fantomas = dotnetTool "fantomas" (builtins.fromJSON (builtins.readFile ./.config/dotnet-tools.json)).tools.fantomas.version (builtins.head (builtins.filter (elem: elem.pname == "fantomas") deps)).hash;
default = pkgs.buildDotnetModule {
pname = pname;
version = version;
src = ./.;
projectFile = projectFile;
nugetDeps = ./nix/deps.nix;
testProjectFile = testProjectFile;
nugetDeps = ./nix/deps.json; # `nix build .#default.fetch-deps && ./result nix/deps.json`
doCheck = true;
dotnet-sdk = dotnet-sdk;
dotnet-runtime = dotnet-runtime;
};
};
devShells = let
in {
devShells = {
default = pkgs.mkShell {
buildInputs = [pkgs.dotnet-sdk_7 pkgs.git pkgs.alejandra pkgs.nodePackages.markdown-link-check];
buildInputs = [dotnet-sdk pkgs.git pkgs.alejandra pkgs.nodePackages.markdown-link-check];
};
};
}

102
nix/deps.json Normal file
View File

@@ -0,0 +1,102 @@
[
{
"pname": "fantomas",
"version": "6.3.15",
"hash": "sha256-Gjw7MxjUNckMWSfnOye4UTe5fZWnor6RHCls3PNsuG8="
},
{
"pname": "FsCheck",
"version": "3.0.0-rc3",
"hash": "sha256-4Z9Qv+vccrXWh2Fjdwdmjc1YgW+Dcx73ESkdAnHqxOY="
},
{
"pname": "FsUnit",
"version": "7.0.0",
"hash": "sha256-eoHwX2wPrmP8Wgq2v91tWJvQG+5v4iNYG5jMLPwKXNc="
},
{
"pname": "Microsoft.CodeCoverage",
"version": "17.12.0",
"hash": "sha256-lGjifppD0OBMBp28pjUfPipaeXg739n8cPhtHWoo5RE="
},
{
"pname": "Microsoft.NET.Test.Sdk",
"version": "17.12.0",
"hash": "sha256-DKFEbhh2wPzahNeHdEoFig8tZh/LEVrFc5+zpT43Btg="
},
{
"pname": "Microsoft.TestPlatform.ObjectModel",
"version": "17.12.0",
"hash": "sha256-3XBHBSuCxggAIlHXmKNQNlPqMqwFlM952Av6RrLw1/w="
},
{
"pname": "Microsoft.TestPlatform.TestHost",
"version": "17.12.0",
"hash": "sha256-rf8Sh0fQq44Sneuvs64unkkIHg8kOjDGWE35j9iLx5I="
},
{
"pname": "Newtonsoft.Json",
"version": "13.0.1",
"hash": "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo="
},
{
"pname": "NUnit",
"version": "4.3.1",
"hash": "sha256-7XWgjdgEll4gDLa4p9LpizH+bJzFMIvkQ/olpAXJvCE="
},
{
"pname": "NUnit3TestAdapter",
"version": "4.6.0",
"hash": "sha256-9Yav2fYhC4w0OgsyUwU4/5rDy4FVDTpKnWHuwl/uKJQ="
},
{
"pname": "SkiaSharp",
"version": "3.116.1",
"hash": "sha256-EQW/zjk+GsJbpJ3zqyGARh3oHep8XgneWXcSTNnYwuk="
},
{
"pname": "SkiaSharp.NativeAssets.macOS",
"version": "3.116.1",
"hash": "sha256-GntlOA+Blrh43l97gHP7sZl4HY0+Hx84xId3+YTXLCE="
},
{
"pname": "SkiaSharp.NativeAssets.Win32",
"version": "3.116.1",
"hash": "sha256-oraulwAja3vee2T2n9sEveSTVI8/Kvku7r09yXLENI4="
},
{
"pname": "Spectre.Console",
"version": "0.49.2-preview.0.9",
"hash": "sha256-rPi6HEAwVlr7CAv/Nf+O6ke3r+4AmvpNvv5zhhxIEdA="
},
{
"pname": "System.IO.Abstractions",
"version": "21.1.7",
"hash": "sha256-f5VSR/MlQ/uXfQvj1533qV6nrlIeaoCmSC1VHfMTOGk="
},
{
"pname": "System.IO.Abstractions.TestingHelpers",
"version": "21.1.7",
"hash": "sha256-0va3hVh1qaKtgvtUHq0PSkq2BgAdeJndVA5i8k7jq+A="
},
{
"pname": "System.Reflection.Metadata",
"version": "1.6.0",
"hash": "sha256-JJfgaPav7UfEh4yRAQdGhLZF1brr0tUWPl6qmfNWq/E="
},
{
"pname": "TestableIO.System.IO.Abstractions",
"version": "21.1.7",
"hash": "sha256-EX5bkC9IW045vCdnl9UjjwyUtL99P8jTqkdXYEs0czI="
},
{
"pname": "TestableIO.System.IO.Abstractions.TestingHelpers",
"version": "21.1.7",
"hash": "sha256-68506JkB2MtKp3heaSrIocp/t+6EDZdXFSdsq+IA+es="
},
{
"pname": "TestableIO.System.IO.Abstractions.Wrappers",
"version": "21.1.7",
"hash": "sha256-sYF7wt6vTed2B62BJzzHw+7ySyDplFD+cTJjL5MlLig="
}
]

View File

@@ -1,409 +0,0 @@
# This file was automatically generated by passthru.fetch-deps.
# Please don't edit it manually, your changes might get overwritten!
{fetchNuGet}: [
(fetchNuGet {
pname = "FsCheck";
version = "3.0.0-alpha5";
sha256 = "0qzj81iki8n0k7c63g36cagcfrriaw5g0bpgnn66whp925i392x7";
})
(fetchNuGet {
pname = "FSharp.Core";
version = "7.0.0";
sha256 = "1pgk3qk9p1s53wvja17744x4bf7zs3a3wf0dmxi66w1w06z7i85x";
})
(fetchNuGet {
pname = "FsUnit";
version = "4.0.4";
sha256 = "19fpbl874klvq3bd5vnryj2zn3c7ivwfyk16hakbrxw6qwb64gpn";
})
(fetchNuGet {
pname = "Microsoft.CodeCoverage";
version = "16.8.0";
sha256 = "1y05sjk7wgd29a47v1yhn2s1lrd8wgazkilvmjbvivmrrm3fqjs8";
})
(fetchNuGet {
pname = "Microsoft.CSharp";
version = "4.0.1";
sha256 = "0zxc0apx1gcx361jlq8smc9pfdgmyjh6hpka8dypc9w23nlsh6yj";
})
(fetchNuGet {
pname = "Microsoft.NET.Test.Sdk";
version = "16.8.0";
sha256 = "1ln2mva7j2mpsj9rdhpk8vhm3pgd8wn563xqdcwd38avnhp74rm9";
})
(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.Platforms";
version = "5.0.0";
sha256 = "0mwpwdflidzgzfx2dlpkvvnkgkr2ayaf0s80737h4wa35gaj11rc";
})
(fetchNuGet {
pname = "Microsoft.NETCore.Platforms";
version = "6.0.0-preview.3.21201.4";
sha256 = "09qznsrkx60j17adp6rzgxcb9k2a04bl06lni4xz7rlpg2k1qry7";
})
(fetchNuGet {
pname = "Microsoft.NETCore.Targets";
version = "1.0.1";
sha256 = "0ppdkwy6s9p7x9jix3v4402wb171cdiibq7js7i13nxpdky7074p";
})
(fetchNuGet {
pname = "Microsoft.TestPlatform.ObjectModel";
version = "16.8.0";
sha256 = "0ii9d88py6mjsxzj9v3zx4izh6rb9ma6s9kj85xmc0xrw7jc2g3m";
})
(fetchNuGet {
pname = "Microsoft.TestPlatform.TestHost";
version = "16.8.0";
sha256 = "1rh8cga1km3jfafkwfjr0dwqrxb4306hf7fipwba9h02w7vlhb9a";
})
(fetchNuGet {
pname = "Microsoft.Win32.SystemEvents";
version = "6.0.0-preview.3.21201.4";
sha256 = "1mqhif4b7524c1gjk0md10gyg2mn30fjzcd0v33crin4xfl6ppcz";
})
(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.0.0";
sha256 = "18ijvmj13cwjdrrm52c8fpq021531zaz4mj4b4zapxaqzzxf2qjr";
})
(fetchNuGet {
pname = "NUnit";
version = "3.13.1";
sha256 = "07156gr0yl9rqhyj44cp1xz9jpngbl5kb7ci3qfy9fcp01dczmm9";
})
(fetchNuGet {
pname = "NUnit3TestAdapter";
version = "4.0.0-beta.1";
sha256 = "1dia3bpbsjwq5z18v4jvx7hcz8yldym84nssgigw6m2r76iwx94j";
})
(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 = "Spectre.Console";
version = "0.38.1-preview.0.17";
sha256 = "0jfr0dp3ry7s1hdd9qnk1yagb0ydv85kl9vnw99s1apwmcxaw1xw";
})
(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.Drawing.Common";
version = "6.0.0-preview.3.21201.4";
sha256 = "1dx6s1s4xwaya6da49xa30n1sbzgs73fwiwh70jdr67q3iy4zcr5";
})
(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.Abstractions";
version = "13.2.28";
sha256 = "1jcjvpyw88xkiii9qh5f7mlvp5f6v3dsj7rhw7msjwv2bp001d24";
})
(fetchNuGet {
pname = "System.IO.Abstractions.TestingHelpers";
version = "13.2.28";
sha256 = "055pa7xv2nr7nrm9hsxfgakcc62hi6iivg30xqkkkmsldjqr29ip";
})
(fetchNuGet {
pname = "System.IO.FileSystem";
version = "4.0.1";
sha256 = "0kgfpw6w4djqra3w5crrg8xivbanh1w9dh3qapb28q060wb9flp1";
})
(fetchNuGet {
pname = "System.IO.FileSystem.AccessControl";
version = "5.0.0";
sha256 = "0ixl68plva0fsj3byv76bai7vkin86s6wyzr8vcav3szl862blvk";
})
(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.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.Security.AccessControl";
version = "5.0.0";
sha256 = "17n3lrrl6vahkqmhlpn3w20afgz09n7i6rv0r3qypngwi7wqdr5r";
})
(fetchNuGet {
pname = "System.Security.Principal.Windows";
version = "5.0.0";
sha256 = "1mpk7xj76lxgz97a5yg93wi8lj0l8p157a5d50mmjy3gbz1904q8";
})
(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";
})
(fetchNuGet {
pname = "Wcwidth";
version = "0.2.0";
sha256 = "0p7zaisix9ql4v5nyl9gfc93xcyj74j01rwvgm7jw29js3wlj10s";
})
]

View File

@@ -1,73 +0,0 @@
#!/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 didnt succesfully 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 by passthru.fetch-deps.\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"