forked from mirrors/nixpkgs
Merge pull request #154838 from ShamrockLee/losslesscut-bin
Closes https://github.com/NixOS/nixpkgs/issues/176962
This commit is contained in:
commit
3348d25fcf
|
@ -1,44 +0,0 @@
|
|||
{ appimageTools, lib, fetchurl, version, sha256 }:
|
||||
|
||||
let
|
||||
pname = "losslesscut";
|
||||
nameRepo = "lossless-cut";
|
||||
nameCamel = "LosslessCut";
|
||||
name = "${pname}-${version}";
|
||||
nameSource = "${nameCamel}-linux-x86_64.AppImage";
|
||||
nameExecutable = "losslesscut";
|
||||
owner = "mifi";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/${owner}/${nameRepo}/releases/download/v${version}/${nameSource}";
|
||||
name = nameSource;
|
||||
inherit sha256;
|
||||
};
|
||||
extracted = appimageTools.extractType2 {
|
||||
inherit name src;
|
||||
};
|
||||
in appimageTools.wrapType2 {
|
||||
inherit name src;
|
||||
|
||||
profile = ''
|
||||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
extraPkgs = ps: appimageTools.defaultFhsEnvArgs.multiPkgs ps;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${name},${nameExecutable}}
|
||||
(
|
||||
mkdir -p $out/share
|
||||
cd ${extracted}/usr
|
||||
find share -mindepth 1 -type d -exec mkdir -p $out/{} \;
|
||||
find share -mindepth 1 -type f,l -exec ln -s $PWD/{} $out/{} \;
|
||||
)
|
||||
ln -s ${extracted}/${nameExecutable}.png $out/share/icons/${nameExecutable}.png
|
||||
mkdir $out/share/applications
|
||||
cp ${extracted}/${nameExecutable}.desktop $out/share/applications
|
||||
substituteInPlace $out/share/applications/${nameExecutable}.desktop \
|
||||
--replace AppRun ${nameExecutable}
|
||||
'';
|
||||
|
||||
meta.platforms = with lib.platforms; [ "x86_64-linux" ];
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
{ lib
|
||||
, appimageTools
|
||||
, fetchurl
|
||||
, makeWrapper
|
||||
, gtk3
|
||||
, gsettings-desktop-schemas
|
||||
, pname
|
||||
, version
|
||||
, hash
|
||||
, metaCommon ? { }
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "losslesscut";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/mifi/lossless-cut/releases/download/v${version}/LosslessCut-linux-x86_64.AppImage";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
extracted = appimageTools.extractType2 {
|
||||
inherit pname version src;
|
||||
};
|
||||
in
|
||||
(appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
profile = ''
|
||||
export LC_ALL=C.UTF-8
|
||||
'';
|
||||
|
||||
extraPkgs = ps: appimageTools.defaultFhsEnvArgs.multiPkgs ps;
|
||||
|
||||
extraInstallCommands = ''
|
||||
mv $out/bin/{${pname}-${version},losslesscut}
|
||||
(
|
||||
mkdir -p $out/share
|
||||
cd ${extracted}/usr
|
||||
find share -mindepth 1 -type d -exec mkdir -p $out/{} \;
|
||||
find share -mindepth 1 -type f,l -exec ln -s $PWD/{} $out/{} \;
|
||||
)
|
||||
ln -s ${extracted}/losslesscut.png $out/share/icons/losslesscut.png
|
||||
mkdir $out/share/applications
|
||||
cp ${extracted}/losslesscut.desktop $out/share/applications
|
||||
substituteInPlace $out/share/applications/losslesscut.desktop \
|
||||
--replace AppRun losslesscut
|
||||
source "${makeWrapper}/nix-support/setup-hook"
|
||||
wrapProgram "$out/bin/losslesscut" \
|
||||
--add-flags "--disable-seccomp-filter-sandbox"
|
||||
'';
|
||||
|
||||
meta = metaCommon // {
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "losslesscut";
|
||||
};
|
||||
}) // {
|
||||
inherit pname version;
|
||||
}
|
37
pkgs/applications/video/losslesscut-bin/build-from-dmg.nix
Normal file
37
pkgs/applications/video/losslesscut-bin/build-from-dmg.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ lib
|
||||
, stdenvNoCC
|
||||
, fetchurl
|
||||
, undmg
|
||||
, pname
|
||||
, version
|
||||
, hash
|
||||
, isAarch64
|
||||
, metaCommon ? { }
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "losslesscut";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/mifi/lossless-cut/releases/download/v${version}/LosslessCut-mac-${if isAarch64 then "arm64" else "x64"}.dmg";
|
||||
inherit hash;
|
||||
};
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
inherit pname version src;
|
||||
|
||||
nativeBuildInputs = [ undmg ];
|
||||
|
||||
sourceRoot = "LosslessCut.app";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/Applications/LosslessCut.app"
|
||||
cp -R . "$out/Applications/LosslessCut.app"
|
||||
mkdir -p "$out/bin"
|
||||
ln -s "$out/Applications/LosslessCut.app/Contents/MacOS/LosslessCut" "$out/bin/losslesscut"
|
||||
'';
|
||||
|
||||
meta = metaCommon // (with lib; {
|
||||
platforms = singleton (if isAarch64 then "aarch64-darwin" else "x86_64-darwin");
|
||||
mainProgram = "losslesscut";
|
||||
});
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
{ lib
|
||||
, stdenvNoCC
|
||||
, fetchurl
|
||||
, p7zip
|
||||
, pname
|
||||
, version
|
||||
, hash
|
||||
, metaCommon ? { }
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
inherit pname version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/mifi/lossless-cut/releases/download/v${version}/LosslessCut-win-x64.7z";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ p7zip ];
|
||||
|
||||
unpackPhase = ''
|
||||
7z x $src -oLosslessCut-win-x64
|
||||
'';
|
||||
|
||||
sourceRoot = "LosslessCut-win-x64";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/libexec
|
||||
(cd .. && mv LosslessCut-win-x64 $out/libexec)
|
||||
ln -s "$out/libexec/LosslessCut-win-x64/LosslessCut.exe" "$out/bin/LosslessCut.exe"
|
||||
'';
|
||||
|
||||
meta = metaCommon // (with lib; {
|
||||
platforms = platforms.windows;
|
||||
mainProgram = "LosslessCut.exe";
|
||||
});
|
||||
}
|
|
@ -1,24 +1,54 @@
|
|||
{ callPackage, stdenvNoCC, lib }:
|
||||
{ lib
|
||||
, callPackage
|
||||
, buildPackages
|
||||
, hostPlatform
|
||||
}:
|
||||
|
||||
let
|
||||
version = "3.46.2";
|
||||
appimage = callPackage ./appimage.nix { inherit version; sha256 = "sha256-p+HscYsChR90JHdYjurY4OOHgveGXbJomz1klBCsF2Q="; };
|
||||
dmg = callPackage ./dmg.nix { inherit version; sha256 = "sha256-350MHWwyjCdvIv6W6lX6Hr6PLDiAwO/e+KW0yKi/Yoc="; };
|
||||
windows = callPackage ./windows.nix { inherit version; sha256 = "sha256-48ifhvIWSPmmnBnW8tP7NeWPIWJYWNqGP925O50CAwQ="; };
|
||||
in (
|
||||
if stdenvNoCC.isDarwin then dmg
|
||||
else if stdenvNoCC.isCygwin then windows
|
||||
else appimage
|
||||
).overrideAttrs
|
||||
(oldAttrs: {
|
||||
meta = with lib; {
|
||||
pname = "losslesscut";
|
||||
version = "3.48.2";
|
||||
metaCommon = with lib; {
|
||||
description = "The swiss army knife of lossless video/audio editing";
|
||||
homepage = "https://mifi.no/losslesscut/";
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = with maintainers; [ ShamrockLee ];
|
||||
} // oldAttrs.meta // {
|
||||
platforms =
|
||||
appimage.meta.platforms
|
||||
++ dmg.meta.platforms
|
||||
++ windows.meta.platforms;
|
||||
};
|
||||
})
|
||||
x86_64-appimage = callPackage ./build-from-appimage.nix {
|
||||
inherit pname version metaCommon;
|
||||
hash = "sha256-5T5+eBVbyOI89YA9NMLWweHagD09RB3P03HFvaDAOZ8=";
|
||||
inherit (buildPackages) makeWrapper;
|
||||
};
|
||||
x86_64-dmg = callPackage ./build-from-dmg.nix {
|
||||
inherit pname version metaCommon;
|
||||
hash = "sha256-PzjE0oJOuPG0S+mA7pgNU3MRgaE2jAPxWEN9J4PfqMQ=";
|
||||
isAarch64 = false;
|
||||
};
|
||||
aarch64-dmg = callPackage ./build-from-dmg.nix {
|
||||
inherit pname version metaCommon;
|
||||
hash = "sha256-927CSczgFJcbBJm2cYXucFRidkGAtcowoLMlm2GTafc=";
|
||||
isAarch64 = true;
|
||||
};
|
||||
x86_64-windows = callPackage ./build-from-windows.nix {
|
||||
inherit pname version metaCommon;
|
||||
hash = "sha256-+isxkGKxW7H+IjuA5G4yXuvDmX+4UlsD8sXwoHxgLM8=";
|
||||
};
|
||||
in
|
||||
(
|
||||
if hostPlatform.system == "aarch64-darwin" then aarch64-dmg
|
||||
else if hostPlatform.isDarwin then x86_64-dmg
|
||||
else if hostPlatform.isCygwin then x86_64-windows
|
||||
else x86_64-appimage
|
||||
).overrideAttrs
|
||||
(oldAttrs: {
|
||||
passthru = (oldAttrs.passthru or { }) // {
|
||||
inherit x86_64-appimage x86_64-dmg aarch64-dmg x86_64-windows;
|
||||
};
|
||||
meta = oldAttrs.meta // {
|
||||
platforms = lib.unique (
|
||||
x86_64-appimage.meta.platforms
|
||||
++ x86_64-dmg.meta.platforms
|
||||
++ aarch64-dmg.meta.platforms
|
||||
++ x86_64-windows.meta.platforms
|
||||
);
|
||||
};
|
||||
})
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{ stdenvNoCC, lib, fetchurl, undmg, version , sha256 }:
|
||||
|
||||
let
|
||||
pname = "losslesscut";
|
||||
nameRepo = "lossless-cut";
|
||||
nameCamel = "LosslessCut";
|
||||
nameSource = "${nameCamel}-mac-x64.dmg";
|
||||
nameApp = nameCamel + ".app";
|
||||
owner = "mifi";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/${owner}/${nameRepo}/releases/download/v${version}/${nameSource}";
|
||||
name = nameSource;
|
||||
inherit sha256;
|
||||
};
|
||||
in stdenvNoCC.mkDerivation {
|
||||
inherit pname version src;
|
||||
|
||||
nativeBuildInputs = [ undmg ];
|
||||
|
||||
unpackPhase = ''
|
||||
undmg ${src}
|
||||
'';
|
||||
sourceRoot = nameApp;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/Applications/${nameApp}
|
||||
cp -R . $out/Applications/${nameApp}
|
||||
'';
|
||||
|
||||
meta.platforms = lib.platforms.darwin;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
{ stdenvNoCC
|
||||
, lib
|
||||
, fetchurl
|
||||
, p7zip
|
||||
, version
|
||||
, sha256
|
||||
, useMklink ? false
|
||||
, customSymlinkCommand ? null
|
||||
}:
|
||||
let
|
||||
pname = "losslesscut";
|
||||
nameRepo = "lossless-cut";
|
||||
nameCamel = "LosslessCut";
|
||||
nameSourceBase = "${nameCamel}-win-x64";
|
||||
nameSource = "${nameSourceBase}.7z";
|
||||
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 {
|
||||
inherit pname version sha256;
|
||||
|
||||
src = fetchurl {
|
||||
name = nameSource;
|
||||
url = "https://github.com/${owner}/${nameRepo}/releases/download/v${version}/${nameSource}";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ p7zip ];
|
||||
|
||||
unpackPhase = ''
|
||||
7z x $src -o${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;
|
||||
}
|
Loading…
Reference in a new issue