nixpkgs/pkgs/tools/admin/colmena/default.nix
2022-08-18 16:43:27 -06:00

48 lines
1.4 KiB
Nix

{ stdenv, lib, rustPlatform, fetchFromGitHub, installShellFiles, nix-eval-jobs
, colmena, testers }:
rustPlatform.buildRustPackage rec {
pname = "colmena";
version = "0.3.1";
src = fetchFromGitHub {
owner = "zhaofengli";
repo = "colmena";
rev = "v${version}";
sha256 = "sha256-kXc5YD3u+4lLWnih6s5ZjOYT+p0TvC2I7GT9eBAK2Jk=";
};
cargoSha256 = "sha256-B8gO2m+i3BOsMyB/KHlA4MO+a5UT+ZAN1XJ92X1suec=";
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ nix-eval-jobs ];
NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs";
postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
installShellCompletion --cmd colmena \
--bash <($out/bin/colmena gen-completions bash) \
--zsh <($out/bin/colmena gen-completions zsh) \
--fish <($out/bin/colmena gen-completions fish)
'';
# Recursive Nix is not stable yet
doCheck = false;
passthru = {
# We guarantee CLI and Nix API stability for the same minor version
apiVersion = builtins.concatStringsSep "." (lib.take 2 (lib.splitString "." version));
tests.version = testers.testVersion { package = colmena; };
};
meta = with lib; {
description = "A simple, stateless NixOS deployment tool";
homepage = "https://zhaofengli.github.io/colmena/${passthru.apiVersion}";
license = licenses.mit;
maintainers = with maintainers; [ zhaofengli ];
platforms = platforms.linux ++ platforms.darwin;
};
}