Merge pull request #205348 from tanshihaj/lens

lens: add aarch64-darwin support
This commit is contained in:
Weijia Wang 2023-03-03 00:30:50 +02:00 committed by GitHub
commit f0e0383744
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 43 deletions

View file

@ -0,0 +1,29 @@
{ lib, stdenv, undmg, fetchurl }:
stdenv.mkDerivation rec {
pname = "lens";
version = "2022.12";
build = "${version}.11410-latest";
appName = "Lens";
sourceRoot = "${appName}.app";
src = fetchurl {
url = "https://api.k8slens.dev/binaries/Lens-${build}-arm64.dmg";
sha256 = "sha256-PKWJ2CZ/wacbJnrCZdYwYJzbFVhjIGAw60UGhdw11Mc=";
};
buildInputs = [ undmg ];
installPhase = ''
mkdir -p "$out/Applications/${appName}.app"
cp -R . "$out/Applications/${appName}.app"
'';
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.mit;
maintainers = with maintainers; [ dbirks ];
platforms = [ "aarch64-darwin" ];
};
}

View file

@ -1,44 +1,6 @@
{ lib, fetchurl, appimageTools, wrapGAppsHook, makeWrapper }:
{ stdenv, callPackage }:
let
pname = "lens";
version = "6.3.0";
build = "2022.12.221341-latest";
name = "${pname}-${version}";
src = fetchurl {
url = "https://api.k8slens.dev/binaries/Lens-${build}.x86_64.AppImage";
sha256 = "sha256-IJkm2Woz362jydFph9ek+5Jh2jtDH8kKvWoLQhTZPvc=";
name = "${pname}.AppImage";
};
appimageContents = appimageTools.extractType2 {
inherit name src;
};
in
appimageTools.wrapType2 {
inherit name src;
extraInstallCommands =
''
mv $out/bin/${name} $out/bin/${pname}
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/${pname} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
install -m 444 -D ${appimageContents}/lens.desktop $out/share/applications/${pname}.desktop
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/lens.png \
$out/share/icons/hicolor/512x512/apps/${pname}.png
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Icon=lens' 'Icon=${pname}' \
--replace 'Exec=AppRun' 'Exec=${pname}'
'';
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.mit;
maintainers = with maintainers; [ dbirks RossComputerGuy ];
platforms = [ "x86_64-linux" ];
};
}
if stdenv.isDarwin then
callPackage ./darwin.nix { }
else
callPackage ./linux.nix { }

View file

@ -0,0 +1,44 @@
{ lib, fetchurl, appimageTools, wrapGAppsHook, makeWrapper }:
let
pname = "lens";
version = "6.3.0";
build = "2022.12.221341-latest";
name = "${pname}-${version}";
src = fetchurl {
url = "https://api.k8slens.dev/binaries/Lens-${build}.x86_64.AppImage";
sha256 = "sha256-IJkm2Woz362jydFph9ek+5Jh2jtDH8kKvWoLQhTZPvc=";
name = "${pname}.AppImage";
};
appimageContents = appimageTools.extractType2 {
inherit name src;
};
in
appimageTools.wrapType2 {
inherit name src;
extraInstallCommands =
''
mv $out/bin/${name} $out/bin/${pname}
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/${pname} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
install -m 444 -D ${appimageContents}/lens.desktop $out/share/applications/${pname}.desktop
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/lens.png \
$out/share/icons/hicolor/512x512/apps/${pname}.png
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Icon=lens' 'Icon=${pname}' \
--replace 'Exec=AppRun' 'Exec=${pname}'
'';
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.mit;
maintainers = with maintainers; [ dbirks RossComputerGuy ];
platforms = [ "x86_64-linux" ];
};
}