nixpkgs/pkgs/by-name/co/colmena/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

60 lines
1.9 KiB
Nix

{ stdenv, lib, fetchpatch, rustPlatform, fetchFromGitHub, installShellFiles, makeBinaryWrapper, nix-eval-jobs, nix
, colmena, testers }:
rustPlatform.buildRustPackage rec {
pname = "colmena";
version = "0.4.0";
src = fetchFromGitHub {
owner = "zhaofengli";
repo = "colmena";
rev = "v${version}";
sha256 = "sha256-01bfuSY4gnshhtqA1EJCw2CMsKkAx+dHS+sEpQ2+EAQ=";
};
cargoHash = "sha256-rk2atWWJIR95duUXxAiARegjeCyfAsqTDwEr5P0eIr8=";
nativeBuildInputs = [ installShellFiles makeBinaryWrapper ];
buildInputs = [ nix-eval-jobs ];
NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs";
patches = [
# Fixes nix 2.24 compat: https://github.com/zhaofengli/colmena/pull/236
(fetchpatch {
url = "https://github.com/zhaofengli/colmena/commit/36382ee2bef95983848435065f7422500c7923a8.patch";
sha256 = "sha256-5cQ2u3eTzhzjPN+rc6xWIskHNtheVXXvlSeJ1G/lz+E=";
})
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd colmena \
--bash <($out/bin/colmena gen-completions bash) \
--zsh <($out/bin/colmena gen-completions zsh) \
--fish <($out/bin/colmena gen-completions fish)
wrapProgram $out/bin/colmena \
--prefix PATH ":" "${lib.makeBinPath [ nix ]}"
'';
# 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.splitVersion version));
tests.version = testers.testVersion { package = colmena; };
};
meta = with lib; {
description = "Simple, stateless NixOS deployment tool";
homepage = "https://colmena.cli.rs/${passthru.apiVersion}";
license = licenses.mit;
maintainers = with maintainers; [ zhaofengli ];
platforms = platforms.linux ++ platforms.darwin;
mainProgram = "colmena";
};
}