Files
nixpkgs/pkgs/by-name/ex/exatorrent/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

79 lines
1.9 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
fetchNpmDeps,
npmHooks,
nodejs,
withUI ? true,
}:
buildGoModule (finalAttrs: {
pname = "exatorrent";
version = "1.3.0";
src = fetchFromGitHub {
owner = "varbhat";
repo = "exatorrent";
tag = "v${finalAttrs.version}";
hash = "sha256-FvL3ekpj1HwARgY3vj0xAwCgDBa97OqtFFY4rSBKr50=";
};
nativeBuildInputs = lib.optionals withUI [
npmHooks.npmConfigHook
nodejs
];
npmRoot = "internal/web";
npmDeps =
if withUI then
fetchNpmDeps {
name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps";
inherit (finalAttrs) src;
sourceRoot = "${finalAttrs.src.name}/${finalAttrs.npmRoot}";
hash = "sha256-eNrBKTW4KlLNf/Y9NTvGt5r28MG7SLGzUi+p9mOyrmI=";
}
else
null;
preBuild = lib.optionalString withUI ''
pushd "$npmRoot"
npm run build
popd
'';
# I dislike the fact that buildGoModule's fetcher FOD automatically inherits some attrs from the non-FOD part
overrideModAttrs = prev: {
nativeBuildInputs = lib.filter (e: e != npmHooks.npmConfigHook) prev.nativeBuildInputs;
preBuild = "";
};
vendorHash = "sha256-fE+GVQ2HAfElO1UDmDMeu2ca7t5yNs83CXhqgT0t1Js=";
tags = lib.optionals (!withUI) [ "noui" ];
ldflags = [
"-s"
"-w"
]
++ lib.optionals stdenv.hostPlatform.isGnu [
# upstream also tries to compile statically if possible
"-extldflags '-static'"
];
buildInputs = lib.optionals stdenv.hostPlatform.isGnu [
stdenv.cc.libc.static
];
meta = {
changelog = "https://github.com/varbhat/exatorrent/releases/tag/${finalAttrs.src.tag}";
description = "Self-hostable, easy-to-use, lightweight, and feature-rich torrent client written in Go";
homepage = "https://github.com/varbhat/exatorrent/";
license = lib.licenses.gpl3Only;
mainProgram = "exatorrent";
maintainers = with lib.maintainers; [ tomasajt ];
};
})