nixpkgs/pkgs/tools/misc/atuin/default.nix
2023-12-10 23:25:38 +01:00

60 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, installShellFiles
, rustPlatform
, libiconv
, AppKit
, Security
, SystemConfiguration
, nixosTests
}:
rustPlatform.buildRustPackage rec {
pname = "atuin";
version = "17.1.0";
src = fetchFromGitHub {
owner = "atuinsh";
repo = "atuin";
rev = "v${version}";
hash = "sha256-srFHVUZerxPmOQXVMoSgeLsylvILcOP7m62s4NCFDJE=";
};
# TODO: unify this to one hash because updater do not support this
cargoHash =
if stdenv.isLinux
then "sha256-FyKcR6H3/2cra9VYJbW37cSCvOpAiC8UJYXnseNQlt4="
else "sha256-NfoAjTshmb1L4bIkBctk90bZL93hsyAyIE9AEFUGcGQ=";
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv AppKit Security SystemConfiguration ];
postInstall = ''
installShellCompletion --cmd atuin \
--bash <($out/bin/atuin gen-completions -s bash) \
--fish <($out/bin/atuin gen-completions -s fish) \
--zsh <($out/bin/atuin gen-completions -s zsh)
'';
passthru.tests = {
inherit (nixosTests) atuin;
};
checkFlags = [
# tries to make a network access
"--skip=registration"
# No such file or directory (os error 2)
"--skip=sync"
];
meta = with lib; {
description = "Replacement for a shell history which records additional commands context with optional encrypted synchronization between machines";
homepage = "https://github.com/atuinsh/atuin";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 sciencentistguy _0x4A6F ];
mainProgram = "atuin";
};
}