lens: 2023.5.310801 -> 2024.3.191333 & refactor

https://k8slens.dev/blog/announcing-lens-2024

Refactor to make overlays possible
This commit is contained in:
Casey Stark 2024-03-29 21:29:15 -05:00 committed by Weijia Wang
parent bd0aef53c3
commit 37f7581955
4 changed files with 57 additions and 61 deletions

View File

@ -1,22 +0,0 @@
{ fetchurl }:
let
build = "2023.5.310801-latest";
in
{
pname = "lens-desktop";
version = "6.5.2";
sources = {
x86_64-darwin = fetchurl {
sha256 = "sha256-AGU1kOQEYBAGqWaxftqSNVdPEblPDujKSBjMeaVNx6M=";
url = "https://api.k8slens.dev/binaries/Lens-${build}.dmg";
};
aarch64-darwin = fetchurl {
sha256 = "sha256-Xx+6GPAfjioTrqfFS7cFh6deraR+TtqLlwLbVQxfN8g=";
url = "https://api.k8slens.dev/binaries/Lens-${build}-arm64.dmg";
};
x86_64-linux = fetchurl {
sha256 = "sha256-DPgeAhM8k6RXg1Qw2bqJFLPh5q2o7Va6EAe/InQNXLg=";
url = "https://api.k8slens.dev/binaries/Lens-${build}.x86_64.AppImage";
};
};
}

View File

@ -1,27 +1,20 @@
{ lib, stdenv, undmg, fetchurl }:
let
common = import ./common.nix { inherit fetchurl; };
inherit (stdenv.hostPlatform) system;
in
stdenv.mkDerivation rec {
inherit (common) pname version;
src = common.sources.${system} or (throw "Source for ${pname} is not available for ${system}");
{ stdenv, pname, version, src, meta, undmg }:
appName = "Lens";
stdenv.mkDerivation {
inherit pname version src meta;
sourceRoot = "${appName}.app";
sourceRoot = ".";
nativeBuildInputs = [ undmg ];
buildInputs = [ undmg ];
installPhase = ''
mkdir -p "$out/Applications/${appName}.app"
cp -R . "$out/Applications/${appName}.app"
runHook preInstall
mkdir -p "$out/Applications"
cp -R "Lens.app" "$out/Applications/Lens.app"
runHook postInstall
'';
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.lens;
maintainers = with maintainers; [ dbirks ];
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
};
dontFixup = true;
}

View File

@ -1,5 +1,41 @@
{ stdenv, callPackage }:
if stdenv.isDarwin then
callPackage ./darwin.nix { }
{ stdenv
, callPackage
, fetchurl
, lib }:
let
pname = "lens-desktop";
version = "2024.3.191333";
sources = {
x86_64-linux = {
url = "https://api.k8slens.dev/binaries/Lens-${version}-latest.x86_64.AppImage";
hash = "sha256-OywOjXzeW/5uyt50JrutiLgem9S1CrlwPFqfK6gUc7U=";
};
x86_64-darwin = {
url = "https://api.k8slens.dev/binaries/Lens-${version}-latest.dmg";
hash = "sha256-yf+WBcOdOM3XsfiXJThVws2r84vG2jwfNV1c+sq6A4s=";
};
aarch64-darwin = {
url = "https://api.k8slens.dev/binaries/Lens-${version}-latest-arm64.dmg";
hash = "sha256-hhd8MnwKWpvG7UebkeEoztS45SJVnpvvJ9Zy+y5swik=";
};
};
src = fetchurl {
inherit (sources.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}")) url hash;
};
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.lens;
maintainers = with maintainers; [ dbirks RossComputerGuy starkca90 ];
platforms = builtins.attrNames sources;
};
in if stdenv.isDarwin then
callPackage ./darwin.nix { inherit pname version src meta; }
else
callPackage ./linux.nix { }
callPackage ./linux.nix { inherit pname version src meta; }

View File

@ -1,19 +1,16 @@
{ lib, fetchurl, appimageTools, makeWrapper, nss_latest, stdenv }:
{ lib, stdenv, pname, version, src, meta, appimageTools, makeWrapper, nss_latest }:
let
common = import ./common.nix { inherit fetchurl; };
inherit (stdenv.hostPlatform) system;
inherit (common) pname version;
src = common.sources.${stdenv.hostPlatform.system} or (throw "Source for ${pname} is not available for ${system}");
name = "${pname}-${version}";
appimageContents = appimageTools.extractType2 {
inherit name src;
};
in
appimageTools.wrapType2 {
inherit name src;
inherit name src meta;
extraInstallCommands =
''
@ -29,12 +26,4 @@ appimageTools.wrapType2 {
'';
extraPkgs = _: [ nss_latest ];
meta = with lib; {
description = "The Kubernetes IDE";
homepage = "https://k8slens.dev/";
license = licenses.lens;
maintainers = with maintainers; [ dbirks RossComputerGuy ];
platforms = [ "x86_64-linux" ];
};
}