1{ lib
2, rustPlatform
3, fetchFromGitHub
4, cmake
5, installShellFiles
6, pkg-config
7, zstd
8, stdenv
9, CoreFoundation
10, libresolv
11, Security
12, git
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "onefetch";
17 version = "2.18.1";
18
19 src = fetchFromGitHub {
20 owner = "o2sh";
21 repo = pname;
22 rev = version;
23 hash = "sha256-xa7LdIeeSzCoSUVe9CzC3hKDiKlQdr011+iF/WOVGx0=";
24 };
25
26 cargoHash = "sha256-zaRoL5fV0Vyca0Ay1WIl/1jAlPSeuoBevgrEFER6XJU=";
27
28 cargoPatches = [
29 # enable pkg-config feature of zstd
30 ./zstd-pkg-config.patch
31 ];
32
33 nativeBuildInputs = [ cmake installShellFiles pkg-config ];
34
35 buildInputs = [ zstd ]
36 ++ lib.optionals stdenv.isDarwin [ CoreFoundation libresolv Security ];
37
38 nativeCheckInputs = [
39 git
40 ];
41
42 preCheck = ''
43 git init
44 git config user.name nixbld
45 git config user.email nixbld@example.com
46 git add .
47 git commit -m test
48 '';
49
50 postInstall = ''
51 installShellCompletion --cmd onefetch \
52 --bash <($out/bin/onefetch --generate bash) \
53 --fish <($out/bin/onefetch --generate fish) \
54 --zsh <($out/bin/onefetch --generate zsh)
55 '';
56
57 meta = with lib; {
58 description = "Git repository summary on your terminal";
59 homepage = "https://github.com/o2sh/onefetch";
60 changelog = "https://github.com/o2sh/onefetch/blob/v${version}/CHANGELOG.md";
61 license = licenses.mit;
62 maintainers = with maintainers; [ Br1ght0ne figsoda kloenk ];
63 };
64}