nixpkgs/pkgs/by-name/to/torrentstream/package.nix
Yueh-Shun Li 91b3db1309 treewide: fix sourceRoot for fetchgit-based src
According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the
`sourceRoot` attribute passed to `stdenv.mkDerivation` should be
specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is
produced using `fetchgit`-based fetchers.

`sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on
the assumption that the `name` attribute of these pre-unpacked fetchers
are always `"source"`, which is not the case. Expecting constant `name`
also makes the source FODs prone to irrelevent hashes during version
bumps.

[1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot
[2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11
2024-03-09 07:53:25 +08:00

47 lines
1.3 KiB
Nix

{ lib
, buildDotnetModule
, fetchFromGitHub
, dotnetCorePackages
, fetchpatch
}:
buildDotnetModule rec {
pname = "torrentstream";
version = "1.0.1.6";
src = fetchFromGitHub {
owner = "trueromanus";
repo = "TorrentStream";
rev = version;
hash = "sha256-41zlzrQ+YGY2wEvq4Su/lp6lOmGW4u0F37ub2a3z+7o=";
};
sourceRoot = "${src.name}/src";
projectFile = "TorrentStream.sln";
nugetDeps = ./deps.nix;
dotnet-sdk = dotnetCorePackages.sdk_7_0;
dotnet-runtime = dotnetCorePackages.aspnetcore_7_0;
executables = [ "TorrentStream" ];
patches = [
(fetchpatch {
name = "allow-setting-listen-address.patch";
url = "https://github.com/trueromanus/TorrentStream/compare/1.0.1.6..6900b6f33f2b4b94888a8a1355029a81767e66a4.patch";
hash = "sha256-jOUs5SO2BnNnkz3wJ710Z4stVlhZ8nKqpmHr4BNlGs0=";
stripLen = 1;
excludes = [ "README.md" ];
})
./0001-display-the-message-of-caught-exceptions.patch
];
meta = {
homepage = "https://github.com/trueromanus/TorrentStream";
description = "Simple web server for streaming torrent files in video players";
license = lib.licenses.bsd2;
platforms = lib.platforms.all;
mainProgram = "TorrentStream";
maintainers = with lib.maintainers; [ _3JlOy-PYCCKUi ];
};
}