forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / co / colmena / package.nix
blobbffb3f2564653c324d08d9cc0e7957584780d7ce
1 { stdenv, lib, fetchpatch, rustPlatform, fetchFromGitHub, installShellFiles, makeBinaryWrapper, nix-eval-jobs, nix
2 , colmena, testers }:
4 rustPlatform.buildRustPackage rec {
5   pname = "colmena";
6   version = "0.4.0";
8   src = fetchFromGitHub {
9     owner = "zhaofengli";
10     repo = "colmena";
11     rev = "v${version}";
12     sha256 = "sha256-01bfuSY4gnshhtqA1EJCw2CMsKkAx+dHS+sEpQ2+EAQ=";
13   };
15   cargoHash = "sha256-rk2atWWJIR95duUXxAiARegjeCyfAsqTDwEr5P0eIr8=";
17   nativeBuildInputs = [ installShellFiles makeBinaryWrapper ];
19   buildInputs = [ nix-eval-jobs ];
21   NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs";
23   patches = [
24     # Fixes nix 2.24 compat: https://github.com/zhaofengli/colmena/pull/236
25     (fetchpatch {
26       url = "https://github.com/zhaofengli/colmena/commit/36382ee2bef95983848435065f7422500c7923a8.patch";
27       sha256 = "sha256-5cQ2u3eTzhzjPN+rc6xWIskHNtheVXXvlSeJ1G/lz+E=";
28     })
29   ];
31   postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
32     installShellCompletion --cmd colmena \
33       --bash <($out/bin/colmena gen-completions bash) \
34       --zsh <($out/bin/colmena gen-completions zsh) \
35       --fish <($out/bin/colmena gen-completions fish)
37     wrapProgram $out/bin/colmena \
38       --prefix PATH ":" "${lib.makeBinPath [ nix ]}"
39   '';
41   # Recursive Nix is not stable yet
42   doCheck = false;
44   passthru = {
45     # We guarantee CLI and Nix API stability for the same minor version
46     apiVersion = builtins.concatStringsSep "." (lib.take 2 (lib.splitVersion version));
48     tests.version = testers.testVersion { package = colmena; };
49   };
51   meta = with lib; {
52     description = "Simple, stateless NixOS deployment tool";
53     homepage = "https://colmena.cli.rs/${passthru.apiVersion}";
54     license = licenses.mit;
55     maintainers = with maintainers; [ zhaofengli ];
56     platforms = platforms.linux ++ platforms.darwin;
57     mainProgram = "colmena";
58   };