Unverified Commit 19442b0f authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #300154 from starkca90/update-lens

lens: 6.5.2 (2023.5.310801) -> 2024.3.191333 & refactor
parents 9db82fb2 37f75819
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -18722,6 +18722,12 @@
    githubId = 6362238;
    name = "Christoph Honal";
  };
  starkca90 = {
    email = "starkca90@gmail.com";
    github = "starkca90";
    githubId = 2060836;
    name = "Casey Stark";
  };
  starsep = {
    email = "nix@starsep.com";
    github = "starsep";
+0 −22
Original line number Diff line number Diff line
{ 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";
    };
  };
}
+13 −20
Original line number Diff line number Diff line
{ 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;
}
+40 −4
Original line number Diff line number Diff line
{ 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; }
+4 −15
Original line number Diff line number Diff line
{ 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" ];
  };
}