Files
nixpkgs/pkgs/by-name/so/soundalike/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

74 lines
1.8 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitea,
chromaprint,
makeWrapper,
versionCheckHook,
}:
buildGoModule rec {
pname = "soundalike";
version = "0.1.2";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "derat";
repo = "soundalike";
tag = "v${version}";
hash = "sha256-mpYUVTj3Zll6kNuK5Mdzv1R7k5FZy6XFghhzmAPPVM8=";
};
vendorHash = "sha256-7hRezOBcjB2wsx/SwV519wg3Azh+0kHMcAoc9aYPM3A=";
ldflags = [
"-s"
"-w"
"-X"
"main.buildVersion=${version}"
];
nativeBuildInputs = [
makeWrapper
chromaprint
];
doCheck = true;
# need to grab another repo for music test data
testDataVersion = "0.0.1";
testData = fetchFromGitea {
domain = "codeberg.org";
owner = "derat";
repo = "soundalike-testdata";
tag = "v${testDataVersion}";
hash = "sha256-7JQTnEjoYiiaQlnxsGcfj/9PYDWAkWq4/oxyczjEMo4=";
};
preCheck = ''
# add soundalike to PATH to be available for unit tests
export PATH="$GOPATH/bin:$PATH"
# need to symlink test data to a relative path
# that the unit tests are expecting
ln -sfv ${testData} ./testdata
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "-version";
doInstallCheck = true;
# soundalike depends on fpcalc (chromparint) at runtime, so we
# need to use wrapProgram to make it available
postInstall = ''
wrapProgram $out/bin/soundalike \
--prefix PATH : ${lib.makeBinPath [ chromaprint ]}
'';
meta = {
description = "Find duplicate audio files using acoustic fingerprints";
homepage = "https://codeberg.org/derat/soundalike";
changelog = "https://codeberg.org/derat/soundalike/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ atar13 ];
mainProgram = "soundalike";
};
}