commit 48132a5c415480041cbad50420fe45f57688530d
parent 6e10a8858eb83dd661c4e6dada8c3097cc835ab8
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Mon, 13 Mar 2023 20:55:21 +0400
Add finch
Diffstat:
2 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/pkgs/darwin/finch/default.nix b/pkgs/darwin/finch/default.nix
@@ -0,0 +1,77 @@
+{ lib, stdenv, buildGoModule, fetchFromGitHub, fetchurl }:
+
+let
+ arch = lib.head (lib.splitString "-" stdenv.hostPlatform.system);
+ lima = {
+ "x86_64-darwin" = fetchurl {
+ url = "https://deps.runfinch.com/${arch}/lima-and-qemu.macos-${arch}.1673290501.tar.gz";
+ hash = "sha256-9/15eqTAhARRp67fgsitLrg3yYI1j4dNBhLo31H6OAg=";
+ };
+ "aarch64-darwin" = fetchurl {
+ url = "https://deps.runfinch.com/${arch}/lima-and-qemu.macos-${arch}.1673290784.tar.gz";
+ hash = "sha256-PgkOEkq7EUH1qmVeIIKRUkT7lDoWmGIDxj/v5Pa1kt0=";
+ };
+ }.${stdenv.hostPlatform.system};
+ os = {
+ "x86_64-darwin" = fetchurl {
+ url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/${arch}/images/Fedora-Cloud-Base-37-1.7.${arch}.qcow2";
+ hash = "sha256-tbm+yR7uZUiaV0X27mIFc7IzN8ux60UBziALFXoB86A=";
+ };
+ "aarch64-darwin" = fetchurl {
+ url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/37/Cloud/${arch}/images/Fedora-Cloud-Base-37-1.7.${arch}.qcow2";
+ hash = "sha256-zIsPSbxgh1oW7vZa0T4OhrpQK6NYXMURRvEfQYKmKMA=";
+ };
+ }.${stdenv.hostPlatform.system};
+in
+buildGoModule rec {
+ pname = "finch";
+ version = "0.4.1";
+
+ src = fetchFromGitHub {
+ owner = "runfinch";
+ repo = "finch";
+ rev = "v${version}";
+ hash = "sha256-Q55Js0cJiuNGniqDVbKh5+pAqVu1j8zPWVf4up+CuUk=";
+ fetchSubmodules = true;
+ };
+
+ vendorHash = "sha256-LLdVmMOpOZguws+v6aExf8atpX669y2jGll1j13xjGw=";
+
+ subPackages = [ "cmd/finch" ];
+
+ ldflags = [
+ "-X github.com/runfinch/finch/pkg/version.Version=${version}"
+ ];
+
+ doCheck = false;
+
+ preCheck = ''
+ export HOME=$TMPDIR
+ '';
+
+ postInstall = ''
+ mkdir -p $out/Applications/Finch/{bin,lima,os}
+ mv $out/bin/finch $out/Applications/Finch/bin
+ ln -s $out/Applications/Finch/bin/finch $out/bin/finch
+
+ tar -xvf ${lima} -C $out/Applications/Finch/lima
+ cp ${os} $out/Applications/Finch/os/${os.name}
+
+ cp config.yaml $out/Applications/Finch
+ cp finch.yaml $out/Applications/Finch/os
+
+ substituteInPlace $out/Applications/Finch/os/finch.yaml \
+ --replace "<finch_image_location>" "$out/Applications/Finch/os/${os.name}" \
+ --replace "<finch_image_arch>" "${arch}" \
+ --replace "<finch_image_digest>" "sha256:$(sha256sum ${os} | cut -d' ' -f1)"
+ '';
+
+ meta = with lib; {
+ description = "Client for container development";
+ inherit (src.meta) homepage;
+ license = licenses.asl20;
+ maintainers = [ maintainers.sikmir ];
+ platforms = platforms.darwin;
+ skip.ci = true;
+ };
+}
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -27,6 +27,9 @@ lib.makeScope newScope (
amethyst-bin = callPackage ./darwin/amethyst/bin.nix { };
cudatext-bin = callPackage ./darwin/cudatext/bin.nix { };
+ finch = callPackage ./darwin/finch {
+ buildGoModule = pkgs.buildGo120Module;
+ };
macpass-bin = callPackage ./darwin/macpass/bin.nix { };
marta-bin = callPackage ./darwin/marta { };
pinentry-touchid = callPackage ./darwin/pinentry-touchid {