{ stdenv, lib, fetchurl }: # Factory: call with { version, hash, isLatest ? false }. # isLatest=true installs as `talosctl`; otherwise installs as `talosctl-MAJ.MIN`. { version, hash, isLatest ? false }: let suffix = lib.optionalString (!isLatest) "-${lib.versions.majorMinor version}"; binName = "talosctl${suffix}"; in stdenv.mkDerivation { pname = binName; inherit version; src = fetchurl { url = "https://github.com/siderolabs/talos/releases/download/v${version}/talosctl-linux-amd64"; inherit hash; }; dontUnpack = true; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall install -Dm755 $src $out/bin/${binName} runHook postInstall ''; meta = with lib; { description = "CLI for Sidero Labs Talos Linux (${version})"; homepage = "https://github.com/siderolabs/talos"; license = licenses.mpl20; mainProgram = binName; platforms = [ "x86_64-linux" ]; }; }