|
| 1 | +{ |
| 2 | + lib, |
| 3 | + fetchFromGitHub, |
| 4 | + rustPlatform, |
| 5 | + stdenv, |
| 6 | + installShellFiles, |
| 7 | + pkg-config, |
| 8 | + curl, |
| 9 | + openssl, |
| 10 | + mandown, |
| 11 | + zellij, |
| 12 | + testers, |
| 13 | +}: |
| 14 | + |
| 15 | +rustPlatform.buildRustPackage rec { |
| 16 | + pname = "zellij"; |
| 17 | + version = "0.41.1"; |
| 18 | + |
| 19 | + src = fetchFromGitHub { |
| 20 | + owner = "zellij-org"; |
| 21 | + repo = "zellij"; |
| 22 | + rev = "v${version}"; |
| 23 | + hash = "sha256-EUoJHM0Jm0uFKFeHhtzon/ZRC615SHfYa1gr4RnCNBw="; |
| 24 | + }; |
| 25 | + |
| 26 | + cargoHash = "sha256-rI3pa0dvC/OVJz8gzD1bM0Q+8OWwvGj+jGDEMSbSb2I="; |
| 27 | + |
| 28 | + env.OPENSSL_NO_VENDOR = 1; |
| 29 | + |
| 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 | + ''; |
| 35 | + |
| 36 | + nativeBuildInputs = [ |
| 37 | + mandown |
| 38 | + installShellFiles |
| 39 | + pkg-config |
| 40 | + (lib.getDev curl) |
| 41 | + ]; |
| 42 | + |
| 43 | + buildInputs = [ |
| 44 | + curl |
| 45 | + openssl |
| 46 | + ]; |
| 47 | + |
| 48 | + preCheck = '' |
| 49 | + HOME=$TMPDIR |
| 50 | + ''; |
| 51 | + |
| 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 |
| 56 | +
|
| 57 | + ldd "$out/bin/zellij" | grep libcurl.so |
| 58 | +
|
| 59 | + runHook postInstallCheck |
| 60 | + ''; |
| 61 | + |
| 62 | + postInstall = |
| 63 | + '' |
| 64 | + mandown docs/MANPAGE.md > zellij.1 |
| 65 | + installManPage zellij.1 |
| 66 | +
|
| 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 | + ''; |
| 74 | + |
| 75 | + passthru.tests.version = testers.testVersion { package = zellij; }; |
| 76 | + |
| 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 | + }; |
| 90 | +} |
0 commit comments