From 5ae9b62df368f6f92341e486e1ef5d1cca2bb58d Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sat, 27 Sep 2025 19:27:20 +0200 Subject: [PATCH 1/7] wip backend package --- .gitignore | 2 +- .gitmodules | 7 +- flake.nix | 39 +- tanks-backend/TanksServer.sln | 38 +- tanks-backend/deps.json | 532 ++++++++++++++++++++++ tanks-backend/gen-deps.sh | 6 + tanks-backend/servicepoint | 1 - tanks-backend/servicepoint-binding-csharp | 1 + 8 files changed, 591 insertions(+), 35 deletions(-) create mode 100644 tanks-backend/deps.json create mode 100644 tanks-backend/gen-deps.sh delete mode 160000 tanks-backend/servicepoint create mode 160000 tanks-backend/servicepoint-binding-csharp diff --git a/.gitignore b/.gitignore index ba7a367..7bdaff4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ obj client *.sarif .direnv - +out diff --git a/.gitmodules b/.gitmodules index f855dce..0715eea 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ -[submodule "tanks-backend/servicepoint"] - path = tanks-backend/servicepoint - url = https://github.com/cccb/servicepoint.git +[submodule "tanks-backend/servicepoint-binding-csharp"] + path = tanks-backend/servicepoint-binding-csharp + url = https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git + branch = main diff --git a/flake.nix b/flake.nix index 6eaf798..e433a00 100644 --- a/flake.nix +++ b/flake.nix @@ -32,13 +32,22 @@ selfPkgs, ... }: - { - frontend = pkgs.mkShell { + let + frontend-set = { inputsFrom = [ selfPkgs.servicepoint-tanks-frontend ]; }; - default = import ./shell.nix { - inherit pkgs lib; + backend-set = { + inputsFrom = [ selfPkgs.servicepoint-tanks-backend ]; + packages = with pkgs; [ + nuget-to-json + cargo-tarpaulin + ]; }; + in + { + frontend = pkgs.mkShell frontend-set; + backend = pkgs.mkShell backend-set; + default = pkgs.mkShell (frontend-set // backend-set); } ); @@ -50,13 +59,33 @@ version = "0.0.0"; src = ./tank-frontend; - npmDepsHash = "sha256-HvwoSeKHBDkM/5OHDkgSOxfHx1gbnKif/3QfDb6r5mE="; installPhase = '' cp -rv dist/ $out ''; }); + + servicepoint-tanks-backend = pkgs.buildDotnetModule { + pname = "servicepoint-tanks-backend"; + version = "0.0.0"; + + dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0; + dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0; + + src = ./tanks-backend; + projectFile = "TanksServer.sln"; + nugetDeps = ./tanks-backend/deps.json; + selfContainedBuild = true; + + nativeBuildInputs = with pkgs; [ + pkg-config + xe + xz + gnumake + iconv + ]; + }; } ); diff --git a/tanks-backend/TanksServer.sln b/tanks-backend/TanksServer.sln index 9c43f9a..b2605ae 100644 --- a/tanks-backend/TanksServer.sln +++ b/tanks-backend/TanksServer.sln @@ -10,19 +10,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{12DB7D ..\.envrc = ..\.envrc EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "servicepoint", "servicepoint", "{A10FB29A-9078-4E90-9CE1-E6C2B5209E19}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "servicepoint-binding-csharp", "servicepoint-binding-csharp", "{919DCD05-B92D-48A6-BB1F-8ABD460BD788}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "crates", "crates", "{656A7CBA-9445-41CC-B1AF-A6897AAC9F17}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "servicepoint-binding-csharp\ServicePoint\ServicePoint.csproj", "{3C856AD4-DBC6-419D-8373-9D99A2E2AA04}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "servicepoint_binding_uniffi", "servicepoint_binding_uniffi", "{5FD9FAD7-07BA-4DF9-8C84-15A9558373F1}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{6082A0DC-5345-48C8-BA2E-667754A2F0E9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "csharp", "csharp", "{D8A3290B-5DFB-43C6-99EE-56AB5F53F468}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint", "servicepoint\crates\servicepoint_binding_uniffi\libraries\csharp\ServicePoint\ServicePoint.csproj", "{D1DDCD0D-6152-45E6-B673-DD78C466BDC3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint.Tests", "servicepoint\crates\servicepoint_binding_uniffi\libraries\csharp\ServicePoint.Tests\ServicePoint.Tests.csproj", "{EF42D6B7-70B1-490B-BB5F-5A44D1309A7C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServicePoint.Tests", "servicepoint-binding-csharp\ServicePoint.Tests\ServicePoint.Tests.csproj", "{D0B09E1D-B20F-4883-8D32-5E5420224CC3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,21 +26,17 @@ Global {D88BF376-47A4-4C72-ADD1-983F9285C351}.Debug|Any CPU.Build.0 = Debug|Any CPU {D88BF376-47A4-4C72-ADD1-983F9285C351}.Release|Any CPU.ActiveCfg = Release|Any CPU {D88BF376-47A4-4C72-ADD1-983F9285C351}.Release|Any CPU.Build.0 = Release|Any CPU - {D1DDCD0D-6152-45E6-B673-DD78C466BDC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D1DDCD0D-6152-45E6-B673-DD78C466BDC3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D1DDCD0D-6152-45E6-B673-DD78C466BDC3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D1DDCD0D-6152-45E6-B673-DD78C466BDC3}.Release|Any CPU.Build.0 = Release|Any CPU - {EF42D6B7-70B1-490B-BB5F-5A44D1309A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EF42D6B7-70B1-490B-BB5F-5A44D1309A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EF42D6B7-70B1-490B-BB5F-5A44D1309A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EF42D6B7-70B1-490B-BB5F-5A44D1309A7C}.Release|Any CPU.Build.0 = Release|Any CPU + {3C856AD4-DBC6-419D-8373-9D99A2E2AA04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C856AD4-DBC6-419D-8373-9D99A2E2AA04}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C856AD4-DBC6-419D-8373-9D99A2E2AA04}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C856AD4-DBC6-419D-8373-9D99A2E2AA04}.Release|Any CPU.Build.0 = Release|Any CPU + {D0B09E1D-B20F-4883-8D32-5E5420224CC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0B09E1D-B20F-4883-8D32-5E5420224CC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0B09E1D-B20F-4883-8D32-5E5420224CC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0B09E1D-B20F-4883-8D32-5E5420224CC3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution - {656A7CBA-9445-41CC-B1AF-A6897AAC9F17} = {A10FB29A-9078-4E90-9CE1-E6C2B5209E19} - {5FD9FAD7-07BA-4DF9-8C84-15A9558373F1} = {656A7CBA-9445-41CC-B1AF-A6897AAC9F17} - {6082A0DC-5345-48C8-BA2E-667754A2F0E9} = {5FD9FAD7-07BA-4DF9-8C84-15A9558373F1} - {D8A3290B-5DFB-43C6-99EE-56AB5F53F468} = {6082A0DC-5345-48C8-BA2E-667754A2F0E9} - {D1DDCD0D-6152-45E6-B673-DD78C466BDC3} = {D8A3290B-5DFB-43C6-99EE-56AB5F53F468} - {EF42D6B7-70B1-490B-BB5F-5A44D1309A7C} = {D8A3290B-5DFB-43C6-99EE-56AB5F53F468} + {3C856AD4-DBC6-419D-8373-9D99A2E2AA04} = {919DCD05-B92D-48A6-BB1F-8ABD460BD788} + {D0B09E1D-B20F-4883-8D32-5E5420224CC3} = {919DCD05-B92D-48A6-BB1F-8ABD460BD788} EndGlobalSection EndGlobal diff --git a/tanks-backend/deps.json b/tanks-backend/deps.json new file mode 100644 index 0000000..4a8ff5d --- /dev/null +++ b/tanks-backend/deps.json @@ -0,0 +1,532 @@ +[ + { + "pname": "coverlet.collector", + "version": "6.0.0", + "hash": "sha256-IEmweTMapcPhFHpmJsPXfmMhravYOrWupgjeOvMmQ4o=" + }, + { + "pname": "DotNext", + "version": "5.3.0", + "hash": "sha256-q+VOteFEYhqkndjZq08ZGNlbR/SIqj/mwkAythFCo+c=" + }, + { + "pname": "DotNext.Threading", + "version": "5.3.0", + "hash": "sha256-P8ITHieqi7fZSKJsyQNm0iusf9J1c+dmeiXLFrtr+d8=" + }, + { + "pname": "Microsoft.Build.Tasks.Git", + "version": "8.0.0", + "hash": "sha256-vX6/kPij8vNAu8f7rrvHHhPrNph20IcufmrBgZNxpQA=" + }, + { + "pname": "Microsoft.CodeCoverage", + "version": "17.8.0", + "hash": "sha256-cv/wAXfTNS+RWEsHWNKqRDHC7LOQSSdFJ1a9cZuSfJw=" + }, + { + "pname": "Microsoft.DotNet.ILCompiler", + "version": "8.0.20", + "hash": "sha256-972D4TBkIWS1RY3rrB+znz7KuUGt/dDU16UWjZBJ9JU=" + }, + { + "pname": "Microsoft.Extensions.Configuration.Abstractions", + "version": "8.0.0", + "hash": "sha256-4eBpDkf7MJozTZnOwQvwcfgRKQGcNXe0K/kF+h5Rl8o=" + }, + { + "pname": "Microsoft.Extensions.Configuration.Binder", + "version": "8.0.0", + "hash": "sha256-GanfInGzzoN2bKeNwON8/Hnamr6l7RTpYLA49CNXD9Q=" + }, + { + "pname": "Microsoft.Extensions.DependencyInjection.Abstractions", + "version": "8.0.0", + "hash": "sha256-75KzEGWjbRELczJpCiJub+ltNUMMbz5A/1KQU+5dgP8=" + }, + { + "pname": "Microsoft.Extensions.Options", + "version": "8.0.0", + "hash": "sha256-n2m4JSegQKUTlOsKLZUUHHKMq926eJ0w9N9G+I3FoFw=" + }, + { + "pname": "Microsoft.Extensions.Options.ConfigurationExtensions", + "version": "8.0.0", + "hash": "sha256-A5Bbzw1kiNkgirk5x8kyxwg9lLTcSngojeD+ocpG1RI=" + }, + { + "pname": "Microsoft.Extensions.Primitives", + "version": "8.0.0", + "hash": "sha256-FU8qj3DR8bDdc1c+WeGZx/PCZeqqndweZM9epcpXjSo=" + }, + { + "pname": "Microsoft.NET.ILLink.Tasks", + "version": "8.0.20", + "hash": "sha256-nNI9Dc5fLi8VOBLN/tdpVtHVyaKYkwuga+Ew3NcBw6s=" + }, + { + "pname": "Microsoft.NET.Test.Sdk", + "version": "17.8.0", + "hash": "sha256-uz7QvW+NsVRsp8FR1wjnGEOkUaPX4JyieywvCN6g2+s=" + }, + { + "pname": "Microsoft.NETCore.Platforms", + "version": "1.1.0", + "hash": "sha256-FeM40ktcObQJk4nMYShB61H/E8B7tIKfl9ObJ0IOcCM=" + }, + { + "pname": "Microsoft.NETCore.Targets", + "version": "1.1.0", + "hash": "sha256-0AqQ2gMS8iNlYkrD+BxtIg7cXMnr9xZHtKAuN4bjfaQ=" + }, + { + "pname": "Microsoft.SourceLink.Common", + "version": "8.0.0", + "hash": "sha256-AfUqleVEqWuHE7z2hNiwOLnquBJ3tuYtbkdGMppHOXc=" + }, + { + "pname": "Microsoft.SourceLink.GitHub", + "version": "8.0.0", + "hash": "sha256-hNTkpKdCLY5kIuOmznD1mY+pRdJ0PKu2HypyXog9vb0=" + }, + { + "pname": "Microsoft.TestPlatform.ObjectModel", + "version": "17.8.0", + "hash": "sha256-9TwGrjVvbtyetw67Udp3EMK5MX8j0RFRjduxPCs9ESw=" + }, + { + "pname": "Microsoft.TestPlatform.TestHost", + "version": "17.8.0", + "hash": "sha256-+CTYFu631uovLCO47RKe86YaAqfoLA4r73vKORJUsjg=" + }, + { + "pname": "Microsoft.Win32.Primitives", + "version": "4.3.0", + "hash": "sha256-mBNDmPXNTW54XLnPAUwBRvkIORFM7/j0D0I2SyQPDEg=" + }, + { + "pname": "NETStandard.Library", + "version": "1.6.1", + "hash": "sha256-iNan1ix7RtncGWC9AjAZ2sk70DoxOsmEOgQ10fXm4Pw=" + }, + { + "pname": "Newtonsoft.Json", + "version": "13.0.1", + "hash": "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo=" + }, + { + "pname": "NuGet.Frameworks", + "version": "6.5.0", + "hash": "sha256-ElqfN4CcKxT3hP2qvxxObb4mnBlYG89IMxO0Sm5oZ2g=" + }, + { + "pname": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-LXUPLX3DJxsU1Pd3UwjO1PO9NM2elNEDXeu2Mu/vNps=" + }, + { + "pname": "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-qeSqaUI80+lqw5MK4vMpmO0CZaqrmYktwp6L+vQAb0I=" + }, + { + "pname": "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-SrHqT9wrCBsxILWtaJgGKd6Odmxm8/Mh7Kh0CUkZVzA=" + }, + { + "pname": "runtime.linux-x64.Microsoft.DotNet.ILCompiler", + "version": "8.0.20", + "hash": "sha256-cxVwgQnkp9Ynfv4Ly2EKEHGdzK3czRPi4JIYycFd2T4=" + }, + { + "pname": "runtime.native.System", + "version": "4.3.0", + "hash": "sha256-ZBZaodnjvLXATWpXXakFgcy6P+gjhshFXmglrL5xD5Y=" + }, + { + "pname": "runtime.native.System.IO.Compression", + "version": "4.3.0", + "hash": "sha256-DWnXs4vlKoU6WxxvCArTJupV6sX3iBbZh8SbqfHace8=" + }, + { + "pname": "runtime.native.System.Net.Http", + "version": "4.3.0", + "hash": "sha256-c556PyheRwpYhweBjSfIwEyZHnAUB8jWioyKEcp/2dg=" + }, + { + "pname": "runtime.native.System.Security.Cryptography.Apple", + "version": "4.3.0", + "hash": "sha256-2IhBv0i6pTcOyr8FFIyfPEaaCHUmJZ8DYwLUwJ+5waw=" + }, + { + "pname": "runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-Jy01KhtcCl2wjMpZWH+X3fhHcVn+SyllWFY8zWlz/6I=" + }, + { + "pname": "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-wyv00gdlqf8ckxEdV7E+Ql9hJIoPcmYEuyeWb5Oz3mM=" + }, + { + "pname": "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-zi+b4sCFrA9QBiSGDD7xPV27r3iHGlV99gpyVUjRmc4=" + }, + { + "pname": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple", + "version": "4.3.0", + "hash": "sha256-serkd4A7F6eciPiPJtUyJyxzdAtupEcWIZQ9nptEzIM=" + }, + { + "pname": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-gybQU6mPgaWV3rBG2dbH6tT3tBq8mgze3PROdsuWnX0=" + }, + { + "pname": "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-VsP72GVveWnGUvS/vjOQLv1U80H2K8nZ4fDAmI61Hm4=" + }, + { + "pname": "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-4yKGa/IrNCKuQ3zaDzILdNPD32bNdy6xr5gdJigyF5g=" + }, + { + "pname": "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-HmdJhhRsiVoOOCcUvAwdjpMRiyuSwdcgEv2j9hxi+Zc=" + }, + { + "pname": "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-pVFUKuPPIx0edQKjzRon3zKq8zhzHEzko/lc01V/jdw=" + }, + { + "pname": "SixLabors.ImageSharp", + "version": "3.1.5", + "hash": "sha256-3UehX9T+I81nfgv2dTHlpoPgYzXFk7kHr1mmlQOCBfw=" + }, + { + "pname": "System.AppContext", + "version": "4.3.0", + "hash": "sha256-yg95LNQOwFlA1tWxXdQkVyJqT4AnoDc+ACmrNvzGiZg=" + }, + { + "pname": "System.Buffers", + "version": "4.3.0", + "hash": "sha256-XqZWb4Kd04960h4U9seivjKseGA/YEIpdplfHYHQ9jk=" + }, + { + "pname": "System.Collections", + "version": "4.3.0", + "hash": "sha256-afY7VUtD6w/5mYqrce8kQrvDIfS2GXDINDh73IjxJKc=" + }, + { + "pname": "System.Collections.Concurrent", + "version": "4.3.0", + "hash": "sha256-KMY5DfJnDeIsa13DpqvyN8NkReZEMAFnlmNglVoFIXI=" + }, + { + "pname": "System.Console", + "version": "4.3.0", + "hash": "sha256-Xh3PPBZr0pDbDaK8AEHbdGz7ePK6Yi1ZyRWI1JM6mbo=" + }, + { + "pname": "System.Diagnostics.Debug", + "version": "4.3.0", + "hash": "sha256-fkA79SjPbSeiEcrbbUsb70u9B7wqbsdM9s1LnoKj0gM=" + }, + { + "pname": "System.Diagnostics.DiagnosticSource", + "version": "4.3.0", + "hash": "sha256-OFJRb0ygep0Z3yDBLwAgM/Tkfs4JCDtsNhwDH9cd1Xw=" + }, + { + "pname": "System.Diagnostics.Tools", + "version": "4.3.0", + "hash": "sha256-gVOv1SK6Ape0FQhCVlNOd9cvQKBvMxRX9K0JPVi8w0Y=" + }, + { + "pname": "System.Diagnostics.Tracing", + "version": "4.3.0", + "hash": "sha256-hCETZpHHGVhPYvb4C0fh4zs+8zv4GPoixagkLZjpa9Q=" + }, + { + "pname": "System.Globalization", + "version": "4.3.0", + "hash": "sha256-caL0pRmFSEsaoeZeWN5BTQtGrAtaQPwFi8YOZPZG5rI=" + }, + { + "pname": "System.Globalization.Calendars", + "version": "4.3.0", + "hash": "sha256-uNOD0EOVFgnS2fMKvMiEtI9aOw00+Pfy/H+qucAQlPc=" + }, + { + "pname": "System.Globalization.Extensions", + "version": "4.3.0", + "hash": "sha256-mmJWA27T0GRVuFP9/sj+4TrR4GJWrzNIk2PDrbr7RQk=" + }, + { + "pname": "System.IO", + "version": "4.3.0", + "hash": "sha256-ruynQHekFP5wPrDiVyhNiRIXeZ/I9NpjK5pU+HPDiRY=" + }, + { + "pname": "System.IO.Compression", + "version": "4.3.0", + "hash": "sha256-f5PrQlQgj5Xj2ZnHxXW8XiOivaBvfqDao9Sb6AVinyA=" + }, + { + "pname": "System.IO.Compression.ZipFile", + "version": "4.3.0", + "hash": "sha256-WQl+JgWs+GaRMeiahTFUbrhlXIHapzcpTFXbRvAtvvs=" + }, + { + "pname": "System.IO.FileSystem", + "version": "4.3.0", + "hash": "sha256-vNIYnvlayuVj0WfRfYKpDrhDptlhp1pN8CYmlVd2TXw=" + }, + { + "pname": "System.IO.FileSystem.Primitives", + "version": "4.3.0", + "hash": "sha256-LMnfg8Vwavs9cMnq9nNH8IWtAtSfk0/Fy4s4Rt9r1kg=" + }, + { + "pname": "System.IO.Hashing", + "version": "8.0.0", + "hash": "sha256-szOGt0TNBo6dEdC3gf6H+e9YW3Nw0woa6UnCGGGK5cE=" + }, + { + "pname": "System.Linq", + "version": "4.3.0", + "hash": "sha256-R5uiSL3l6a3XrXSSL6jz+q/PcyVQzEAByiuXZNSqD/A=" + }, + { + "pname": "System.Linq.Expressions", + "version": "4.3.0", + "hash": "sha256-+3pvhZY7rip8HCbfdULzjlC9FPZFpYoQxhkcuFm2wk8=" + }, + { + "pname": "System.Net.Http", + "version": "4.3.0", + "hash": "sha256-UoBB7WPDp2Bne/fwxKF0nE8grJ6FzTMXdT/jfsphj8Q=" + }, + { + "pname": "System.Net.Primitives", + "version": "4.3.0", + "hash": "sha256-MY7Z6vOtFMbEKaLW9nOSZeAjcWpwCtdO7/W1mkGZBzE=" + }, + { + "pname": "System.Net.Sockets", + "version": "4.3.0", + "hash": "sha256-il7dr5VT/QWDg/0cuh+4Es2u8LY//+qqiY9BZmYxSus=" + }, + { + "pname": "System.ObjectModel", + "version": "4.3.0", + "hash": "sha256-gtmRkWP2Kwr3nHtDh0yYtce38z1wrGzb6fjm4v8wN6Q=" + }, + { + "pname": "System.Reflection", + "version": "4.3.0", + "hash": "sha256-NQSZRpZLvtPWDlvmMIdGxcVuyUnw92ZURo0hXsEshXY=" + }, + { + "pname": "System.Reflection.Emit", + "version": "4.3.0", + "hash": "sha256-5LhkDmhy2FkSxulXR+bsTtMzdU3VyyuZzsxp7/DwyIU=" + }, + { + "pname": "System.Reflection.Emit.ILGeneration", + "version": "4.3.0", + "hash": "sha256-mKRknEHNls4gkRwrEgi39B+vSaAz/Gt3IALtS98xNnA=" + }, + { + "pname": "System.Reflection.Emit.Lightweight", + "version": "4.3.0", + "hash": "sha256-rKx4a9yZKcajloSZHr4CKTVJ6Vjh95ni+zszPxWjh2I=" + }, + { + "pname": "System.Reflection.Extensions", + "version": "4.3.0", + "hash": "sha256-mMOCYzUenjd4rWIfq7zIX9PFYk/daUyF0A8l1hbydAk=" + }, + { + "pname": "System.Reflection.Metadata", + "version": "1.6.0", + "hash": "sha256-JJfgaPav7UfEh4yRAQdGhLZF1brr0tUWPl6qmfNWq/E=" + }, + { + "pname": "System.Reflection.Primitives", + "version": "4.3.0", + "hash": "sha256-5ogwWB4vlQTl3jjk1xjniG2ozbFIjZTL9ug0usZQuBM=" + }, + { + "pname": "System.Reflection.TypeExtensions", + "version": "4.3.0", + "hash": "sha256-4U4/XNQAnddgQIHIJq3P2T80hN0oPdU2uCeghsDTWng=" + }, + { + "pname": "System.Resources.ResourceManager", + "version": "4.3.0", + "hash": "sha256-idiOD93xbbrbwwSnD4mORA9RYi/D/U48eRUsn/WnWGo=" + }, + { + "pname": "System.Runtime", + "version": "4.3.0", + "hash": "sha256-51813WXpBIsuA6fUtE5XaRQjcWdQ2/lmEokJt97u0Rg=" + }, + { + "pname": "System.Runtime.Extensions", + "version": "4.3.0", + "hash": "sha256-wLDHmozr84v1W2zYCWYxxj0FR0JDYHSVRaRuDm0bd/o=" + }, + { + "pname": "System.Runtime.Handles", + "version": "4.3.0", + "hash": "sha256-KJ5aXoGpB56Y6+iepBkdpx/AfaJDAitx4vrkLqR7gms=" + }, + { + "pname": "System.Runtime.InteropServices", + "version": "4.3.0", + "hash": "sha256-8sDH+WUJfCR+7e4nfpftj/+lstEiZixWUBueR2zmHgI=" + }, + { + "pname": "System.Runtime.InteropServices.RuntimeInformation", + "version": "4.3.0", + "hash": "sha256-MYpl6/ZyC6hjmzWRIe+iDoldOMW1mfbwXsduAnXIKGA=" + }, + { + "pname": "System.Runtime.Numerics", + "version": "4.3.0", + "hash": "sha256-P5jHCgMbgFMYiONvzmaKFeOqcAIDPu/U8bOVrNPYKqc=" + }, + { + "pname": "System.Security.Cryptography.Algorithms", + "version": "4.3.0", + "hash": "sha256-tAJvNSlczYBJ3Ed24Ae27a55tq/n4D3fubNQdwcKWA8=" + }, + { + "pname": "System.Security.Cryptography.Cng", + "version": "4.3.0", + "hash": "sha256-u17vy6wNhqok91SrVLno2M1EzLHZm6VMca85xbVChsw=" + }, + { + "pname": "System.Security.Cryptography.Csp", + "version": "4.3.0", + "hash": "sha256-oefdTU/Z2PWU9nlat8uiRDGq/PGZoSPRgkML11pmvPQ=" + }, + { + "pname": "System.Security.Cryptography.Encoding", + "version": "4.3.0", + "hash": "sha256-Yuge89N6M+NcblcvXMeyHZ6kZDfwBv3LPMDiF8HhJss=" + }, + { + "pname": "System.Security.Cryptography.OpenSsl", + "version": "4.3.0", + "hash": "sha256-DL+D2sc2JrQiB4oAcUggTFyD8w3aLEjJfod5JPe+Oz4=" + }, + { + "pname": "System.Security.Cryptography.Primitives", + "version": "4.3.0", + "hash": "sha256-fnFi7B3SnVj5a+BbgXnbjnGNvWrCEU6Hp/wjsjWz318=" + }, + { + "pname": "System.Security.Cryptography.X509Certificates", + "version": "4.3.0", + "hash": "sha256-MG3V/owDh273GCUPsGGraNwaVpcydupl3EtPXj6TVG0=" + }, + { + "pname": "System.Text.Encoding", + "version": "4.3.0", + "hash": "sha256-GctHVGLZAa/rqkBNhsBGnsiWdKyv6VDubYpGkuOkBLg=" + }, + { + "pname": "System.Text.Encoding.Extensions", + "version": "4.3.0", + "hash": "sha256-vufHXg8QAKxHlujPHHcrtGwAqFmsCD6HKjfDAiHyAYc=" + }, + { + "pname": "System.Text.RegularExpressions", + "version": "4.3.0", + "hash": "sha256-VLCk1D1kcN2wbAe3d0YQM/PqCsPHOuqlBY1yd2Yo+K0=" + }, + { + "pname": "System.Threading", + "version": "4.3.0", + "hash": "sha256-ZDQ3dR4pzVwmaqBg4hacZaVenQ/3yAF/uV7BXZXjiWc=" + }, + { + "pname": "System.Threading.Channels", + "version": "8.0.0", + "hash": "sha256-c5TYoLNXDLroLIPnlfyMHk7nZ70QAckc/c7V199YChg=" + }, + { + "pname": "System.Threading.Tasks", + "version": "4.3.0", + "hash": "sha256-Z5rXfJ1EXp3G32IKZGiZ6koMjRu0n8C1NGrwpdIen4w=" + }, + { + "pname": "System.Threading.Tasks.Extensions", + "version": "4.3.0", + "hash": "sha256-X2hQ5j+fxcmnm88Le/kSavjiGOmkcumBGTZKBLvorPc=" + }, + { + "pname": "System.Threading.Timer", + "version": "4.3.0", + "hash": "sha256-pmhslmhQhP32TWbBzoITLZ4BoORBqYk25OWbru04p9s=" + }, + { + "pname": "System.Xml.ReaderWriter", + "version": "4.3.0", + "hash": "sha256-QQ8KgU0lu4F5Unh+TbechO//zaAGZ4MfgvW72Cn1hzA=" + }, + { + "pname": "System.Xml.XDocument", + "version": "4.3.0", + "hash": "sha256-rWtdcmcuElNOSzCehflyKwHkDRpiOhJJs8CeQ0l1CCI=" + }, + { + "pname": "xunit", + "version": "2.5.3", + "hash": "sha256-X4TkN9y/572LnqOX+fiX6dqsqKe/HbAWZq6PhdD0qGM=" + }, + { + "pname": "xunit.abstractions", + "version": "2.0.3", + "hash": "sha256-0D1y/C34iARI96gb3bAOG8tcGPMjx+fMabTPpydGlAM=" + }, + { + "pname": "xunit.analyzers", + "version": "1.4.0", + "hash": "sha256-2m8ikSNvEzQ53rtqhruTpQZpJ+nzI9lhLj0x9w5FKO0=" + }, + { + "pname": "xunit.assert", + "version": "2.5.3", + "hash": "sha256-+cbNHWwm1no316xMJsdzO7TAV7bIlm3dz8dvKHQ66CU=" + }, + { + "pname": "xunit.core", + "version": "2.5.3", + "hash": "sha256-TEL6tBUxWDU9rVOj4KaxBpL+uZQ/3kcZWVDDueeQkhw=" + }, + { + "pname": "xunit.extensibility.core", + "version": "2.5.3", + "hash": "sha256-IjyXgVi/AAnilPsD4IrnqtSrr7Ugu75DguPnI2bVSFs=" + }, + { + "pname": "xunit.extensibility.execution", + "version": "2.5.3", + "hash": "sha256-zN7R4kZGsujpo8aAn4OHdtA0u/r5aeiZaw6A53B69KU=" + }, + { + "pname": "xunit.runner.visualstudio", + "version": "2.5.3", + "hash": "sha256-GZN1E9rOGorQvVSbGTsmXgJxj2TtJwJxCuo+oh+NEBI=" + } +] diff --git a/tanks-backend/gen-deps.sh b/tanks-backend/gen-deps.sh new file mode 100644 index 0000000..b98072d --- /dev/null +++ b/tanks-backend/gen-deps.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euxo pipefail + +dotnet restore --packages out + +nuget-to-json out > deps.json diff --git a/tanks-backend/servicepoint b/tanks-backend/servicepoint deleted file mode 160000 index 93657c9..0000000 --- a/tanks-backend/servicepoint +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 93657c9f85d021c04270e1f5af573a6cda51f18a diff --git a/tanks-backend/servicepoint-binding-csharp b/tanks-backend/servicepoint-binding-csharp new file mode 160000 index 0000000..dcf8d12 --- /dev/null +++ b/tanks-backend/servicepoint-binding-csharp @@ -0,0 +1 @@ +Subproject commit dcf8d12a8a23286aa1054e45f15f9757ec9cfcb6 -- 2.50.1 From 11da2972533af9c1d6542ae3905bfd662dbf5921 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Sat, 27 Sep 2025 21:55:59 +0200 Subject: [PATCH 2/7] wip backend package --- flake.nix | 60 +++++-- shell.nix | 35 ---- tanks-backend/TanksServer/TanksServer.csproj | 3 +- tanks-backend/deps.json | 176 +++++++++++++++++-- tanks-backend/gen-deps.sh | 8 +- 5 files changed, 216 insertions(+), 66 deletions(-) delete mode 100644 shell.nix mode change 100644 => 100755 tanks-backend/gen-deps.sh diff --git a/flake.nix b/flake.nix index e433a00..caeeff0 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Dev shell flake for servicepoint-tanks"; + description = "flake for servicepoint-tanks"; inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05"; @@ -13,13 +13,13 @@ "aarch64-linux" ]; forAllSystems = - f: + fn: nixpkgs.lib.genAttrs supported-systems ( system: - f rec { - pkgs = nixpkgs.legacyPackages.${system}; - lib = nixpkgs.lib; + fn { inherit system; + inherit (nixpkgs) lib; + pkgs = nixpkgs.legacyPackages.${system}; selfPkgs = self.packages.${system}; } ); @@ -35,6 +35,10 @@ let frontend-set = { inputsFrom = [ selfPkgs.servicepoint-tanks-frontend ]; + packages = with pkgs; [ + typescript + nodejs + ]; }; backend-set = { inputsFrom = [ selfPkgs.servicepoint-tanks-backend ]; @@ -52,7 +56,12 @@ ); packages = forAllSystems ( - { pkgs, lib, ... }: + { + pkgs, + lib, + selfPkgs, + ... + }: { servicepoint-tanks-frontend = pkgs.buildNpmPackage (finalAttrs: { pname = "tank-frontend"; @@ -66,6 +75,36 @@ ''; }); + servicepoint-binding-csharp = pkgs.buildDotnetModule { + pname = "servicepoint-binding-csharp"; + version = "0.0.0"; + + src = ./tanks-backend/servicepoint-binding-csharp; + projectFile = "ServicePoint/ServicePoint.csproj"; + nugetDeps = ./tanks-backend/deps.json; + + packNupkg = true; + + nativeBuildInputs = with pkgs; [ + pkg-config + xe + xz + gnumake + iconv + + (pkgs.symlinkJoin { + name = "rust-toolchain"; + paths = with pkgs; [ + rustc + cargo + rustPlatform.rustcSrc + rustfmt + clippy + ]; + }) + ]; + }; + servicepoint-tanks-backend = pkgs.buildDotnetModule { pname = "servicepoint-tanks-backend"; version = "0.0.0"; @@ -74,14 +113,15 @@ dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0; src = ./tanks-backend; - projectFile = "TanksServer.sln"; + projectFile = "TanksServer/TanksServer.csproj"; nugetDeps = ./tanks-backend/deps.json; + selfContainedBuild = true; + buildInputs = [ selfPkgs.servicepoint-binding-csharp ]; + nativeBuildInputs = with pkgs; [ - pkg-config - xe - xz + # todo needed? gnumake iconv ]; diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 413986a..0000000 --- a/shell.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - pkgs ? import { }, - ... -}: -let - rust-toolchain = pkgs.symlinkJoin { - name = "rust-toolchain"; - paths = with pkgs; [ - rustc - cargo - rustPlatform.rustcSrc - rustfmt - clippy - ]; - }; -in -pkgs.mkShell { - nativeBuildInputs = with pkgs.buildPackages; [ - rust-toolchain - - pkg-config - xe - xz - cargo-tarpaulin - gnumake - iconv - - typescript - nodejs - - dotnet-sdk_8 - ]; - - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; -} diff --git a/tanks-backend/TanksServer/TanksServer.csproj b/tanks-backend/TanksServer/TanksServer.csproj index 480806b..de285be 100644 --- a/tanks-backend/TanksServer/TanksServer.csproj +++ b/tanks-backend/TanksServer/TanksServer.csproj @@ -30,7 +30,8 @@ - + + diff --git a/tanks-backend/deps.json b/tanks-backend/deps.json index 4a8ff5d..e0d7fc9 100644 --- a/tanks-backend/deps.json +++ b/tanks-backend/deps.json @@ -24,12 +24,7 @@ "version": "17.8.0", "hash": "sha256-cv/wAXfTNS+RWEsHWNKqRDHC7LOQSSdFJ1a9cZuSfJw=" }, - { - "pname": "Microsoft.DotNet.ILCompiler", - "version": "8.0.20", - "hash": "sha256-972D4TBkIWS1RY3rrB+znz7KuUGt/dDU16UWjZBJ9JU=" - }, - { +{ "pname": "Microsoft.Extensions.Configuration.Abstractions", "version": "8.0.0", "hash": "sha256-4eBpDkf7MJozTZnOwQvwcfgRKQGcNXe0K/kF+h5Rl8o=" @@ -59,12 +54,7 @@ "version": "8.0.0", "hash": "sha256-FU8qj3DR8bDdc1c+WeGZx/PCZeqqndweZM9epcpXjSo=" }, - { - "pname": "Microsoft.NET.ILLink.Tasks", - "version": "8.0.20", - "hash": "sha256-nNI9Dc5fLi8VOBLN/tdpVtHVyaKYkwuga+Ew3NcBw6s=" - }, - { +{ "pname": "Microsoft.NET.Test.Sdk", "version": "17.8.0", "hash": "sha256-uz7QvW+NsVRsp8FR1wjnGEOkUaPX4JyieywvCN6g2+s=" @@ -120,6 +110,91 @@ "hash": "sha256-ElqfN4CcKxT3hP2qvxxObb4mnBlYG89IMxO0Sm5oZ2g=" }, { + "pname": "runtime.any.System.Collections", + "version": "4.3.0", + "hash": "sha256-4PGZqyWhZ6/HCTF2KddDsbmTTjxs2oW79YfkberDZS8=" +}, +{ + "pname": "runtime.any.System.Diagnostics.Tools", + "version": "4.3.0", + "hash": "sha256-8yLKFt2wQxkEf7fNfzB+cPUCjYn2qbqNgQ1+EeY2h/I=" +}, +{ + "pname": "runtime.any.System.Diagnostics.Tracing", + "version": "4.3.0", + "hash": "sha256-dsmTLGvt8HqRkDWP8iKVXJCS+akAzENGXKPV18W2RgI=" +}, +{ + "pname": "runtime.any.System.Globalization", + "version": "4.3.0", + "hash": "sha256-PaiITTFI2FfPylTEk7DwzfKeiA/g/aooSU1pDcdwWLU=" +}, +{ + "pname": "runtime.any.System.Globalization.Calendars", + "version": "4.3.0", + "hash": "sha256-AYh39tgXJVFu8aLi9Y/4rK8yWMaza4S4eaxjfcuEEL4=" +}, +{ + "pname": "runtime.any.System.IO", + "version": "4.3.0", + "hash": "sha256-vej7ySRhyvM3pYh/ITMdC25ivSd0WLZAaIQbYj/6HVE=" +}, +{ + "pname": "runtime.any.System.Reflection", + "version": "4.3.0", + "hash": "sha256-ns6f++lSA+bi1xXgmW1JkWFb2NaMD+w+YNTfMvyAiQk=" +}, +{ + "pname": "runtime.any.System.Reflection.Extensions", + "version": "4.3.0", + "hash": "sha256-Y2AnhOcJwJVYv7Rp6Jz6ma0fpITFqJW+8rsw106K2X8=" +}, +{ + "pname": "runtime.any.System.Reflection.Primitives", + "version": "4.3.0", + "hash": "sha256-LkPXtiDQM3BcdYkAm5uSNOiz3uF4J45qpxn5aBiqNXQ=" +}, +{ + "pname": "runtime.any.System.Resources.ResourceManager", + "version": "4.3.0", + "hash": "sha256-9EvnmZslLgLLhJ00o5MWaPuJQlbUFcUF8itGQNVkcQ4=" +}, +{ + "pname": "runtime.any.System.Runtime", + "version": "4.3.0", + "hash": "sha256-qwhNXBaJ1DtDkuRacgHwnZmOZ1u9q7N8j0cWOLYOELM=" +}, +{ + "pname": "runtime.any.System.Runtime.Handles", + "version": "4.3.0", + "hash": "sha256-PQRACwnSUuxgVySO1840KvqCC9F8iI9iTzxNW0RcBS4=" +}, +{ + "pname": "runtime.any.System.Runtime.InteropServices", + "version": "4.3.0", + "hash": "sha256-Kaw5PnLYIiqWbsoF3VKJhy7pkpoGsUwn4ZDCKscbbzA=" +}, +{ + "pname": "runtime.any.System.Text.Encoding", + "version": "4.3.0", + "hash": "sha256-Q18B9q26MkWZx68exUfQT30+0PGmpFlDgaF0TnaIGCs=" +}, +{ + "pname": "runtime.any.System.Text.Encoding.Extensions", + "version": "4.3.0", + "hash": "sha256-6MYj0RmLh4EVqMtO/MRqBi0HOn5iG4x9JimgCCJ+EFM=" +}, +{ + "pname": "runtime.any.System.Threading.Tasks", + "version": "4.3.0", + "hash": "sha256-agdOM0NXupfHbKAQzQT8XgbI9B8hVEh+a/2vqeHctg4=" +}, +{ + "pname": "runtime.any.System.Threading.Timer", + "version": "4.3.0", + "hash": "sha256-BgHxXCIbicVZtpgMimSXixhFC3V+p5ODqeljDjO8hCs=" +}, +{ "pname": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl", "version": "4.3.0", "hash": "sha256-LXUPLX3DJxsU1Pd3UwjO1PO9NM2elNEDXeu2Mu/vNps=" @@ -134,12 +209,7 @@ "version": "4.3.0", "hash": "sha256-SrHqT9wrCBsxILWtaJgGKd6Odmxm8/Mh7Kh0CUkZVzA=" }, - { - "pname": "runtime.linux-x64.Microsoft.DotNet.ILCompiler", - "version": "8.0.20", - "hash": "sha256-cxVwgQnkp9Ynfv4Ly2EKEHGdzK3czRPi4JIYycFd2T4=" - }, - { +{ "pname": "runtime.native.System", "version": "4.3.0", "hash": "sha256-ZBZaodnjvLXATWpXXakFgcy6P+gjhshFXmglrL5xD5Y=" @@ -205,6 +275,46 @@ "hash": "sha256-pVFUKuPPIx0edQKjzRon3zKq8zhzHEzko/lc01V/jdw=" }, { + "pname": "runtime.unix.Microsoft.Win32.Primitives", + "version": "4.3.0", + "hash": "sha256-LZb23lRXzr26tRS5aA0xyB08JxiblPDoA7HBvn6awXg=" +}, +{ + "pname": "runtime.unix.System.Console", + "version": "4.3.0", + "hash": "sha256-AHkdKShTRHttqfMjmi+lPpTuCrM5vd/WRy6Kbtie190=" +}, +{ + "pname": "runtime.unix.System.Diagnostics.Debug", + "version": "4.3.0", + "hash": "sha256-ReoazscfbGH+R6s6jkg5sIEHWNEvjEoHtIsMbpc7+tI=" +}, +{ + "pname": "runtime.unix.System.IO.FileSystem", + "version": "4.3.0", + "hash": "sha256-Pf4mRl6YDK2x2KMh0WdyNgv0VUNdSKVDLlHqozecy5I=" +}, +{ + "pname": "runtime.unix.System.Net.Primitives", + "version": "4.3.0", + "hash": "sha256-pHJ+I6i16MV6m77uhTC6GPY6jWGReE3SSP3fVB59ti0=" +}, +{ + "pname": "runtime.unix.System.Net.Sockets", + "version": "4.3.0", + "hash": "sha256-IvgOeA2JuBjKl5yAVGjPYMPDzs9phb3KANs95H9v1w4=" +}, +{ + "pname": "runtime.unix.System.Private.Uri", + "version": "4.3.0", + "hash": "sha256-c5tXWhE/fYbJVl9rXs0uHh3pTsg44YD1dJvyOA0WoMs=" +}, +{ + "pname": "runtime.unix.System.Runtime.Extensions", + "version": "4.3.0", + "hash": "sha256-l8S9gt6dk3qYG6HYonHtdlYtBKyPb29uQ6NDjmrt3V4=" +}, +{ "pname": "SixLabors.ImageSharp", "version": "3.1.5", "hash": "sha256-3UehX9T+I81nfgv2dTHlpoPgYzXFk7kHr1mmlQOCBfw=" @@ -315,6 +425,11 @@ "hash": "sha256-UoBB7WPDp2Bne/fwxKF0nE8grJ6FzTMXdT/jfsphj8Q=" }, { + "pname": "System.Net.NameResolution", + "version": "4.3.0", + "hash": "sha256-eGZwCBExWsnirWBHyp2sSSSXp6g7I6v53qNmwPgtJ5c=" +}, +{ "pname": "System.Net.Primitives", "version": "4.3.0", "hash": "sha256-MY7Z6vOtFMbEKaLW9nOSZeAjcWpwCtdO7/W1mkGZBzE=" @@ -330,6 +445,11 @@ "hash": "sha256-gtmRkWP2Kwr3nHtDh0yYtce38z1wrGzb6fjm4v8wN6Q=" }, { + "pname": "System.Private.Uri", + "version": "4.3.0", + "hash": "sha256-fVfgcoP4AVN1E5wHZbKBIOPYZ/xBeSIdsNF+bdukIRM=" +}, +{ "pname": "System.Reflection", "version": "4.3.0", "hash": "sha256-NQSZRpZLvtPWDlvmMIdGxcVuyUnw92ZURo0hXsEshXY=" @@ -405,6 +525,11 @@ "hash": "sha256-P5jHCgMbgFMYiONvzmaKFeOqcAIDPu/U8bOVrNPYKqc=" }, { + "pname": "System.Security.Claims", + "version": "4.3.0", + "hash": "sha256-Fua/rDwAqq4UByRVomAxMPmDBGd5eImRqHVQIeSxbks=" +}, +{ "pname": "System.Security.Cryptography.Algorithms", "version": "4.3.0", "hash": "sha256-tAJvNSlczYBJ3Ed24Ae27a55tq/n4D3fubNQdwcKWA8=" @@ -440,6 +565,16 @@ "hash": "sha256-MG3V/owDh273GCUPsGGraNwaVpcydupl3EtPXj6TVG0=" }, { + "pname": "System.Security.Principal", + "version": "4.3.0", + "hash": "sha256-rjudVUHdo8pNJg2EVEn0XxxwNo5h2EaYo+QboPkXlYk=" +}, +{ + "pname": "System.Security.Principal.Windows", + "version": "4.3.0", + "hash": "sha256-mbdLVUcEwe78p3ZnB6jYsizNEqxMaCAWI3tEQNhRQAE=" +}, +{ "pname": "System.Text.Encoding", "version": "4.3.0", "hash": "sha256-GctHVGLZAa/rqkBNhsBGnsiWdKyv6VDubYpGkuOkBLg=" @@ -475,6 +610,11 @@ "hash": "sha256-X2hQ5j+fxcmnm88Le/kSavjiGOmkcumBGTZKBLvorPc=" }, { + "pname": "System.Threading.ThreadPool", + "version": "4.3.0", + "hash": "sha256-wW0QdvssRoaOfQLazTGSnwYTurE4R8FxDx70pYkL+gg=" +}, +{ "pname": "System.Threading.Timer", "version": "4.3.0", "hash": "sha256-pmhslmhQhP32TWbBzoITLZ4BoORBqYk25OWbru04p9s=" diff --git a/tanks-backend/gen-deps.sh b/tanks-backend/gen-deps.sh old mode 100644 new mode 100755 index b98072d..53e8dca --- a/tanks-backend/gen-deps.sh +++ b/tanks-backend/gen-deps.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash set -euxo pipefail -dotnet restore --packages out +# first time +# dotnet restore --packages out +# nuget-to-json out > deps.json -nuget-to-json out > deps.json +# update +nix build ".?submodules=1#servicepoint-tanks-backend.fetch-deps" +./result deps.json -- 2.50.1 From 2f1460adf66ad63c2cc7db18dbfd964d7f5f7f66 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Mon, 29 Sep 2025 00:10:08 +0200 Subject: [PATCH 3/7] wip backend package - builds but does not run yet --- flake.lock | 43 +++++ flake.nix | 47 ++---- tanks-backend/TanksServer/TanksServer.csproj | 6 +- tanks-backend/deps.json | 155 ------------------- 4 files changed, 55 insertions(+), 196 deletions(-) diff --git a/flake.lock b/flake.lock index af48ee2..1e13ce9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,47 @@ { "nodes": { + "binding": { + "inputs": { + "binding": "binding_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1759096792, + "narHash": "sha256-CW4D1yJecw7Id6AxIEJOW3OpcX3Y4Ehng76/YlR1I9w=", + "ref": "refs/heads/main", + "rev": "8df2996504866f3193fbe51860ab173d25724e5e", + "revCount": 307, + "type": "git", + "url": "https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git" + }, + "original": { + "type": "git", + "url": "https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git" + } + }, + "binding_2": { + "inputs": { + "nixpkgs": [ + "binding", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1759093963, + "narHash": "sha256-nis9Xps/P1f/v9FC3LoMLGGCOMMbdrOniDSklqLsH8o=", + "ref": "refs/heads/main", + "rev": "44ef4bb6d707c46af1bed6244f17a16f26f246c1", + "revCount": 304, + "type": "git", + "url": "https://git.berlin.ccc.de/servicepoint/servicepoint-binding-uniffi.git" + }, + "original": { + "type": "git", + "url": "https://git.berlin.ccc.de/servicepoint/servicepoint-binding-uniffi.git" + } + }, "nixpkgs": { "locked": { "lastModified": 1758589230, @@ -18,6 +60,7 @@ }, "root": { "inputs": { + "binding": "binding", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index caeeff0..eaa0969 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,15 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05"; + + binding = { + url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = - { self, nixpkgs }: + { self, nixpkgs, binding }: let supported-systems = [ "x86_64-linux" @@ -21,6 +26,7 @@ inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.${system}; selfPkgs = self.packages.${system}; + bindingPkgs = binding.packages.${system}; } ); in @@ -60,6 +66,7 @@ pkgs, lib, selfPkgs, + bindingPkgs, ... }: { @@ -75,36 +82,6 @@ ''; }); - servicepoint-binding-csharp = pkgs.buildDotnetModule { - pname = "servicepoint-binding-csharp"; - version = "0.0.0"; - - src = ./tanks-backend/servicepoint-binding-csharp; - projectFile = "ServicePoint/ServicePoint.csproj"; - nugetDeps = ./tanks-backend/deps.json; - - packNupkg = true; - - nativeBuildInputs = with pkgs; [ - pkg-config - xe - xz - gnumake - iconv - - (pkgs.symlinkJoin { - name = "rust-toolchain"; - paths = with pkgs; [ - rustc - cargo - rustPlatform.rustcSrc - rustfmt - clippy - ]; - }) - ]; - }; - servicepoint-tanks-backend = pkgs.buildDotnetModule { pname = "servicepoint-tanks-backend"; version = "0.0.0"; @@ -118,13 +95,7 @@ selfContainedBuild = true; - buildInputs = [ selfPkgs.servicepoint-binding-csharp ]; - - nativeBuildInputs = with pkgs; [ - # todo needed? - gnumake - iconv - ]; + buildInputs = [ bindingPkgs.servicepoint-binding-csharp ]; }; } ); diff --git a/tanks-backend/TanksServer/TanksServer.csproj b/tanks-backend/TanksServer/TanksServer.csproj index de285be..7ba8f60 100644 --- a/tanks-backend/TanksServer/TanksServer.csproj +++ b/tanks-backend/TanksServer/TanksServer.csproj @@ -7,7 +7,7 @@ - true + true true @@ -30,8 +30,8 @@ - - + + diff --git a/tanks-backend/deps.json b/tanks-backend/deps.json index e0d7fc9..df4c241 100644 --- a/tanks-backend/deps.json +++ b/tanks-backend/deps.json @@ -110,91 +110,6 @@ "hash": "sha256-ElqfN4CcKxT3hP2qvxxObb4mnBlYG89IMxO0Sm5oZ2g=" }, { - "pname": "runtime.any.System.Collections", - "version": "4.3.0", - "hash": "sha256-4PGZqyWhZ6/HCTF2KddDsbmTTjxs2oW79YfkberDZS8=" -}, -{ - "pname": "runtime.any.System.Diagnostics.Tools", - "version": "4.3.0", - "hash": "sha256-8yLKFt2wQxkEf7fNfzB+cPUCjYn2qbqNgQ1+EeY2h/I=" -}, -{ - "pname": "runtime.any.System.Diagnostics.Tracing", - "version": "4.3.0", - "hash": "sha256-dsmTLGvt8HqRkDWP8iKVXJCS+akAzENGXKPV18W2RgI=" -}, -{ - "pname": "runtime.any.System.Globalization", - "version": "4.3.0", - "hash": "sha256-PaiITTFI2FfPylTEk7DwzfKeiA/g/aooSU1pDcdwWLU=" -}, -{ - "pname": "runtime.any.System.Globalization.Calendars", - "version": "4.3.0", - "hash": "sha256-AYh39tgXJVFu8aLi9Y/4rK8yWMaza4S4eaxjfcuEEL4=" -}, -{ - "pname": "runtime.any.System.IO", - "version": "4.3.0", - "hash": "sha256-vej7ySRhyvM3pYh/ITMdC25ivSd0WLZAaIQbYj/6HVE=" -}, -{ - "pname": "runtime.any.System.Reflection", - "version": "4.3.0", - "hash": "sha256-ns6f++lSA+bi1xXgmW1JkWFb2NaMD+w+YNTfMvyAiQk=" -}, -{ - "pname": "runtime.any.System.Reflection.Extensions", - "version": "4.3.0", - "hash": "sha256-Y2AnhOcJwJVYv7Rp6Jz6ma0fpITFqJW+8rsw106K2X8=" -}, -{ - "pname": "runtime.any.System.Reflection.Primitives", - "version": "4.3.0", - "hash": "sha256-LkPXtiDQM3BcdYkAm5uSNOiz3uF4J45qpxn5aBiqNXQ=" -}, -{ - "pname": "runtime.any.System.Resources.ResourceManager", - "version": "4.3.0", - "hash": "sha256-9EvnmZslLgLLhJ00o5MWaPuJQlbUFcUF8itGQNVkcQ4=" -}, -{ - "pname": "runtime.any.System.Runtime", - "version": "4.3.0", - "hash": "sha256-qwhNXBaJ1DtDkuRacgHwnZmOZ1u9q7N8j0cWOLYOELM=" -}, -{ - "pname": "runtime.any.System.Runtime.Handles", - "version": "4.3.0", - "hash": "sha256-PQRACwnSUuxgVySO1840KvqCC9F8iI9iTzxNW0RcBS4=" -}, -{ - "pname": "runtime.any.System.Runtime.InteropServices", - "version": "4.3.0", - "hash": "sha256-Kaw5PnLYIiqWbsoF3VKJhy7pkpoGsUwn4ZDCKscbbzA=" -}, -{ - "pname": "runtime.any.System.Text.Encoding", - "version": "4.3.0", - "hash": "sha256-Q18B9q26MkWZx68exUfQT30+0PGmpFlDgaF0TnaIGCs=" -}, -{ - "pname": "runtime.any.System.Text.Encoding.Extensions", - "version": "4.3.0", - "hash": "sha256-6MYj0RmLh4EVqMtO/MRqBi0HOn5iG4x9JimgCCJ+EFM=" -}, -{ - "pname": "runtime.any.System.Threading.Tasks", - "version": "4.3.0", - "hash": "sha256-agdOM0NXupfHbKAQzQT8XgbI9B8hVEh+a/2vqeHctg4=" -}, -{ - "pname": "runtime.any.System.Threading.Timer", - "version": "4.3.0", - "hash": "sha256-BgHxXCIbicVZtpgMimSXixhFC3V+p5ODqeljDjO8hCs=" -}, -{ "pname": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl", "version": "4.3.0", "hash": "sha256-LXUPLX3DJxsU1Pd3UwjO1PO9NM2elNEDXeu2Mu/vNps=" @@ -275,46 +190,6 @@ "hash": "sha256-pVFUKuPPIx0edQKjzRon3zKq8zhzHEzko/lc01V/jdw=" }, { - "pname": "runtime.unix.Microsoft.Win32.Primitives", - "version": "4.3.0", - "hash": "sha256-LZb23lRXzr26tRS5aA0xyB08JxiblPDoA7HBvn6awXg=" -}, -{ - "pname": "runtime.unix.System.Console", - "version": "4.3.0", - "hash": "sha256-AHkdKShTRHttqfMjmi+lPpTuCrM5vd/WRy6Kbtie190=" -}, -{ - "pname": "runtime.unix.System.Diagnostics.Debug", - "version": "4.3.0", - "hash": "sha256-ReoazscfbGH+R6s6jkg5sIEHWNEvjEoHtIsMbpc7+tI=" -}, -{ - "pname": "runtime.unix.System.IO.FileSystem", - "version": "4.3.0", - "hash": "sha256-Pf4mRl6YDK2x2KMh0WdyNgv0VUNdSKVDLlHqozecy5I=" -}, -{ - "pname": "runtime.unix.System.Net.Primitives", - "version": "4.3.0", - "hash": "sha256-pHJ+I6i16MV6m77uhTC6GPY6jWGReE3SSP3fVB59ti0=" -}, -{ - "pname": "runtime.unix.System.Net.Sockets", - "version": "4.3.0", - "hash": "sha256-IvgOeA2JuBjKl5yAVGjPYMPDzs9phb3KANs95H9v1w4=" -}, -{ - "pname": "runtime.unix.System.Private.Uri", - "version": "4.3.0", - "hash": "sha256-c5tXWhE/fYbJVl9rXs0uHh3pTsg44YD1dJvyOA0WoMs=" -}, -{ - "pname": "runtime.unix.System.Runtime.Extensions", - "version": "4.3.0", - "hash": "sha256-l8S9gt6dk3qYG6HYonHtdlYtBKyPb29uQ6NDjmrt3V4=" -}, -{ "pname": "SixLabors.ImageSharp", "version": "3.1.5", "hash": "sha256-3UehX9T+I81nfgv2dTHlpoPgYzXFk7kHr1mmlQOCBfw=" @@ -425,11 +300,6 @@ "hash": "sha256-UoBB7WPDp2Bne/fwxKF0nE8grJ6FzTMXdT/jfsphj8Q=" }, { - "pname": "System.Net.NameResolution", - "version": "4.3.0", - "hash": "sha256-eGZwCBExWsnirWBHyp2sSSSXp6g7I6v53qNmwPgtJ5c=" -}, -{ "pname": "System.Net.Primitives", "version": "4.3.0", "hash": "sha256-MY7Z6vOtFMbEKaLW9nOSZeAjcWpwCtdO7/W1mkGZBzE=" @@ -445,11 +315,6 @@ "hash": "sha256-gtmRkWP2Kwr3nHtDh0yYtce38z1wrGzb6fjm4v8wN6Q=" }, { - "pname": "System.Private.Uri", - "version": "4.3.0", - "hash": "sha256-fVfgcoP4AVN1E5wHZbKBIOPYZ/xBeSIdsNF+bdukIRM=" -}, -{ "pname": "System.Reflection", "version": "4.3.0", "hash": "sha256-NQSZRpZLvtPWDlvmMIdGxcVuyUnw92ZURo0hXsEshXY=" @@ -525,11 +390,6 @@ "hash": "sha256-P5jHCgMbgFMYiONvzmaKFeOqcAIDPu/U8bOVrNPYKqc=" }, { - "pname": "System.Security.Claims", - "version": "4.3.0", - "hash": "sha256-Fua/rDwAqq4UByRVomAxMPmDBGd5eImRqHVQIeSxbks=" -}, -{ "pname": "System.Security.Cryptography.Algorithms", "version": "4.3.0", "hash": "sha256-tAJvNSlczYBJ3Ed24Ae27a55tq/n4D3fubNQdwcKWA8=" @@ -565,16 +425,6 @@ "hash": "sha256-MG3V/owDh273GCUPsGGraNwaVpcydupl3EtPXj6TVG0=" }, { - "pname": "System.Security.Principal", - "version": "4.3.0", - "hash": "sha256-rjudVUHdo8pNJg2EVEn0XxxwNo5h2EaYo+QboPkXlYk=" -}, -{ - "pname": "System.Security.Principal.Windows", - "version": "4.3.0", - "hash": "sha256-mbdLVUcEwe78p3ZnB6jYsizNEqxMaCAWI3tEQNhRQAE=" -}, -{ "pname": "System.Text.Encoding", "version": "4.3.0", "hash": "sha256-GctHVGLZAa/rqkBNhsBGnsiWdKyv6VDubYpGkuOkBLg=" @@ -610,11 +460,6 @@ "hash": "sha256-X2hQ5j+fxcmnm88Le/kSavjiGOmkcumBGTZKBLvorPc=" }, { - "pname": "System.Threading.ThreadPool", - "version": "4.3.0", - "hash": "sha256-wW0QdvssRoaOfQLazTGSnwYTurE4R8FxDx70pYkL+gg=" -}, -{ "pname": "System.Threading.Timer", "version": "4.3.0", "hash": "sha256-pmhslmhQhP32TWbBzoITLZ4BoORBqYk25OWbru04p9s=" -- 2.50.1 From e4d2ad4a14e27bdd4487aa9359923789f041be48 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Mon, 29 Sep 2025 00:25:23 +0200 Subject: [PATCH 4/7] regenerate deps --- tanks-backend/deps.json | 460 -------------------------------------- tanks-backend/gen-deps.sh | 2 +- 2 files changed, 1 insertion(+), 461 deletions(-) diff --git a/tanks-backend/deps.json b/tanks-backend/deps.json index df4c241..c90c1d8 100644 --- a/tanks-backend/deps.json +++ b/tanks-backend/deps.json @@ -1,9 +1,4 @@ [ - { - "pname": "coverlet.collector", - "version": "6.0.0", - "hash": "sha256-IEmweTMapcPhFHpmJsPXfmMhravYOrWupgjeOvMmQ4o=" - }, { "pname": "DotNext", "version": "5.3.0", @@ -15,16 +10,6 @@ "hash": "sha256-P8ITHieqi7fZSKJsyQNm0iusf9J1c+dmeiXLFrtr+d8=" }, { - "pname": "Microsoft.Build.Tasks.Git", - "version": "8.0.0", - "hash": "sha256-vX6/kPij8vNAu8f7rrvHHhPrNph20IcufmrBgZNxpQA=" - }, - { - "pname": "Microsoft.CodeCoverage", - "version": "17.8.0", - "hash": "sha256-cv/wAXfTNS+RWEsHWNKqRDHC7LOQSSdFJ1a9cZuSfJw=" - }, -{ "pname": "Microsoft.Extensions.Configuration.Abstractions", "version": "8.0.0", "hash": "sha256-4eBpDkf7MJozTZnOwQvwcfgRKQGcNXe0K/kF+h5Rl8o=" @@ -54,464 +39,19 @@ "version": "8.0.0", "hash": "sha256-FU8qj3DR8bDdc1c+WeGZx/PCZeqqndweZM9epcpXjSo=" }, -{ - "pname": "Microsoft.NET.Test.Sdk", - "version": "17.8.0", - "hash": "sha256-uz7QvW+NsVRsp8FR1wjnGEOkUaPX4JyieywvCN6g2+s=" - }, - { - "pname": "Microsoft.NETCore.Platforms", - "version": "1.1.0", - "hash": "sha256-FeM40ktcObQJk4nMYShB61H/E8B7tIKfl9ObJ0IOcCM=" - }, - { - "pname": "Microsoft.NETCore.Targets", - "version": "1.1.0", - "hash": "sha256-0AqQ2gMS8iNlYkrD+BxtIg7cXMnr9xZHtKAuN4bjfaQ=" - }, - { - "pname": "Microsoft.SourceLink.Common", - "version": "8.0.0", - "hash": "sha256-AfUqleVEqWuHE7z2hNiwOLnquBJ3tuYtbkdGMppHOXc=" - }, - { - "pname": "Microsoft.SourceLink.GitHub", - "version": "8.0.0", - "hash": "sha256-hNTkpKdCLY5kIuOmznD1mY+pRdJ0PKu2HypyXog9vb0=" - }, - { - "pname": "Microsoft.TestPlatform.ObjectModel", - "version": "17.8.0", - "hash": "sha256-9TwGrjVvbtyetw67Udp3EMK5MX8j0RFRjduxPCs9ESw=" - }, - { - "pname": "Microsoft.TestPlatform.TestHost", - "version": "17.8.0", - "hash": "sha256-+CTYFu631uovLCO47RKe86YaAqfoLA4r73vKORJUsjg=" - }, - { - "pname": "Microsoft.Win32.Primitives", - "version": "4.3.0", - "hash": "sha256-mBNDmPXNTW54XLnPAUwBRvkIORFM7/j0D0I2SyQPDEg=" - }, - { - "pname": "NETStandard.Library", - "version": "1.6.1", - "hash": "sha256-iNan1ix7RtncGWC9AjAZ2sk70DoxOsmEOgQ10fXm4Pw=" - }, - { - "pname": "Newtonsoft.Json", - "version": "13.0.1", - "hash": "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo=" - }, - { - "pname": "NuGet.Frameworks", - "version": "6.5.0", - "hash": "sha256-ElqfN4CcKxT3hP2qvxxObb4mnBlYG89IMxO0Sm5oZ2g=" - }, - { - "pname": "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-LXUPLX3DJxsU1Pd3UwjO1PO9NM2elNEDXeu2Mu/vNps=" - }, - { - "pname": "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-qeSqaUI80+lqw5MK4vMpmO0CZaqrmYktwp6L+vQAb0I=" - }, - { - "pname": "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-SrHqT9wrCBsxILWtaJgGKd6Odmxm8/Mh7Kh0CUkZVzA=" - }, -{ - "pname": "runtime.native.System", - "version": "4.3.0", - "hash": "sha256-ZBZaodnjvLXATWpXXakFgcy6P+gjhshFXmglrL5xD5Y=" - }, - { - "pname": "runtime.native.System.IO.Compression", - "version": "4.3.0", - "hash": "sha256-DWnXs4vlKoU6WxxvCArTJupV6sX3iBbZh8SbqfHace8=" - }, - { - "pname": "runtime.native.System.Net.Http", - "version": "4.3.0", - "hash": "sha256-c556PyheRwpYhweBjSfIwEyZHnAUB8jWioyKEcp/2dg=" - }, - { - "pname": "runtime.native.System.Security.Cryptography.Apple", - "version": "4.3.0", - "hash": "sha256-2IhBv0i6pTcOyr8FFIyfPEaaCHUmJZ8DYwLUwJ+5waw=" - }, - { - "pname": "runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-Jy01KhtcCl2wjMpZWH+X3fhHcVn+SyllWFY8zWlz/6I=" - }, - { - "pname": "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-wyv00gdlqf8ckxEdV7E+Ql9hJIoPcmYEuyeWb5Oz3mM=" - }, - { - "pname": "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-zi+b4sCFrA9QBiSGDD7xPV27r3iHGlV99gpyVUjRmc4=" - }, - { - "pname": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple", - "version": "4.3.0", - "hash": "sha256-serkd4A7F6eciPiPJtUyJyxzdAtupEcWIZQ9nptEzIM=" - }, - { - "pname": "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-gybQU6mPgaWV3rBG2dbH6tT3tBq8mgze3PROdsuWnX0=" - }, - { - "pname": "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-VsP72GVveWnGUvS/vjOQLv1U80H2K8nZ4fDAmI61Hm4=" - }, - { - "pname": "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-4yKGa/IrNCKuQ3zaDzILdNPD32bNdy6xr5gdJigyF5g=" - }, - { - "pname": "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-HmdJhhRsiVoOOCcUvAwdjpMRiyuSwdcgEv2j9hxi+Zc=" - }, - { - "pname": "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-pVFUKuPPIx0edQKjzRon3zKq8zhzHEzko/lc01V/jdw=" - }, { "pname": "SixLabors.ImageSharp", "version": "3.1.5", "hash": "sha256-3UehX9T+I81nfgv2dTHlpoPgYzXFk7kHr1mmlQOCBfw=" }, - { - "pname": "System.AppContext", - "version": "4.3.0", - "hash": "sha256-yg95LNQOwFlA1tWxXdQkVyJqT4AnoDc+ACmrNvzGiZg=" - }, - { - "pname": "System.Buffers", - "version": "4.3.0", - "hash": "sha256-XqZWb4Kd04960h4U9seivjKseGA/YEIpdplfHYHQ9jk=" - }, - { - "pname": "System.Collections", - "version": "4.3.0", - "hash": "sha256-afY7VUtD6w/5mYqrce8kQrvDIfS2GXDINDh73IjxJKc=" - }, - { - "pname": "System.Collections.Concurrent", - "version": "4.3.0", - "hash": "sha256-KMY5DfJnDeIsa13DpqvyN8NkReZEMAFnlmNglVoFIXI=" - }, - { - "pname": "System.Console", - "version": "4.3.0", - "hash": "sha256-Xh3PPBZr0pDbDaK8AEHbdGz7ePK6Yi1ZyRWI1JM6mbo=" - }, - { - "pname": "System.Diagnostics.Debug", - "version": "4.3.0", - "hash": "sha256-fkA79SjPbSeiEcrbbUsb70u9B7wqbsdM9s1LnoKj0gM=" - }, - { - "pname": "System.Diagnostics.DiagnosticSource", - "version": "4.3.0", - "hash": "sha256-OFJRb0ygep0Z3yDBLwAgM/Tkfs4JCDtsNhwDH9cd1Xw=" - }, - { - "pname": "System.Diagnostics.Tools", - "version": "4.3.0", - "hash": "sha256-gVOv1SK6Ape0FQhCVlNOd9cvQKBvMxRX9K0JPVi8w0Y=" - }, - { - "pname": "System.Diagnostics.Tracing", - "version": "4.3.0", - "hash": "sha256-hCETZpHHGVhPYvb4C0fh4zs+8zv4GPoixagkLZjpa9Q=" - }, - { - "pname": "System.Globalization", - "version": "4.3.0", - "hash": "sha256-caL0pRmFSEsaoeZeWN5BTQtGrAtaQPwFi8YOZPZG5rI=" - }, - { - "pname": "System.Globalization.Calendars", - "version": "4.3.0", - "hash": "sha256-uNOD0EOVFgnS2fMKvMiEtI9aOw00+Pfy/H+qucAQlPc=" - }, - { - "pname": "System.Globalization.Extensions", - "version": "4.3.0", - "hash": "sha256-mmJWA27T0GRVuFP9/sj+4TrR4GJWrzNIk2PDrbr7RQk=" - }, - { - "pname": "System.IO", - "version": "4.3.0", - "hash": "sha256-ruynQHekFP5wPrDiVyhNiRIXeZ/I9NpjK5pU+HPDiRY=" - }, - { - "pname": "System.IO.Compression", - "version": "4.3.0", - "hash": "sha256-f5PrQlQgj5Xj2ZnHxXW8XiOivaBvfqDao9Sb6AVinyA=" - }, - { - "pname": "System.IO.Compression.ZipFile", - "version": "4.3.0", - "hash": "sha256-WQl+JgWs+GaRMeiahTFUbrhlXIHapzcpTFXbRvAtvvs=" - }, - { - "pname": "System.IO.FileSystem", - "version": "4.3.0", - "hash": "sha256-vNIYnvlayuVj0WfRfYKpDrhDptlhp1pN8CYmlVd2TXw=" - }, - { - "pname": "System.IO.FileSystem.Primitives", - "version": "4.3.0", - "hash": "sha256-LMnfg8Vwavs9cMnq9nNH8IWtAtSfk0/Fy4s4Rt9r1kg=" - }, { "pname": "System.IO.Hashing", "version": "8.0.0", "hash": "sha256-szOGt0TNBo6dEdC3gf6H+e9YW3Nw0woa6UnCGGGK5cE=" }, - { - "pname": "System.Linq", - "version": "4.3.0", - "hash": "sha256-R5uiSL3l6a3XrXSSL6jz+q/PcyVQzEAByiuXZNSqD/A=" - }, - { - "pname": "System.Linq.Expressions", - "version": "4.3.0", - "hash": "sha256-+3pvhZY7rip8HCbfdULzjlC9FPZFpYoQxhkcuFm2wk8=" - }, - { - "pname": "System.Net.Http", - "version": "4.3.0", - "hash": "sha256-UoBB7WPDp2Bne/fwxKF0nE8grJ6FzTMXdT/jfsphj8Q=" - }, - { - "pname": "System.Net.Primitives", - "version": "4.3.0", - "hash": "sha256-MY7Z6vOtFMbEKaLW9nOSZeAjcWpwCtdO7/W1mkGZBzE=" - }, - { - "pname": "System.Net.Sockets", - "version": "4.3.0", - "hash": "sha256-il7dr5VT/QWDg/0cuh+4Es2u8LY//+qqiY9BZmYxSus=" - }, - { - "pname": "System.ObjectModel", - "version": "4.3.0", - "hash": "sha256-gtmRkWP2Kwr3nHtDh0yYtce38z1wrGzb6fjm4v8wN6Q=" - }, - { - "pname": "System.Reflection", - "version": "4.3.0", - "hash": "sha256-NQSZRpZLvtPWDlvmMIdGxcVuyUnw92ZURo0hXsEshXY=" - }, - { - "pname": "System.Reflection.Emit", - "version": "4.3.0", - "hash": "sha256-5LhkDmhy2FkSxulXR+bsTtMzdU3VyyuZzsxp7/DwyIU=" - }, - { - "pname": "System.Reflection.Emit.ILGeneration", - "version": "4.3.0", - "hash": "sha256-mKRknEHNls4gkRwrEgi39B+vSaAz/Gt3IALtS98xNnA=" - }, - { - "pname": "System.Reflection.Emit.Lightweight", - "version": "4.3.0", - "hash": "sha256-rKx4a9yZKcajloSZHr4CKTVJ6Vjh95ni+zszPxWjh2I=" - }, - { - "pname": "System.Reflection.Extensions", - "version": "4.3.0", - "hash": "sha256-mMOCYzUenjd4rWIfq7zIX9PFYk/daUyF0A8l1hbydAk=" - }, - { - "pname": "System.Reflection.Metadata", - "version": "1.6.0", - "hash": "sha256-JJfgaPav7UfEh4yRAQdGhLZF1brr0tUWPl6qmfNWq/E=" - }, - { - "pname": "System.Reflection.Primitives", - "version": "4.3.0", - "hash": "sha256-5ogwWB4vlQTl3jjk1xjniG2ozbFIjZTL9ug0usZQuBM=" - }, - { - "pname": "System.Reflection.TypeExtensions", - "version": "4.3.0", - "hash": "sha256-4U4/XNQAnddgQIHIJq3P2T80hN0oPdU2uCeghsDTWng=" - }, - { - "pname": "System.Resources.ResourceManager", - "version": "4.3.0", - "hash": "sha256-idiOD93xbbrbwwSnD4mORA9RYi/D/U48eRUsn/WnWGo=" - }, - { - "pname": "System.Runtime", - "version": "4.3.0", - "hash": "sha256-51813WXpBIsuA6fUtE5XaRQjcWdQ2/lmEokJt97u0Rg=" - }, - { - "pname": "System.Runtime.Extensions", - "version": "4.3.0", - "hash": "sha256-wLDHmozr84v1W2zYCWYxxj0FR0JDYHSVRaRuDm0bd/o=" - }, - { - "pname": "System.Runtime.Handles", - "version": "4.3.0", - "hash": "sha256-KJ5aXoGpB56Y6+iepBkdpx/AfaJDAitx4vrkLqR7gms=" - }, - { - "pname": "System.Runtime.InteropServices", - "version": "4.3.0", - "hash": "sha256-8sDH+WUJfCR+7e4nfpftj/+lstEiZixWUBueR2zmHgI=" - }, - { - "pname": "System.Runtime.InteropServices.RuntimeInformation", - "version": "4.3.0", - "hash": "sha256-MYpl6/ZyC6hjmzWRIe+iDoldOMW1mfbwXsduAnXIKGA=" - }, - { - "pname": "System.Runtime.Numerics", - "version": "4.3.0", - "hash": "sha256-P5jHCgMbgFMYiONvzmaKFeOqcAIDPu/U8bOVrNPYKqc=" - }, - { - "pname": "System.Security.Cryptography.Algorithms", - "version": "4.3.0", - "hash": "sha256-tAJvNSlczYBJ3Ed24Ae27a55tq/n4D3fubNQdwcKWA8=" - }, - { - "pname": "System.Security.Cryptography.Cng", - "version": "4.3.0", - "hash": "sha256-u17vy6wNhqok91SrVLno2M1EzLHZm6VMca85xbVChsw=" - }, - { - "pname": "System.Security.Cryptography.Csp", - "version": "4.3.0", - "hash": "sha256-oefdTU/Z2PWU9nlat8uiRDGq/PGZoSPRgkML11pmvPQ=" - }, - { - "pname": "System.Security.Cryptography.Encoding", - "version": "4.3.0", - "hash": "sha256-Yuge89N6M+NcblcvXMeyHZ6kZDfwBv3LPMDiF8HhJss=" - }, - { - "pname": "System.Security.Cryptography.OpenSsl", - "version": "4.3.0", - "hash": "sha256-DL+D2sc2JrQiB4oAcUggTFyD8w3aLEjJfod5JPe+Oz4=" - }, - { - "pname": "System.Security.Cryptography.Primitives", - "version": "4.3.0", - "hash": "sha256-fnFi7B3SnVj5a+BbgXnbjnGNvWrCEU6Hp/wjsjWz318=" - }, - { - "pname": "System.Security.Cryptography.X509Certificates", - "version": "4.3.0", - "hash": "sha256-MG3V/owDh273GCUPsGGraNwaVpcydupl3EtPXj6TVG0=" - }, - { - "pname": "System.Text.Encoding", - "version": "4.3.0", - "hash": "sha256-GctHVGLZAa/rqkBNhsBGnsiWdKyv6VDubYpGkuOkBLg=" - }, - { - "pname": "System.Text.Encoding.Extensions", - "version": "4.3.0", - "hash": "sha256-vufHXg8QAKxHlujPHHcrtGwAqFmsCD6HKjfDAiHyAYc=" - }, - { - "pname": "System.Text.RegularExpressions", - "version": "4.3.0", - "hash": "sha256-VLCk1D1kcN2wbAe3d0YQM/PqCsPHOuqlBY1yd2Yo+K0=" - }, - { - "pname": "System.Threading", - "version": "4.3.0", - "hash": "sha256-ZDQ3dR4pzVwmaqBg4hacZaVenQ/3yAF/uV7BXZXjiWc=" - }, { "pname": "System.Threading.Channels", "version": "8.0.0", "hash": "sha256-c5TYoLNXDLroLIPnlfyMHk7nZ70QAckc/c7V199YChg=" - }, - { - "pname": "System.Threading.Tasks", - "version": "4.3.0", - "hash": "sha256-Z5rXfJ1EXp3G32IKZGiZ6koMjRu0n8C1NGrwpdIen4w=" - }, - { - "pname": "System.Threading.Tasks.Extensions", - "version": "4.3.0", - "hash": "sha256-X2hQ5j+fxcmnm88Le/kSavjiGOmkcumBGTZKBLvorPc=" - }, - { - "pname": "System.Threading.Timer", - "version": "4.3.0", - "hash": "sha256-pmhslmhQhP32TWbBzoITLZ4BoORBqYk25OWbru04p9s=" - }, - { - "pname": "System.Xml.ReaderWriter", - "version": "4.3.0", - "hash": "sha256-QQ8KgU0lu4F5Unh+TbechO//zaAGZ4MfgvW72Cn1hzA=" - }, - { - "pname": "System.Xml.XDocument", - "version": "4.3.0", - "hash": "sha256-rWtdcmcuElNOSzCehflyKwHkDRpiOhJJs8CeQ0l1CCI=" - }, - { - "pname": "xunit", - "version": "2.5.3", - "hash": "sha256-X4TkN9y/572LnqOX+fiX6dqsqKe/HbAWZq6PhdD0qGM=" - }, - { - "pname": "xunit.abstractions", - "version": "2.0.3", - "hash": "sha256-0D1y/C34iARI96gb3bAOG8tcGPMjx+fMabTPpydGlAM=" - }, - { - "pname": "xunit.analyzers", - "version": "1.4.0", - "hash": "sha256-2m8ikSNvEzQ53rtqhruTpQZpJ+nzI9lhLj0x9w5FKO0=" - }, - { - "pname": "xunit.assert", - "version": "2.5.3", - "hash": "sha256-+cbNHWwm1no316xMJsdzO7TAV7bIlm3dz8dvKHQ66CU=" - }, - { - "pname": "xunit.core", - "version": "2.5.3", - "hash": "sha256-TEL6tBUxWDU9rVOj4KaxBpL+uZQ/3kcZWVDDueeQkhw=" - }, - { - "pname": "xunit.extensibility.core", - "version": "2.5.3", - "hash": "sha256-IjyXgVi/AAnilPsD4IrnqtSrr7Ugu75DguPnI2bVSFs=" - }, - { - "pname": "xunit.extensibility.execution", - "version": "2.5.3", - "hash": "sha256-zN7R4kZGsujpo8aAn4OHdtA0u/r5aeiZaw6A53B69KU=" - }, - { - "pname": "xunit.runner.visualstudio", - "version": "2.5.3", - "hash": "sha256-GZN1E9rOGorQvVSbGTsmXgJxj2TtJwJxCuo+oh+NEBI=" } ] diff --git a/tanks-backend/gen-deps.sh b/tanks-backend/gen-deps.sh index 53e8dca..1ca4ec1 100755 --- a/tanks-backend/gen-deps.sh +++ b/tanks-backend/gen-deps.sh @@ -6,5 +6,5 @@ set -euxo pipefail # nuget-to-json out > deps.json # update -nix build ".?submodules=1#servicepoint-tanks-backend.fetch-deps" +nix build .#servicepoint-tanks-backend.fetch-deps ./result deps.json -- 2.50.1 From a5a3f2cc81e3823ef7e89f94ded0194e61c5095e Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Mon, 29 Sep 2025 18:34:14 +0200 Subject: [PATCH 5/7] add assets and frontend to backend package --- flake.nix | 27 ++++++++++++------ .../TanksServer/GameLogic/CollideBullets.cs | 2 +- .../TanksServer/GameLogic/MapService.cs | 5 ++-- tanks-backend/TanksServer/GlobalUsings.cs | 1 + .../TanksServer/Graphics/DrawPowerUpsStep.cs | 10 +++---- .../TanksServer/Graphics/DrawTanksStep.cs | 2 +- tanks-backend/TanksServer/Program.cs | 28 +++++++++++++++++-- tanks-backend/TanksServer/TanksServer.csproj | 2 +- 8 files changed, 56 insertions(+), 21 deletions(-) diff --git a/flake.nix b/flake.nix index eaa0969..a4cc395 100644 --- a/flake.nix +++ b/flake.nix @@ -5,13 +5,17 @@ nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.05"; binding = { - url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git"; - inputs.nixpkgs.follows = "nixpkgs"; + url = "git+https://git.berlin.ccc.de/servicepoint/servicepoint-binding-csharp.git"; + inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = - { self, nixpkgs, binding }: + { + self, + nixpkgs, + binding, + }: let supported-systems = [ "x86_64-linux" @@ -47,7 +51,7 @@ ]; }; backend-set = { - inputsFrom = [ selfPkgs.servicepoint-tanks-backend ]; + inputsFrom = [ selfPkgs.servicepoint-tanks ]; packages = with pkgs; [ nuget-to-json cargo-tarpaulin @@ -71,7 +75,7 @@ }: { servicepoint-tanks-frontend = pkgs.buildNpmPackage (finalAttrs: { - pname = "tank-frontend"; + pname = "servicepoint-tanks-frontend"; version = "0.0.0"; src = ./tank-frontend; @@ -82,20 +86,27 @@ ''; }); - servicepoint-tanks-backend = pkgs.buildDotnetModule { - pname = "servicepoint-tanks-backend"; + servicepoint-tanks-assets = ./tanks-backend/TanksServer/assets; + + servicepoint-tanks = pkgs.buildDotnetModule { + pname = "servicepoint-tanks"; version = "0.0.0"; dotnet-sdk = pkgs.dotnetCorePackages.sdk_8_0; dotnet-runtime = pkgs.dotnetCorePackages.runtime_8_0; src = ./tanks-backend; - projectFile = "TanksServer/TanksServer.csproj"; + projectFile = "TanksServer/TanksServer.csproj"; nugetDeps = ./tanks-backend/deps.json; selfContainedBuild = true; buildInputs = [ bindingPkgs.servicepoint-binding-csharp ]; + + makeWrapperArgs = [ + "--set-default TANKSSERVER_CLIENT ${selfPkgs.servicepoint-tanks-frontend}" + "--set-default TANKSSERVER_ASSETS ${selfPkgs.servicepoint-tanks-assets}" + ]; }; } ); diff --git a/tanks-backend/TanksServer/GameLogic/CollideBullets.cs b/tanks-backend/TanksServer/GameLogic/CollideBullets.cs index 05dfe5a..bff8ea5 100644 --- a/tanks-backend/TanksServer/GameLogic/CollideBullets.cs +++ b/tanks-backend/TanksServer/GameLogic/CollideBullets.cs @@ -4,7 +4,7 @@ namespace TanksServer.GameLogic; internal sealed class CollideBullets : ITickStep { - private readonly Sprite _explosiveSprite = Sprite.FromImageFile("assets/explosion.png"); + private readonly Sprite _explosiveSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "explosion.png")); private readonly Predicate _removeBulletsPredicate; private readonly MapEntityManager _entityManager; private readonly MapService _map; diff --git a/tanks-backend/TanksServer/GameLogic/MapService.cs b/tanks-backend/TanksServer/GameLogic/MapService.cs index a79bd94..e82b9c6 100644 --- a/tanks-backend/TanksServer/GameLogic/MapService.cs +++ b/tanks-backend/TanksServer/GameLogic/MapService.cs @@ -22,9 +22,10 @@ internal sealed class MapService public MapService() { - foreach (var file in Directory.EnumerateFiles("./assets/maps/", "*.txt")) + var dir = Path.Combine(Program.AssetsDir, "maps"); + foreach (var file in Directory.EnumerateFiles(dir, "*.txt")) LoadMapString(file); - foreach (var file in Directory.EnumerateFiles("./assets/maps/", "*.png")) + foreach (var file in Directory.EnumerateFiles(dir, "*.png")) LoadMapPng(file); Current = GetRandomMap(); } diff --git a/tanks-backend/TanksServer/GlobalUsings.cs b/tanks-backend/TanksServer/GlobalUsings.cs index 5c674f0..5c10eda 100644 --- a/tanks-backend/TanksServer/GlobalUsings.cs +++ b/tanks-backend/TanksServer/GlobalUsings.cs @@ -1,6 +1,7 @@ global using System; global using System.Collections.Concurrent; global using System.Collections.Generic; +global using System.IO; global using System.Linq; global using System.Threading; global using System.Threading.Tasks; diff --git a/tanks-backend/TanksServer/Graphics/DrawPowerUpsStep.cs b/tanks-backend/TanksServer/Graphics/DrawPowerUpsStep.cs index 87076f8..f35094b 100644 --- a/tanks-backend/TanksServer/Graphics/DrawPowerUpsStep.cs +++ b/tanks-backend/TanksServer/Graphics/DrawPowerUpsStep.cs @@ -4,11 +4,11 @@ namespace TanksServer.Graphics; internal sealed class DrawPowerUpsStep(MapEntityManager entityManager) : IDrawStep { - private readonly Sprite _genericSprite = Sprite.FromImageFile("assets/powerup_generic.png"); - private readonly Sprite _smartSprite = Sprite.FromImageFile("assets/powerup_smart.png"); - private readonly Sprite _magazineSprite = Sprite.FromImageFile("assets/powerup_magazine.png"); - private readonly Sprite _explosiveSprite = Sprite.FromImageFile("assets/powerup_explosive.png"); - private readonly Sprite _fastSprite = Sprite.FromImageFile("assets/powerup_fastbullet.png"); + private readonly Sprite _genericSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "powerup_generic.png")); + private readonly Sprite _smartSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "powerup_smart.png")); + private readonly Sprite _magazineSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "powerup_magazine.png")); + private readonly Sprite _explosiveSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "powerup_explosive.png")); + private readonly Sprite _fastSprite = Sprite.FromImageFile(Path.Combine(Program.AssetsDir, "powerup_fastbullet.png")); public void Draw(GamePixelGrid pixels) { diff --git a/tanks-backend/TanksServer/Graphics/DrawTanksStep.cs b/tanks-backend/TanksServer/Graphics/DrawTanksStep.cs index 2b592db..daec4f0 100644 --- a/tanks-backend/TanksServer/Graphics/DrawTanksStep.cs +++ b/tanks-backend/TanksServer/Graphics/DrawTanksStep.cs @@ -5,7 +5,7 @@ namespace TanksServer.Graphics; internal sealed class DrawTanksStep(MapEntityManager entityManager) : IDrawStep { private readonly SpriteSheet _tankSprites = - SpriteSheet.FromImageFile("assets/tank.png", (int)MapService.TileSize, (int)MapService.TileSize); + SpriteSheet.FromImageFile(Path.Combine(Program.AssetsDir, "tank.png"), (int)MapService.TileSize, (int)MapService.TileSize); public void Draw(GamePixelGrid pixels) { diff --git a/tanks-backend/TanksServer/Program.cs b/tanks-backend/TanksServer/Program.cs index e794589..cbac46a 100644 --- a/tanks-backend/TanksServer/Program.cs +++ b/tanks-backend/TanksServer/Program.cs @@ -11,22 +11,44 @@ namespace TanksServer; public static class Program { + internal static string AssetsDir = (Environment.GetEnvironmentVariable("TANKSSERVER_ASSETS") ?? "./assets") + "/"; + [RequiresUnreferencedCode("Calls Endpoints.Map")] [RequiresDynamicCode("Calls Endpoints.Map")] public static async Task Main(string[] args) { var app = Configure(args); - var clientFileProvider = new PhysicalFileProvider(Path.Combine(app.Environment.ContentRootPath, "client")); + app.Logger.LogInformation("Running in {}", app.Environment.ContentRootPath); - app.UseDefaultFiles(new DefaultFilesOptions { FileProvider = clientFileProvider }); - app.UseStaticFiles(new StaticFileOptions { FileProvider = clientFileProvider }); + AddStaticClientHost(app); app.Services.GetRequiredService().Map(app); await app.RunAsync(); } + private static void AddStaticClientHost(WebApplication app) + { + var clientDir = Environment.GetEnvironmentVariable("TANKSSERVER_CLIENT"); + bool required = clientDir != null; + + clientDir ??= Path.Combine(app.Environment.ContentRootPath, "client"); + bool available = Directory.Exists(clientDir); + + if (!available) + { + if (required) + throw new InvalidOperationException($"The environment variable TANKSSERVER_CLIENT is set, but the specified directory {clientDir} does not exist."); + app.Logger.LogError("Not providing static file host for client because {} does not exist", clientDir); + return; + } + + var clientFileProvider = new PhysicalFileProvider(clientDir); + app.UseDefaultFiles(new DefaultFilesOptions { FileProvider = clientFileProvider }); + app.UseStaticFiles(new StaticFileOptions { FileProvider = clientFileProvider }); + } + [RequiresUnreferencedCode("Calls Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure(IConfiguration)")] [RequiresDynamicCode("Calls Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure(IConfiguration)")] private static WebApplication Configure(string[] args) diff --git a/tanks-backend/TanksServer/TanksServer.csproj b/tanks-backend/TanksServer/TanksServer.csproj index 7ba8f60..d1d0acf 100644 --- a/tanks-backend/TanksServer/TanksServer.csproj +++ b/tanks-backend/TanksServer/TanksServer.csproj @@ -26,7 +26,7 @@ - + -- 2.50.1 From dfa7cb5cb1beb4b7028ea748afc7be73ed2df21d Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Mon, 29 Sep 2025 18:43:25 +0200 Subject: [PATCH 6/7] server starts now, add app --- flake.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/flake.nix b/flake.nix index a4cc395..ba0d31e 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,20 @@ ); in { + apps = forAllSystems ( + { + pkgs, + lib, + selfPkgs, + ... + }: + { + default = { + type = "app"; + program = "${lib.getBin selfPkgs.servicepoint-tanks}/bin/TanksServer"; + }; + } + ); devShells = forAllSystems ( { pkgs, @@ -103,6 +117,8 @@ buildInputs = [ bindingPkgs.servicepoint-binding-csharp ]; + runtimeDeps = [ bindingPkgs.servicepoint-binding-uniffi ]; + makeWrapperArgs = [ "--set-default TANKSSERVER_CLIENT ${selfPkgs.servicepoint-tanks-frontend}" "--set-default TANKSSERVER_ASSETS ${selfPkgs.servicepoint-tanks-assets}" -- 2.50.1 From 4666eb31ece7ab5e313efd4f4910de7d860c67d8 Mon Sep 17 00:00:00 2001 From: Vinzenz Schroeter Date: Mon, 29 Sep 2025 18:56:38 +0200 Subject: [PATCH 7/7] update README.md --- README.md | 85 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 5e66054..0b5beff 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,56 @@ -### Backend +## Building and running + +### With Nix + +Using the power of nix, you can just `nix run git+https://git.berlin.ccc.de/vinzenz/servicepoint-tanks`! + +To build from local source: + +```bash +# no submodules required +git clone https://github.com/kaesaecracker/servicepoint-tanks.git +cd servicepoint-tanks +nix build .# +result/bin/TanksServer +``` + +You can also use the provided devShells (`nix develop .#`) and follow the manual steps. + +For proper IDE suggestions, you may need to initialize the submodules. They are not used for building by Nix though. + +### The hard way + +```bash +# initialize the submodules +git clone https://github.com/kaesaecracker/servicepoint-tanks.git +cd servicepoint-tanks +git submodule update --init --recursive + +# build +cd tank-frontent +npm install +npm run build +cd ../tanks-backend +dotnet build +``` + +The Docker builds are currently broken and need some updates for the new library repo structure. + + +## Backend @@ -18,7 +67,7 @@ - some values (like tank speed) can be configured but are fixed at run time - By default, the backend also hosts the frontend -### Frontend +## Frontend @@ -28,9 +77,9 @@ - Sends user input to server - real time communication via WebSockets, HTTP for the REST -### Binary formats +## Binary formats -#### Controls WebSocket +### Controls WebSocket - Client sends 2 byte messages. - on or off: `0x01` or `0x02` @@ -55,31 +104,3 @@ - 10: bullet - 11: (reserved) - client responds with empty message to request the next frame - -# Building - -```bash -# checkout repo and submodules -git clone https://github.com/kaesaecracker/servicepoint-tanks.git -cd servicepoint-tanks -git submodule update --init -cd tanks-backend/servicepoint -git submodule update --init -cd ../.. - -# build with nix-shell -nix-shell -cd tank-frontent -npm install -npm run build -cd ../tanks-backend -dotnet build - -# build with docker/podman -cd tanks-backend -docker build . -cd ../tank-frontend -docker build . -cd .. -docker build . -``` -- 2.50.1