nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

default.nix (2785B)


      1 {
      2   lib,
      3   stdenv,
      4   buildGoModule,
      5   fetchFromGitHub,
      6   fetchurl,
      7 }:
      8 
      9 let
     10   arch = lib.head (lib.splitString "-" stdenv.hostPlatform.system);
     11   # Check LIMA_URL in Makefile
     12   lima =
     13     {
     14       "x86_64-darwin" = fetchurl {
     15         url = "https://deps.runfinch.com/${
     16           lib.replaceStrings [ "_" ] [ "-" ] arch
     17         }/lima-and-qemu.macos-${arch}.1701821611.tar.gz";
     18         hash = "sha256-mXBQLptj7hpPWGZXMnxDORVq3Zti/yYyW+Udm/FF9UQ=";
     19       };
     20       "aarch64-darwin" = fetchurl {
     21         url = "https://deps.runfinch.com/${
     22           lib.replaceStrings [ "_" ] [ "-" ] arch
     23         }/lima-and-qemu.macos-${arch}.1701821611.tar.gz";
     24         hash = "sha256-6Ll2CUwGJKUl8vxgdDx4Xm6O2WMYGJxMX6mLHJSvtT8=";
     25       };
     26     }
     27     .${stdenv.hostPlatform.system};
     28   # Check FINCH_OS_BASENAME in Makefile
     29   os =
     30     {
     31       "x86_64-darwin" = fetchurl {
     32         url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/${arch}/images/Fedora-Cloud-Base-38-1.6.${arch}.qcow2";
     33         hash = "sha256-0zRnBAH/PVtBKfzGYs9k9ablaCKK9ZB2zESaSUUxhII=";
     34       };
     35       "aarch64-darwin" = fetchurl {
     36         url = "https://dl.fedoraproject.org/pub/fedora/linux/releases/38/Cloud/${arch}/images/Fedora-Cloud-Base-38-1.6.${arch}.qcow2";
     37         hash = "sha256-0zRnBAH/PVtBKfzGYs9k9ablaCKK9ZB2zESaSUUxhII=";
     38       };
     39     }
     40     .${stdenv.hostPlatform.system};
     41 in
     42 buildGoModule rec {
     43   pname = "finch";
     44   version = "1.1.3";
     45 
     46   src = fetchFromGitHub {
     47     owner = "runfinch";
     48     repo = "finch";
     49     rev = "v${version}";
     50     hash = "sha256-K49gaN3n7wjXk3r7Rpsqd+pQYrYPuxCULo0TGDhfCsk=";
     51     fetchSubmodules = true;
     52   };
     53 
     54   vendorHash = "sha256-dyspVMmXuBHtZKk41ibcJwQMrbGNRxQwcPDeRpkr1IU=";
     55 
     56   subPackages = [ "cmd/finch" ];
     57 
     58   ldflags = [ "-X github.com/runfinch/finch/pkg/version.Version=${version}" ];
     59 
     60   doCheck = false;
     61 
     62   preCheck = ''
     63     export HOME=$TMPDIR
     64   '';
     65 
     66   postInstall = ''
     67     mkdir -p $out/Applications/Finch/{bin,lima,os}
     68     mv $out/bin/finch $out/Applications/Finch/bin
     69     ln -s $out/Applications/Finch/bin/finch $out/bin/finch
     70 
     71     tar -xvf ${lima} -C $out/Applications/Finch/lima
     72     cp ${os} $out/Applications/Finch/os/${os.name}
     73 
     74     cp config.yaml $out/Applications/Finch
     75     cp finch.yaml $out/Applications/Finch/os
     76 
     77     substituteInPlace $out/Applications/Finch/os/finch.yaml \
     78       --replace-fail "<finch_image_location>" "$out/Applications/Finch/os/${os.name}" \
     79       --replace-fail "<finch_image_arch>" "${arch}" \
     80       --replace-fail "<finch_image_digest>" "sha256:$(sha256sum ${os} | cut -d' ' -f1)"
     81   '';
     82 
     83   meta = {
     84     description = "Client for container development";
     85     inherit (src.meta) homepage;
     86     license = lib.licenses.asl20;
     87     maintainers = [ lib.maintainers.sikmir ];
     88     platforms = lib.platforms.darwin;
     89     skip.ci = true;
     90   };
     91 }