Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabby-terminal: init at 1.0.207 #303924

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ChocolateLoverRaj
Copy link

@ChocolateLoverRaj ChocolateLoverRaj commented Apr 13, 2024

Description of changes

Added a package for Tabby. I'm new to creating Nix packages so there is probably a lot of room for improvement of the default.nix file I created. I tested it by adding (callPackage /home/rajas/Documents/nixpkgs/pkgs/applications/terminal-emulators/tabby { }) to my system packages in NixOS config file. Closes #233509.

Things that are missing:

  • ARM package (Tabby does build them)
  • MacOS package (Tabby does build them)
  • Maybe there is a way of adding to LD_LIBRARY_PATH paths instead of overriding it, but I'm not sure how
  • Doesn't follow Electron apps to be built from source聽#296939

Also the name conflicts with tabby from unstable

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 馃憤 reaction to pull requests you find important.

@pluiedev
Copy link
Contributor

pluiedev commented Apr 14, 2024

Please follow the standard commit & PR naming scheme of: <package>: init at <version>.

So for example, tabby: init at <x.y.z>

Additionally, new packages should always follow the by-name convention, and so the Nix file containing the derivation for Tabby should be put in pkgs/by-name/ta/tabby/package.nix.


cat > $out/bin/tabby << END
#!/bin/sh
'$out/opt/Tabby/tabby' --no-sandbox $@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should preferably be an explanation on what --no-sandbox does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk what it does, but that's what the official Tabby deb has

pkgs/applications/terminal-emulators/tabby/default.nix Outdated Show resolved Hide resolved
pkgs/applications/terminal-emulators/tabby/default.nix Outdated Show resolved Hide resolved
@pluiedev
Copy link
Contributor

Also, the name conflict between Tabby the... AI thing (?) and Tabby the terminal emulator definitely has to be resolved somehow. The terminal emulator is older but the AI program was added to nixpkgs earlier.

I wonder if there's precedence to this?

@ChocolateLoverRaj
Copy link
Author

Idk what this package should be called since tabby is taken. It would be weird if people updated their NixOS and their AI thing was replaced by a terminal.

@pluiedev
Copy link
Contributor

I guess tabby-terminal works, but then you have to rename the commit and the PR to reflect that. I'm fine with going with that name if nobody objects

@ChocolateLoverRaj ChocolateLoverRaj changed the title tabby: add package tabby-terminal: init at 1.0.207 Apr 16, 2024
@ChocolateLoverRaj
Copy link
Author

I think this PR is ready

@yswtrue
Copy link

yswtrue commented May 9, 2024

waiting for pr

Copy link
Contributor

@pluiedev pluiedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though one day we should also add Darwin support I think

pkgs/by-name/ta/tabby-terminal/package.nix Outdated Show resolved Hide resolved
pkgs/by-name/ta/tabby-terminal/package.nix Show resolved Hide resolved
pkgs/by-name/ta/tabby-terminal/package.nix Show resolved Hide resolved
postInstall = ''
mkdir -p $out/{opt,bin}
cp -r opt $out
wrapProgram "$out/opt/Tabby/tabby" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}} --no-sandbox" --set LD_LIBRARY_PATH=${lib.makeLibraryPath buildInputs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
wrapProgram "$out/opt/Tabby/tabby" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}} --no-sandbox" --set LD_LIBRARY_PATH=${lib.makeLibraryPath buildInputs}
wrapProgram "$out/opt/Tabby/tabby" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}} --no-sandbox"

Don't prioritize LD_LIBRARY_PATH. Try using autoPatchelfHook instead. See https://nixos.org/manual/nixpkgs/unstable/#setup-hook-autopatchelfhook (You have to look carefully how buildInputs works in this case, and use some runtimeDependencies if that doesn't work)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this:

{
  stdenv,
  fetchurl,
  pkgs,
  lib,
  alsa-lib,
}:

stdenv.mkDerivation rec {
  name = "tabby-terminal";
  version = "1.0.207";
  src = fetchurl {
    url = "https://github.com/Eugeny/tabby/releases/download/v${version}/tabby-${version}-linux-x64.deb";
    hash = "sha256-PTTkL3+mYb7KM8fDUmgCuAF2lU88fYOstGWp/O5WZas=";
  };

  nativeBuildInputs = with pkgs; [
    dpkg
    autoPatchelfHook
  ];

  buildInputs = with pkgs; [
    glib
    nss
    nspr
    atk
    cups
    dbus
    libdrm
    gtk3
    pango
    cairo
    xorg.libX11
    xorg.libXcomposite
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXrandr
    libxkbcommon
    mesa
    expat
    xorg.libxcb
    alsa-lib
    libGL
    libsecret
    musl
  ];

  runtimeDependencies = buildInputs;

  postInstall = ''
    mkdir -p $out/{opt,bin}
    cp -r opt $out
    # wrapProgram "$out/opt/Tabby/tabby" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}} --no-sandbox"
    cp -r usr/* $out

    mv $out/opt/Tabby/tabby $out/bin/tabby

    substituteInPlace $out/share/applications/tabby.desktop \
      --replace "/opt/Tabby/tabby" tabby
  '';

  meta = with lib; {
    homepage = "https://tabby.sh";
    description = "A terminal for a more modern age";
    license = licenses.mit;
    maintainers = with maintainers; [ ChocolateLoverRaj ];
    mainProgram = "tabby";
    platforms = platforms.linux;
    downloadPage = "https://github.com/Eugeny/tabby/releases/latest";
  };
}

When I run it I get this error:

[rajas@nixos:~/Documents/nixpkgs]$ ./result/bin/tabby 
[0516/104608.334415:ERROR:icu_util.cc(240)] Invalid file descriptor to ICU data received.
Trace/breakpoint trap (core dumped)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ico is missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuperSandro2000 should I try adding xorg.ico?

pkgs/by-name/ta/tabby-terminal/package.nix Show resolved Hide resolved
pkgs/by-name/ta/tabby-terminal/package.nix Outdated Show resolved Hide resolved
postInstall = ''
mkdir -p $out/{opt,bin}
cp -r opt $out
wrapProgram "$out/opt/Tabby/tabby" --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}} --no-sandbox" --set LD_LIBRARY_PATH=${lib.makeLibraryPath buildInputs}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe ico is missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: tabby
8 participants