diff --git a/pkgs/applications/networking/cluster/lens/common.nix b/pkgs/applications/networking/cluster/lens/common.nix deleted file mode 100644 index e14a176bf464..000000000000 --- a/pkgs/applications/networking/cluster/lens/common.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/pkgs/applications/networking/cluster/lens/darwin.nix b/pkgs/applications/networking/cluster/lens/darwin.nix index e8f17422ec1f..9b9b752b877b 100644 --- a/pkgs/applications/networking/cluster/lens/darwin.nix +++ b/pkgs/applications/networking/cluster/lens/darwin.nix @@ -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; } diff --git a/pkgs/applications/networking/cluster/lens/default.nix b/pkgs/applications/networking/cluster/lens/default.nix index 455065b07036..3e32f8778f74 100644 --- a/pkgs/applications/networking/cluster/lens/default.nix +++ b/pkgs/applications/networking/cluster/lens/default.nix @@ -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; } diff --git a/pkgs/applications/networking/cluster/lens/linux.nix b/pkgs/applications/networking/cluster/lens/linux.nix index 8a21ceb432da..b54285fdafcc 100644 --- a/pkgs/applications/networking/cluster/lens/linux.nix +++ b/pkgs/applications/networking/cluster/lens/linux.nix @@ -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" ]; - }; }