base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ze / zellij / package.nix
blob5d7b348bc1f86a24a93038a78b875e2c28f810ec
2   lib,
3   fetchFromGitHub,
4   rustPlatform,
5   stdenv,
6   installShellFiles,
7   pkg-config,
8   curl,
9   openssl,
10   mandown,
11   zellij,
12   testers,
15 rustPlatform.buildRustPackage rec {
16   pname = "zellij";
17   version = "0.41.1";
19   src = fetchFromGitHub {
20     owner = "zellij-org";
21     repo = "zellij";
22     rev = "v${version}";
23     hash = "sha256-EUoJHM0Jm0uFKFeHhtzon/ZRC615SHfYa1gr4RnCNBw=";
24   };
26   cargoHash = "sha256-rI3pa0dvC/OVJz8gzD1bM0Q+8OWwvGj+jGDEMSbSb2I=";
28   env.OPENSSL_NO_VENDOR = 1;
30   # Workaround for https://github.com/zellij-org/zellij/issues/3720
31   postPatch = ''
32     substituteInPlace zellij-utils/Cargo.toml \
33       --replace-fail 'isahc = "1.7.2"' 'isahc = { version = "1.7.2", default-features = false, features = ["http2", "text-decoding"] }'
34   '';
36   nativeBuildInputs = [
37     mandown
38     installShellFiles
39     pkg-config
40     (lib.getDev curl)
41   ];
43   buildInputs = [
44     curl
45     openssl
46   ];
48   preCheck = ''
49     HOME=$TMPDIR
50   '';
52   # Ensure that we don't vendor curl, but instead link against the libcurl from nixpkgs
53   doInstallCheck = stdenv.hostPlatform.libc == "glibc";
54   installCheckPhase = ''
55     runHook preInstallCheck
57     ldd "$out/bin/zellij" | grep libcurl.so
59     runHook postInstallCheck
60   '';
62   postInstall =
63     ''
64       mandown docs/MANPAGE.md > zellij.1
65       installManPage zellij.1
67     ''
68     + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
69       installShellCompletion --cmd $pname \
70         --bash <($out/bin/zellij setup --generate-completion bash) \
71         --fish <($out/bin/zellij setup --generate-completion fish) \
72         --zsh <($out/bin/zellij setup --generate-completion zsh)
73     '';
75   passthru.tests.version = testers.testVersion { package = zellij; };
77   meta = with lib; {
78     description = "Terminal workspace with batteries included";
79     homepage = "https://zellij.dev/";
80     changelog = "https://github.com/zellij-org/zellij/blob/v${version}/CHANGELOG.md";
81     license = with licenses; [ mit ];
82     maintainers = with maintainers; [
83       therealansh
84       _0x4A6F
85       abbe
86       pyrox0
87     ];
88     mainProgram = "zellij";
89   };