appimageTools: use version (#359930)

This commit is contained in:
Philip Taron 2024-12-01 08:12:40 -08:00 committed by GitHub
commit a1ed41a112
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 22 additions and 26 deletions

View File

@ -9,7 +9,6 @@
mkDerivation rec {
pname = "soulseekqt";
version = "2018-1-30";
name="${pname}-${version}";
src = fetchzip {
url = "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz";
@ -17,7 +16,7 @@ mkDerivation rec {
};
appextracted = appimageTools.extractType2 {
inherit name;
inherit pname version;
src="${src}/SoulseekQt-2018-1-30-64bit.AppImage";
};

View File

@ -26,7 +26,9 @@ rec {
];
};
extract = args@{ name ? "${args.pname}-${args.version}", postExtract ? "", src, ... }: pkgs.runCommand "${name}-extracted" {
extract = args@{ pname, version, name ? null, postExtract ? "", src, ... }:
assert lib.assertMsg (name == null) "The `name` argument is deprecated. Use `pname` and `version` instead to construct the name.";
pkgs.runCommand "${pname}-${version}-extracted" {
buildInputs = [ appimage-exec ];
} ''
appimage-exec.sh -x $out ${src}
@ -58,7 +60,7 @@ rec {
wrapType2 = args@{ src, extraPkgs ? pkgs: [ ], ... }: wrapAppImage
(args // {
inherit extraPkgs;
src = extract (lib.filterAttrs (key: value: builtins.elem key [ "name" "pname" "version" "src" ]) args);
src = extract (lib.filterAttrs (key: value: builtins.elem key [ "pname" "version" "src" ]) args);
# passthru src to make nix-update work
# hack to keep the origin position (unsafeGetAttrPos)

View File

@ -18,17 +18,15 @@ let
appimageContents = appimageTools.extract {
inherit pname version src;
postExtract = ''
substituteInPlace $out/${name}.desktop --replace 'Exec=AppRun' 'Exec=cables'
substituteInPlace $out/${pname}-${version}.desktop --replace 'Exec=AppRun' 'Exec=cables'
'';
};
in
appimageTools.wrapType2 {
inherit name src;
inherit pname version src;
extraInstallCommands = ''
mv $out/bin/${name} $out/bin/cables
install -m 444 -D ${appimageContents}/${name}.desktop $out/share/applications/cables.desktop
install -m 444 -D ${appimageContents}/${name}.png $out/share/icons/hicolor/512x512/apps/cables.png
'';

View File

@ -13,7 +13,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
hash = "sha256-0jI/mbXaXanY6ay2zn+dPWGvsqWRcF8aYHRvfGVsObE=";
};
deskreenUnwrapped = appimageTools.wrapType2 {
name = "deskreen";
inherit (finalAttrs) pname version;
src = finalAttrs.src;
};

View File

@ -7,20 +7,18 @@
let
version = "1.4.0";
pname = "quba";
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/ZUGFeRD/quba-viewer/releases/download/v${version}/Quba-${version}.AppImage";
hash = "sha256-EsTF7W1np5qbQQh3pdqsFe32olvGK3AowGWjqHPEfoM=";
};
appimageContents = appimageTools.extractType1 { inherit name src; };
appimageContents = appimageTools.extractType1 { inherit pname version src; };
in
appimageTools.wrapType1 {
inherit name src;
inherit pname version src;
extraInstallCommands = ''
mv $out/bin/${name} $out/bin/${pname}
install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
substituteInPlace $out/share/applications/${pname}.desktop \
--replace-fail 'Exec=AppRun' 'Exec=${pname}'

View File

@ -1,14 +1,14 @@
{ lib, fetchurl, makeDesktopItem, appimageTools }:
let
name = "saleae-logic-2";
pname = "saleae-logic-2";
version = "2.4.13";
src = fetchurl {
url = "https://downloads.saleae.com/logic2/Logic-${version}-linux-x64.AppImage";
hash = "sha256-0GIZQKQDY3arDUlxjQKWOHDB3j76xVwkx5H+8q+d0Rc=";
};
desktopItem = makeDesktopItem {
inherit name;
exec = name;
name = "saleae-logic-2";
exec = "saleae-logic-2";
icon = "Logic";
comment = "Software for Saleae logic analyzers";
desktopName = "Saleae Logic";
@ -17,11 +17,11 @@ let
};
in
appimageTools.wrapType2 {
inherit name src;
inherit pname version src;
extraInstallCommands =
let
appimageContents = appimageTools.extractType2 { inherit name src; };
appimageContents = appimageTools.extractType2 { inherit pname version src; };
in
''
mkdir -p $out/etc/udev/rules.d

View File

@ -11,12 +11,11 @@ let
};
binary = appimageTools.wrapType2 {
name = pname;
inherit src;
inherit pname version src;
};
# we only use this to extract the icon
appimage-contents = appimageTools.extractType2 {
inherit name src;
inherit pname version src;
};
desktopItem = makeDesktopItem {

View File

@ -1,7 +1,7 @@
{ lib, appimageTools, fetchurl }:
appimageTools.wrapType2 rec {
name = "steam-rom-manager";
pname = "steam-rom-manager";
version = "2.5.22";
src = fetchurl {
@ -10,11 +10,11 @@ appimageTools.wrapType2 rec {
};
extraInstallCommands = let
appimageContents = appimageTools.extract { inherit name src; };
appimageContents = appimageTools.extract { inherit pname version src; };
in ''
install -m 444 -D ${appimageContents}/${name}.desktop -t $out/share/applications
substituteInPlace $out/share/applications/${name}.desktop \
--replace 'Exec=AppRun' 'Exec=${name}'
install -m 444 -D ${appimageContents}/steam-rom-manager.desktop -t $out/share/applications
substituteInPlace $out/share/applications/steam-rom-manager.desktop \
--replace 'Exec=AppRun' 'Exec=steam-rom-manager'
cp -r ${appimageContents}/usr/share/icons $out/share
'';