2021-04-18 13:55:08 +00:00
|
|
|
{ stdenvNoCC
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, unzip
|
|
|
|
, version
|
2022-02-20 09:15:30 +00:00
|
|
|
, sha256
|
2021-04-18 13:55:08 +00:00
|
|
|
, useMklink ? false
|
|
|
|
, customSymlinkCommand ? null
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "losslesscut";
|
|
|
|
nameRepo = "lossless-cut";
|
|
|
|
nameCamel = "LosslessCut";
|
|
|
|
nameSourceBase = "${nameCamel}-win";
|
|
|
|
nameSource = "${nameSourceBase}.zip";
|
|
|
|
nameExecutable = "${nameCamel}.exe";
|
|
|
|
owner = "mifi";
|
|
|
|
getSymlinkCommand = if (customSymlinkCommand != null) then customSymlinkCommand
|
|
|
|
else if useMklink then (targetPath: linkPath: "mklink ${targetPath} ${linkPath}")
|
|
|
|
else (targetPath: linkPath: "ln -s ${targetPath} ${linkPath}");
|
|
|
|
in stdenvNoCC.mkDerivation {
|
2022-02-20 09:15:30 +00:00
|
|
|
inherit pname version sha256;
|
2021-04-18 13:55:08 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
name = nameSource;
|
|
|
|
url = "https://github.com/${owner}/${nameRepo}/releases/download/v${version}/${nameSource}";
|
2022-02-20 09:15:30 +00:00
|
|
|
inherit sha256;
|
2021-04-18 13:55:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
unzip $src -d ${nameSourceBase}
|
|
|
|
'';
|
|
|
|
|
|
|
|
sourceRoot = nameSourceBase;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/libexec
|
|
|
|
cd ..
|
|
|
|
mv ${nameSourceBase} $out/libexec
|
|
|
|
|
|
|
|
'' + (getSymlinkCommand "${nameSourceBase}/${nameExecutable}" "$out/bin/${nameExecutable}");
|
|
|
|
|
|
|
|
meta.platforms = lib.platforms.windows;
|
|
|
|
}
|