From 600e7383d00984f5d5d734058e3f0fe19666bed3 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 20 Jul 2025 22:13:54 +0000 Subject: [PATCH] build slsk-batchdl using dotnet 8 thanks to help from claude, not sure if i'm actually doing any of this correctly --- pkgs/slsk-batchdl/nuget-deps.nix | 248 ++++++++++++++++++ pkgs/slsk-batchdl/package.nix | 39 +++ .../nmasur/presets/programs/slsk-batchdl.nix | 21 ++ .../nixos/modules/nmasur/profiles/nas.nix | 1 + 4 files changed, 309 insertions(+) create mode 100644 pkgs/slsk-batchdl/nuget-deps.nix create mode 100644 pkgs/slsk-batchdl/package.nix create mode 100644 platforms/nixos/modules/nmasur/presets/programs/slsk-batchdl.nix diff --git a/pkgs/slsk-batchdl/nuget-deps.nix b/pkgs/slsk-batchdl/nuget-deps.nix new file mode 100644 index 0000000..041708d --- /dev/null +++ b/pkgs/slsk-batchdl/nuget-deps.nix @@ -0,0 +1,248 @@ +{ fetchNuGet }: +[ + (fetchNuGet { + pname = "AngleSharp"; + version = "1.2.0"; + hash = "sha256-l8+Var9o773VL6Ybih3boaFf9sYjS7eqtLGd8DCIPsk="; + }) + (fetchNuGet { + pname = "EmbedIO"; + version = "3.5.2"; + hash = "sha256-e6GfVHXxYeUw3ntCrHokNoAS6mXArO7+vdMeUFnsSo8="; + }) + (fetchNuGet { + pname = "Goblinfactory.ProgressBar"; + version = "1.0.0"; + hash = "sha256-tV3Fw792zfYhB2dN97VKXBwS5eypqKExgAJy+bcDo8I="; + }) + (fetchNuGet { + pname = "Google.Apis"; + version = "1.69.0"; + hash = "sha256-/9JN0CZIFZnmGS69ki38RlNzQiwp4yO0MFDeRk1slsg="; + }) + (fetchNuGet { + pname = "Google.Apis.Auth"; + version = "1.69.0"; + hash = "sha256-T6n3hc+KpgHNqQQeJLOmgHQWkjBvnhIob5giHabREV8="; + }) + (fetchNuGet { + pname = "Google.Apis.Core"; + version = "1.69.0"; + hash = "sha256-IW1AOY8o6hHkrc/tINsS/VCOUrOSoXb6OCSEF6gamkc="; + }) + (fetchNuGet { + pname = "Google.Apis.YouTube.v3"; + version = "1.69.0.3680"; + hash = "sha256-3aNScBqmchnDkLejK5HYHiLVVDexrFUtZ6xe8cGP28M="; + }) + (fetchNuGet { + pname = "HtmlAgilityPack"; + version = "1.11.72"; + hash = "sha256-MRt7yj6+/ORmr2WBERpQ+1gMRzIaPFKddHoB4zZmv2k="; + }) + (fetchNuGet { + pname = "Microsoft.ApplicationInsights"; + version = "2.22.0"; + hash = "sha256-mUQ63atpT00r49ca50uZu2YCiLg3yd6r3HzTryqcuEA="; + }) + (fetchNuGet { + pname = "Microsoft.AspNetCore.App.Ref"; + version = "6.0.36"; + hash = "sha256-9jDkWbjw/nd8yqdzVTagCuqr6owJ/DUMi4BlUZT4hWU="; + }) + (fetchNuGet { + pname = "Microsoft.Bcl.AsyncInterfaces"; + version = "9.0.1"; + hash = "sha256-A3W2Hvhlf1ODx1NYWHwUyziZOGMaDPvXHZ/ubgNLYJA="; + }) + (fetchNuGet { + pname = "Microsoft.CodeCoverage"; + version = "17.9.0"; + hash = "sha256-OaGa4+jRPHs+T+p/oekm2Miluqfd2IX8Rt+BmUx8kr4="; + }) + (fetchNuGet { + pname = "Microsoft.CSharp"; + version = "4.7.0"; + hash = "sha256-Enknv2RsFF68lEPdrf5M+BpV1kHoLTVRApKUwuk/pj0="; + }) + (fetchNuGet { + pname = "Microsoft.NET.Test.Sdk"; + version = "17.9.0"; + hash = "sha256-q/1AJ7eNlk02wvN76qvjl2xBx5iJ+h5ssiE/4akLmtI="; + }) + (fetchNuGet { + pname = "Microsoft.NETCore.App.Host.linux-x64"; + version = "6.0.36"; + hash = "sha256-VFRDzx7LJuvI5yzKdGmw/31NYVbwHWPKQvueQt5xc10="; + }) + (fetchNuGet { + pname = "Microsoft.NETCore.App.Ref"; + version = "6.0.36"; + hash = "sha256-9LZgVoIFF8qNyUu8kdJrYGLutMF/cL2K82HN2ywwlx8="; + }) + (fetchNuGet { + pname = "Microsoft.Testing.Extensions.Telemetry"; + version = "1.5.3"; + hash = "sha256-bIXwPSa3jkr2b6xINOqMUs6/uj/r4oVFM7xq3uVIZDU="; + }) + (fetchNuGet { + pname = "Microsoft.Testing.Extensions.TrxReport.Abstractions"; + version = "1.5.3"; + hash = "sha256-IfMRfcyaIKEMRtx326ICKtinDBEfGw/Sv8ZHawJ96Yc="; + }) + (fetchNuGet { + pname = "Microsoft.Testing.Extensions.VSTestBridge"; + version = "1.5.3"; + hash = "sha256-XpM/yFjhLSsuzyDV+xKubs4V1zVVYiV05E0+N4S1h0g="; + }) + (fetchNuGet { + pname = "Microsoft.Testing.Platform"; + version = "1.5.3"; + hash = "sha256-y61Iih6w5D79dmrj2V675mcaeIiHoj1HSa1FRit2BLM="; + }) + (fetchNuGet { + pname = "Microsoft.Testing.Platform.MSBuild"; + version = "1.5.3"; + hash = "sha256-YspvjE5Jfi587TAfsvfDVJXNrFOkx1B3y1CKV6m7YLY="; + }) + (fetchNuGet { + pname = "Microsoft.TestPlatform.ObjectModel"; + version = "17.12.0"; + hash = "sha256-3XBHBSuCxggAIlHXmKNQNlPqMqwFlM952Av6RrLw1/w="; + }) + (fetchNuGet { + pname = "Microsoft.TestPlatform.ObjectModel"; + version = "17.9.0"; + hash = "sha256-iiXUFzpvT8OWdzMj9FGJDqanwHx40s1TXVY9l3ii+s0="; + }) + (fetchNuGet { + pname = "Microsoft.TestPlatform.TestHost"; + version = "17.9.0"; + hash = "sha256-1BZIY1z+C9TROgdTV/tq4zsPy7Q71GQksr/LoMKAzqU="; + }) + (fetchNuGet { + pname = "MSTest.Analyzers"; + version = "3.7.3"; + hash = "sha256-6mNfHtx9FBWA6/QrRUepwbxXWG/54GRyeZYazDiMacg="; + }) + (fetchNuGet { + pname = "MSTest.TestAdapter"; + version = "3.7.3"; + hash = "sha256-3O/AXeS+3rHWstinivt73oa0QDp+xQpTc9p46EF+Mtc="; + }) + (fetchNuGet { + pname = "MSTest.TestFramework"; + version = "3.7.3"; + hash = "sha256-RweCMMf14GI6HqjDIP68JM67IaJKYQTZy0jk5Q4DFxs="; + }) + (fetchNuGet { + pname = "Newtonsoft.Json"; + version = "13.0.1"; + hash = "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo="; + }) + (fetchNuGet { + pname = "Newtonsoft.Json"; + version = "13.0.3"; + hash = "sha256-hy/BieY4qxBWVVsDqqOPaLy1QobiIapkbrESm6v2PHc="; + }) + (fetchNuGet { + pname = "SmallestCSVParser"; + version = "1.1.1"; + hash = "sha256-64E87w+4FcQtYsFIOMGGmYmjXVGBwsBqgLVb7p0wc04="; + }) + (fetchNuGet { + pname = "Soulseek"; + version = "7.1.0"; + hash = "sha256-n6LUNuPmmy9QYNNALR0ObYyR9LJalf0H8P+SKnoqfFc="; + }) + (fetchNuGet { + pname = "SpotifyAPI.Web"; + version = "7.2.1"; + hash = "sha256-gbTLJaj7DSXZQlo0xpegZ8HLruMe6WmDyD8+l6YE3hg="; + }) + (fetchNuGet { + pname = "SpotifyAPI.Web.Auth"; + version = "7.2.1"; + hash = "sha256-uzpyPlXNCuSHrcK4SKH0ydY2HlDKXU51W5ahk2Oqu98="; + }) + (fetchNuGet { + pname = "System.Buffers"; + version = "4.5.1"; + hash = "sha256-wws90sfi9M7kuCPWkv1CEYMJtCqx9QB/kj0ymlsNaxI="; + }) + (fetchNuGet { + pname = "System.CodeDom"; + version = "7.0.0"; + hash = "sha256-7IPt39cY+0j0ZcRr/J45xPtEjnSXdUJ/5ai3ebaYQiE="; + }) + (fetchNuGet { + pname = "System.Diagnostics.DiagnosticSource"; + version = "5.0.0"; + hash = "sha256-6mW3N6FvcdNH/pB58pl+pFSCGWgyaP4hfVtC/SMWDV4="; + }) + (fetchNuGet { + pname = "System.IO.Pipelines"; + version = "9.0.1"; + hash = "sha256-CnmDanknCGbNnoDjgZw62M/Grg8IMTJDa8x3P07UR2A="; + }) + (fetchNuGet { + pname = "System.Management"; + version = "7.0.2"; + hash = "sha256-bJ21ILQfbHb8mX2wnVh7WP/Ip7gdVPIw+BamQuifTVY="; + }) + (fetchNuGet { + pname = "System.Memory"; + version = "4.5.5"; + hash = "sha256-EPQ9o1Kin7KzGI5O3U3PUQAZTItSbk9h/i4rViN3WiI="; + }) + (fetchNuGet { + pname = "System.Memory"; + version = "4.6.0"; + hash = "sha256-OhAEKzUM6eEaH99DcGaMz2pFLG/q/N4KVWqqiBYUOFo="; + }) + (fetchNuGet { + pname = "System.Reflection.Metadata"; + version = "1.6.0"; + hash = "sha256-JJfgaPav7UfEh4yRAQdGhLZF1brr0tUWPl6qmfNWq/E="; + }) + (fetchNuGet { + pname = "System.Runtime.CompilerServices.Unsafe"; + version = "6.0.0"; + hash = "sha256-bEG1PnDp7uKYz/OgLOWs3RWwQSVYm+AnPwVmAmcgp2I="; + }) + (fetchNuGet { + pname = "System.Text.Encodings.Web"; + version = "9.0.1"; + hash = "sha256-iuAVcTiiZQLCZjDfDqdLLPHqZdZqvFabwLFHiVYdRJo="; + }) + (fetchNuGet { + pname = "System.Text.Json"; + version = "9.0.1"; + hash = "sha256-2dqE+Mx5eJZ8db74ofUiUXHOSxDCmXw5n9VC9w4fUr0="; + }) + (fetchNuGet { + pname = "System.Threading.Tasks.Extensions"; + version = "4.6.0"; + hash = "sha256-OwIB0dpcdnyfvTUUj6gQfKW2XF2pWsQhykwM1HNCHqY="; + }) + (fetchNuGet { + pname = "System.ValueTuple"; + version = "4.5.0"; + hash = "sha256-niH6l2fU52vAzuBlwdQMw0OEoRS/7E1w5smBFoqSaAI="; + }) + (fetchNuGet { + pname = "TagLibSharp"; + version = "2.3.0"; + hash = "sha256-PD9bVZiPaeC8hNx2D+uDUf701cCaMi2IRi5oPTNN+/w="; + }) + (fetchNuGet { + pname = "Unosquare.Swan.Lite"; + version = "3.1.0"; + hash = "sha256-PL8N3CqIz/wku8/mkRMC3X868Byv47C20/rBLBhkS3o="; + }) + (fetchNuGet { + pname = "YoutubeExplode"; + version = "6.5.4"; + hash = "sha256-5sexIiBj5XP9rP5DA0NQ+vHJ9lpjwp00EvVux901WLc="; + }) +] diff --git a/pkgs/slsk-batchdl/package.nix b/pkgs/slsk-batchdl/package.nix new file mode 100644 index 0000000..4bd3d12 --- /dev/null +++ b/pkgs/slsk-batchdl/package.nix @@ -0,0 +1,39 @@ +{ + lib, + buildDotnetModule, + fetchFromGitHub, + dotnetCorePackages, +}: + +buildDotnetModule rec { + pname = "slsk-batchdl"; + version = "2.4.7"; + + src = fetchFromGitHub { + owner = "fiso64"; + repo = "slsk-batchdl"; + rev = "v${version}"; + sha256 = "sha256-P7V7YJUA1bkfp13Glb1Q+NJ7iTya/xgO1TM88z1Nddc="; + }; + + projectFile = "slsk-batchdl/slsk-batchdl.csproj"; + nugetDeps = ./nuget-deps.nix; + + dotnet-sdk = dotnetCorePackages.sdk_8_0; + dotnet-runtime = dotnetCorePackages.runtime_8_0; + + # Patch the project file to use .NET 8 + postPatch = '' + substituteInPlace slsk-batchdl/slsk-batchdl.csproj \ + --replace-fail "net6.0" "net8.0" + ''; + + doCheck = false; + + meta = with lib; { + description = "A batch downloader for Soulseek"; + homepage = "https://github.com/fiso64/slsk-batchdl"; + platforms = platforms.linux; + mainProgram = "slsk-batchdl"; + }; +} diff --git a/platforms/nixos/modules/nmasur/presets/programs/slsk-batchdl.nix b/platforms/nixos/modules/nmasur/presets/programs/slsk-batchdl.nix new file mode 100644 index 0000000..465441f --- /dev/null +++ b/platforms/nixos/modules/nmasur/presets/programs/slsk-batchdl.nix @@ -0,0 +1,21 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + cfg = config.nmasur.presets.programs.slsk-batchdl; +in + +{ + + options.nmasur.presets.programs.slsk-batchdl.enable = lib.mkEnableOption "slsk downloader"; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [ + pkgs.nmasur.slsk-batchdl + ]; + }; +} diff --git a/platforms/nixos/modules/nmasur/profiles/nas.nix b/platforms/nixos/modules/nmasur/profiles/nas.nix index d07411b..35a65f2 100644 --- a/platforms/nixos/modules/nmasur/profiles/nas.nix +++ b/platforms/nixos/modules/nmasur/profiles/nas.nix @@ -18,6 +18,7 @@ in zfs.enable = lib.mkDefault true; programs = { msmtp.enable = lib.mkDefault true; + slsk-batchdl.enable = lib.mkDefault true; }; services = { arrs.enable = lib.mkDefault true;