diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index e55b7c07349f8..71db341e51862 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -8142,6 +8142,12 @@ githubId = 6905586; keys = [ { fingerprint = "386E D1BF 848A BB4A 6B4A 3C45 FC83 907C 125B C2BC"; } ]; }; + geodic = { + name = "geodic"; + email = "geodic.github@proton.me"; + github = "geodic"; + githubId = 64704703; + }; geoffreyfrogeye = { name = "Geoffrey Frogeye"; email = "geoffrey@frogeye.fr"; diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index a358e5d1007ad..b46731ad90aae 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -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). diff --git a/pkgs/by-name/ta/tabby-terminal/package.nix b/pkgs/by-name/ta/tabby-terminal/package.nix new file mode 100644 index 0000000000000..bfdb2cf9b841b --- /dev/null +++ b/pkgs/by-name/ta/tabby-terminal/package.nix @@ -0,0 +1,234 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchurl, + fetchYarnDeps, + nodejs, + yarn, + git, + patch-package, + electron_32, + prefetch-yarn-deps, + fixup-yarn-lock, + python3, + makeWrapper, + http-server, + fontconfig, + pkg-config, + libsecret, + makeDesktopItem, + copyDesktopItems, + jq, + moreutils, + applyPatches, +}: + +let + tabby = rec { + pname = "tabby-terminal"; + version = "1.0.216"; + + src = fetchFromGitHub { + owner = "Eugeny"; + repo = "tabby"; + rev = "1e44d8c5252b68324c15f39ad082950c192b3291"; + hash = "sha256-TQaJyloZOxCz1iSLJrYLAk6KQjm1pTBGe0j+gscsAYc="; + leaveDotGit = true; + }; + + patches = [ ./splice-argv.patch ]; + + meta = { + description = "A terminal for a more modern age"; + homepage = "https://tabby.sh"; + license = lib.licenses.mit; + mainProgram = "tabby"; + maintainers = with lib.maintainers; [ geodic ]; + platforms = lib.platforms.linux; + }; + + __darwinAllowLocalNetworking = true; + + desktopItems = [ + (makeDesktopItem { + name = "tabby"; + desktopName = "Tabby"; + exec = "tabby %u"; + comment = "A terminal for a more modern age"; + icon = "tabby"; + categories = [ + "Utility" + "TerminalEmulator" + "System" + ]; + }) + ]; + + electronPackage = electron_32; + + electronHeaders = fetchurl { + url = "https://www.electronjs.org/headers/v${electronPackage.version}/node-v${electronPackage.version}-headers.tar.gz"; + hash = "sha256-D9j1wSDzartWUfDm2UrZDrgum2X+vV+DpDlKPFCtBbA="; + }; + + electronHeadersSHA = fetchurl { + url = "https://www.electronjs.org/headers/v${electronPackage.version}/SHASUMS256.txt"; + hash = "sha256-ZnWVCzTwwog4kgeFAZGsM2F2mmebrpXMVMxn/K+LWlU="; + }; + + buildInputs = [ + nodejs + python3 + fontconfig + electronPackage + ]; + + 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 + copyDesktopItems + jq + moreutils + ]; + + patchPhase = '' + runHook prePatch + + jq '.version = "${version}"' app/package.json | sponge app/package.json + + runHook postPatch + ''; + + configurePhase = + '' + runHook preConfigure + + export buildDir=$PWD + + git tag ${version} + '' + # Loop through all the yarn caches and install the deps for the respective package + + lib.concatMapStringsSep "\n" (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 + + lib.concatMapStringsSep "\n" (plugin: '' + ln -fs ../${plugin} ${plugin} + '') builtinPlugins + + + '' + cd $buildDir + + runHook postConfigure + ''; + + buildPhase = + # Start a fake (and completely unnecessary) http-server to let electron-rebuild "download" the headers and hashes + '' + runHook preBuild + + mkdir -p http-cache/v${electronPackage.version} + cp $electronHeaders http-cache/v${electronPackage.version}/node-v${electronPackage.version}-headers.tar.gz + cp $electronHeadersSHA http-cache/v${electronPackage.version}/SHASUMS256.txt + http-server http-cache & + '' + # Rebuild all the needed packages using electron-rebuild + + lib.concatMapStringsSep "\n" (pkg: '' + yarn --offline electron-rebuild -v ${electronPackage.version} -m ${pkg} -f -d "http://localhost:8080" + '') rebuildPkgs + + '' + kill $! + yarn build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/tabby + mkdir -p $out/bin + cp -r . $out/share/tabby + + # Tabby needs TABBY_DEV to run manually with electron + makeWrapper "${electronPackage}/bin/electron" "$out/bin/tabby" --add-flags "$out/share/tabby/app" --set TABBY_DEV 1 + + for iconsize in 16 32 64 128 + do + size=$iconsize"x"$iconsize + mkdir -p $out/share/icons/hicolor/$size/apps + ln -s $out/share/tabby/build/icons/"$size".png $out/share/icons/hicolor/$size/apps/tabby.png + done + + runHook postInstall + ''; + }; + + 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 = lib.importJSON ./pkg-hashes.json; + + # 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); + hash = pkgHashes.${pkg}; + }; + }) packages; + + rebuildPkgs = [ + "app" + "tabby-core" + "tabby-local" + "tabby-ssh" + "tabby-terminal" + ]; + +in +stdenv.mkDerivation tabby diff --git a/pkgs/by-name/ta/tabby-terminal/pkg-hashes.json b/pkgs/by-name/ta/tabby-terminal/pkg-hashes.json new file mode 100644 index 0000000000000..d24b012e0088c --- /dev/null +++ b/pkgs/by-name/ta/tabby-terminal/pkg-hashes.json @@ -0,0 +1,18 @@ +{ + ".": "sha256-bxRwEZ2WcH8PowO6B/+SUA6DrXtANu6KolSfEuAl3u8=", + "app": "sha256-Jnb3AtiaYisZh6+Dl4ZZp7D2I3y+aVAykHl5Ixef53M=", + "web": "sha256-kdER/yB8O7gfWnLZ/rNl4ha1eNnypcVmS1L7RrFCn0Q=", + "tabby-core": "sha256-Z42TZeE0z96ZRtIFIgGbQyv8gtGY/Llya/Dhs8JtuWo=", + "tabby-local": "sha256-GmVoeKxF8Sj55fDPN4GhwGVXoktdiwF3EFYTJHGO/NQ=", + "tabby-settings": "sha256-7t9mXsMqU892fLHyHmivgDxECSVn8KgRNAz9E2nKC/I=", + "tabby-electron": "sha256-h5HIu1FCbPsQIijhto3LdpLD2FnRmalqPq4/sjU9EOM=", + "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-GJP0KyDCLQ9MszCJcm4851g07fnZCN0svpPgnVjXjgY=", + "tabby-community-color-schemes": "sha256-oZgyP0hTU9bxszOVg3Bmiu6yos2d2Inc1Do8To4z8GQ=", + "tabby-plugin-manager": "sha256-CrgsIGg834A+WQh7o07Quv+SSFqYxPMugZsSOHCrdPU=", + "tabby-serial": "sha256-sg/CJnlkUcohFgmY6xGE79WG5mmx9jh196mb8iVCk6g=", + "tabby-terminal": "sha256-LS30V7iqLI0sEm3xlnMFtMnIxhALOMjQ148+zR0NyqU=" +} diff --git a/pkgs/by-name/ta/tabby-terminal/splice-argv.patch b/pkgs/by-name/ta/tabby-terminal/splice-argv.patch new file mode 100644 index 0000000000000..f850cb1177d2f --- /dev/null +++ b/pkgs/by-name/ta/tabby-terminal/splice-argv.patch @@ -0,0 +1,17 @@ +diff --git a/app/lib/cli.ts b/app/lib/cli.ts +index 03213dd8..2ff31389 100644 +--- a/app/lib/cli.ts ++++ b/app/lib/cli.ts +@@ -1,9 +1,9 @@ + import { app } from 'electron' + + export function parseArgs (argv: string[], cwd: string): any { +- if (argv[0].includes('node')) { +- argv = argv.slice(1) +- } ++ ++ // This is because we are running with electron ++ argv = argv.slice(1) + + return require('yargs/yargs')(argv.slice(1)) + .usage('tabby [command] [arguments]')