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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabby-terminal: init at 1.0.216 #368048

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8142,6 +8142,12 @@
githubId = 6905586;
keys = [ { fingerprint = "386E D1BF 848A BB4A 6B4A 3C45 FC83 907C 125B C2BC"; } ];
};
geodic = {
name = "geodic";
email = "[email protected]";
github = "geodic";
githubId = 64704703;
};
geoffreyfrogeye = {
name = "Geoffrey Frogeye";
email = "[email protected]";
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

- [Bazecor](https://github.com/Dygmalab/Bazecor), the graphical configurator for Dygma Products.

- [Tabby](https://tabby.sh), a terminal for a more modern age.

- [Bonsai](https://git.sr.ht/~stacyharper/bonsai), a general-purpose event mapper/state machine primarily used to create complex key shortcuts, and as part of the [SXMO](https://sxmo.org/) desktop environment. Available as [services.bonsaid](#opt-services.bonsaid.enable).

- [scanservjs](https://github.com/sbs20/scanservjs/), a web UI for SANE scanners. Available at [services.scanservjs](#opt-services.scanservjs.enable).
Expand Down
13 changes: 13 additions & 0 deletions pkgs/by-name/ta/tabby-terminal/fix-argv-prefix-splice.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/app/lib/cli.ts b/app/lib/cli.ts
geodic marked this conversation as resolved.
Show resolved Hide resolved
index 03213dd8..b4b9df78 100644
--- a/app/lib/cli.ts
+++ b/app/lib/cli.ts
@@ -1,7 +1,7 @@
import { app } from 'electron'

export function parseArgs (argv: string[], cwd: string): any {
- if (argv[0].includes('node')) {
+ if (argv[0].includes('electron')) {
argv = argv.slice(1)
}

215 changes: 215 additions & 0 deletions pkgs/by-name/ta/tabby-terminal/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchurl,
fetchYarnDeps,
nodejs,
yarn,
git,
patch-package,
electron_29,
prefetch-yarn-deps,
fixup-yarn-lock,
python3,
makeWrapper,
http-server,
fontconfig,
pkg-config,
libsecret,
desktop-file-utils,
}:

let
tabby = rec {
pname = "tabby-terminal";
version = "1.0.215";

src = fetchFromGitHub {
owner = "Eugeny";
repo = "tabby";
rev = "v${version}";
geodic marked this conversation as resolved.
Show resolved Hide resolved
hash = "sha256-l3Hyt3e1edJjb7vL66JDllkpHwTU5efsNbgJ5Pcvn60=";
leaveDotGit = true;
deepClone = true;
geodic marked this conversation as resolved.
Show resolved Hide resolved
};

meta = with lib; {
geodic marked this conversation as resolved.
Show resolved Hide resolved
description = "A terminal for a more modern age";
homepage = "https://tabby.sh";
license = licenses.mit;
mainProgram = "tabby";
maintainers = with maintainers; [ geodic ];
platforms = [ "x86_64-linux" ];
geodic marked this conversation as resolved.
Show resolved Hide resolved
};

# We need to fix the argv logic as tabby only handles it for the node executable, but we are running it with electron
patches = [ ./fix-argv-prefix-splice.patch ];

electronVersion = "29.4.6";
geodic marked this conversation as resolved.
Show resolved Hide resolved

electronHeaders = fetchurl {
url = "https://www.electronjs.org/headers/v${electronVersion}/node-v${electronVersion}-headers.tar.gz";
hash = "sha256-e0qiEGI/1rWK72oLXfKtbbc8KmOGMhMx4IbT6MGAjms=";
};

electronHeadersSHA = fetchurl {
url = "https://www.electronjs.org/headers/v${electronVersion}/SHASUMS256.txt";
hash = "sha256-0mCnKIR3GS1TL+g0h+y2cAlqbBogf88WxN8xJvmFl4g=";
};

buildInputs = [
nodejs
python3
fontconfig
electron_29
geodic marked this conversation as resolved.
Show resolved Hide resolved
];

nativeBuildInputs = [
git
yarn
patch-package
prefetch-yarn-deps
fixup-yarn-lock
(python3.withPackages (python-pkgs: [
python-pkgs.distutils
python-pkgs.gyp
]))
makeWrapper
http-server
pkg-config
libsecret
desktop-file-utils
];

configurePhase =
''
export buildDir=$PWD
''
# Loop through all the yarn caches and install the deps for the respective package
+ builtins.concatStringsSep "\n" (
map (cache: ''
cd ${cache.pkg}
export HOME=$PWD/yarn_home
fixup-yarn-lock yarn.lock
yarn config --offline set yarn-offline-mirror ${cache.cache}
echo "Installing deps for ${cache.pkg}"
yarn install --offline --prefer-offline --frozen-lockfile --ignore-scripts --no-progress --non-interactive
patch-package
patchShebangs node_modules
echo "Done!"
cd $buildDir
'') yarnCaches
)
+ ''
cd $buildDir/node_modules
''
# Loop thought the "built in" plugins and link them to the node_modules
+ builtins.concatStringsSep "\n" (
map (plugin: ''
ln -fs ../${plugin} ${plugin}
'') builtinPlugins
)
+ ''
cd $buildDir
'';

buildPhase =
# Start a fake (and completely unnecessary) http-server to let electron-rebuild "download" the headers and hashes
''
mkdir -p http-cache/v${electronVersion}
cp $electronHeaders http-cache/v${electronVersion}/node-v${electronVersion}-headers.tar.gz
cp $electronHeadersSHA http-cache/v${electronVersion}/SHASUMS256.txt
http-server http-cache &
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is necessary. From a glance, electron-rebuild supports the --dist-url option which should make it avoid downloading Electron headers all the same.

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 to set the --dist-url to a file url, but it throws an error saying that it only supports HTTP(S)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, so it wants a web URL... Never mind then, maybe someone else would have a better idea

geodic marked this conversation as resolved.
Show resolved Hide resolved
''
# Rebuild all the needed packages using electron-rebuild
+ builtins.concatStringsSep "\n" (
map (pkg: ''
yarn --offline electron-rebuild -v ${electronVersion} -m ${pkg} -f -d "http://localhost:8080"
'') rebuildPkgs
)
+ ''
kill $!
yarn build

mkdir -p $out/share/tabby
mkdir -p $out/bin
cp -r . $out/share/tabby
makeWrapper "${electron_29}/bin/electron" "$out/bin/tabby" --add-flags "$out/share/tabby/app" --set TABBY_DEV 1
geodic marked this conversation as resolved.
Show resolved Hide resolved

mkdir -p $out/share/icons/hicolor/128x128/apps
cp ./build/icons/128x128.png $out/share/icons/hicolor/128x128/apps/tabby.png

mkdir -p $out/share/applications
echo "[Desktop Entry]" > tabby.desktop
desktop-file-install --dir $out/share/applications \
--set-key Type --set-value Application \
--set-key Exec --set-value tabby \
--set-key Name --set-value Tabby \
--set-key Comment --set-value "A terminal for a more modern age." \
--set-key Categories --set-value "Utility;TerminalEmulator;System" \
--set-key Icon --set-value $out/share/icons/hicolor/128x128/apps/tabby.png \
tabby.desktop
geodic marked this conversation as resolved.
Show resolved Hide resolved
'';
};

builtinPlugins = [
"tabby-core"
"tabby-settings"
"tabby-terminal"
"tabby-web"
"tabby-community-color-schemes"
"tabby-ssh"
"tabby-serial"
"tabby-telnet"
"tabby-local"
"tabby-electron"
"tabby-plugin-manager"
"tabby-linkifier"
];

packages = builtinPlugins ++ [
"."
"app"
"web"
"tabby-web-demo"
];

pkgHashes = {
"." = "sha256-Qklo8iX27lE6VTUAX1bwa9yBw/tMx+G+FB2MJUkt+7s=";
app = "sha256-wo/ZhfyngBeagoYlzthsUSVNnSTaz+cHZD5dx9X8nP8=";
web = "sha256-kdER/yB8O7gfWnLZ/rNl4ha1eNnypcVmS1L7RrFCn0Q=";
tabby-core = "sha256-Z42TZeE0z96ZRtIFIgGbQyv8gtGY/Llya/Dhs8JtuWo=";
tabby-local = "sha256-GmVoeKxF8Sj55fDPN4GhwGVXoktdiwF3EFYTJHGO/NQ=";
tabby-settings = "sha256-7t9mXsMqU892fLHyHmivgDxECSVn8KgRNAz9E2nKC/I=";
tabby-electron = "sha256-JDEsn+7xOcoKFyOCFeClFqcD2NJWwRA6uyM8SwxKW8c=";
tabby-web-demo = "sha256-i8UoUMb5m+rf/73eKPm2S0v6cs8qSqy6lRjnZ6GoO/k=";
tabby-linkifier = "sha256-78wgw6BbN/GtRMYeJF9svn9hn82bTZj4+8TXf/rAC64=";
tabby-web = "sha256-ErhWM0jiVK4PBosBz4IHi1xiemAzRuk/EE8ntyhO2PE=";
tabby-telnet = "sha256-J8nBBUxwTdigcdohEF6dw8+EHRBUm8O1SLM9oDB3VaA=";
tabby-ssh = "sha256-8PRf0F6Q3Hoqxiz6lcoFZn0z9EAyeTNNuSh6gli35+U=";
tabby-community-color-schemes = "sha256-oZgyP0hTU9bxszOVg3Bmiu6yos2d2Inc1Do8To4z8GQ=";
tabby-plugin-manager = "sha256-CrgsIGg834A+WQh7o07Quv+SSFqYxPMugZsSOHCrdPU=";
tabby-serial = "sha256-sg/CJnlkUcohFgmY6xGE79WG5mmx9jh196mb8iVCk6g=";
tabby-terminal = "sha256-LS30V7iqLI0sEm3xlnMFtMnIxhALOMjQ148+zR0NyqU=";
};

# Loop through all the packages and create a yarn cache for them
yarnCaches = map (pkg: {
inherit pkg;
cache = fetchYarnDeps {
src = lib.removeSuffix "/." (tabby.src + "/" + pkg);
sha256 = builtins.getAttr pkg pkgHashes;
geodic marked this conversation as resolved.
Show resolved Hide resolved
};
}) packages;

rebuildPkgs = [
"app"
"tabby-core"
"tabby-local"
"tabby-ssh"
"tabby-terminal"
];

in
stdenv.mkDerivation tabby
Loading