diff --git a/README.md b/README.md index 8eb2f41..ada0232 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # browser terminal extension -Extension that allows you to open a native terminal in the browser. Tested in linux and macos. +Extension that allows you to open a native terminal in the browser. Tested in linux and macos. [Installation instructions](https://github.com/ayes-web/browser_terminal/blob/main/installation.md) ![screenshot.png](screenshot.png) + + ## Dependencies - golang - nodejs + npm/yarn diff --git a/build.nix b/build.nix index cf0d796..04ce141 100644 --- a/build.nix +++ b/build.nix @@ -1,27 +1,32 @@ -{pkgs, lib, ...}: let - buildExtension = pkgs.mkYarnPackage rec { - name = "browser_terminal"; - version = "1.4.2"; +{ + pkgs, + lib, + ... +}: let + buildExtension = pkgs.mkYarnPackage rec { + name = "browser_terminal"; + version = "1.4.2"; - src = ./.; + src = ./.; - offlineCache = pkgs.fetchYarnDeps { - yarnLock = src + "/yarn.lock"; - hash = "sha256-pUnvLSdyd46205YDMDIYXw7P94IvgBgHDJ+k5FzIm6E="; - }; + offlineCache = pkgs.fetchYarnDeps { + yarnLock = src + "/yarn.lock"; + hash = "sha256-pUnvLSdyd46205YDMDIYXw7P94IvgBgHDJ+k5FzIm6E="; + }; - buildPhase = '' - export HOME=$(mktemp -d) - mkdir -p $out/unpacked-firefox + buildPhase = '' + export HOME=$(mktemp -d) + mkdir -p $out/unpacked-firefox - # firefox - yarn --offline build - cp -r deps/${name}/dist $out/unpacked-firefox - mv deps/${name}/web-ext-artifacts/${name}-${version}.zip $out/firefox-${name}-${version}.zip + # firefox + yarn --offline build + cp -r deps/${name}/dist $out/unpacked-firefox + mv deps/${name}/web-ext-artifacts/${name}-${version}.zip $out/firefox-${name}-${version}.zip - # chromium - yarn --offline build:chromium - mv deps/${name}/web-ext-artifacts/${name}-${version}.zip $out/chromium-${name}-${version}.zip - ''; - }; -in buildExtension \ No newline at end of file + # chromium + yarn --offline build:chromium + mv deps/${name}/web-ext-artifacts/${name}-${version}.zip $out/chromium-${name}-${version}.zip + ''; + }; +in + buildExtension diff --git a/flake.nix b/flake.nix index 3caa8fb..43fc12d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,29 +1,32 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem (system: - let + outputs = { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: let pkgs = import nixpkgs { - inherit system; + inherit system; }; in - with pkgs; - rec { - devShells.default = mkShell { - buildInputs = [ - go - nodePackages.pnpm - nodePackages.web-ext - esbuild - ]; - }; + with pkgs; { + devShells.default = mkShell { + buildInputs = [ + go + nodePackages.pnpm + nodePackages.web-ext + esbuild + ]; + }; - packages.native = callPackage ./native.nix { }; - packages.default = callPackage ./build.nix { }; - } + packages.native = callPackage ./native.nix {}; + packages.default = callPackage ./build.nix {}; + } ); -} \ No newline at end of file +} diff --git a/installation.md b/installation.md new file mode 100644 index 0000000..65e97be --- /dev/null +++ b/installation.md @@ -0,0 +1,14 @@ +# Installation + +1. Install extension from [firefox addons](https://addons.mozilla.org/en-US/firefox/addon/browser_terminal/) or [chrome web store](https://chrome.google.cm/webstore/detail/browser-terminal/nbnfihffeffdhcbblmekelobgmdccfnl) + +2. Download native program from https://github.com/ayes-web/browser_terminal/releases +3. Installing the binary + - Linux: ``sudo mv ~/Downloads/browser_terminal_linux_x86_64 /usr/local/bin/browser_terminal`` + - MacOS: ``sudo mv ~/Downloads/browser_terminal_macos_aarch64 /usr/local/bin/browser_terminal`` +4. Install the native manifest: ```browser_terminal --install``` + +Done! + +# Nix users +Nix users on linux and macos can take advantage of the flake in the repo to install the binary (`nix run github:/ayes-web/browser_terminal#native`) \ No newline at end of file diff --git a/native.nix b/native.nix index fe0ae24..a1af6b4 100644 --- a/native.nix +++ b/native.nix @@ -1,13 +1,14 @@ -{ pkgs, buildGoModule, lib }: buildGoModule rec { - src = ./native; +{buildGoModule}: +buildGoModule { + src = ./native; - name = "github.com/ayes-web/browser_terminal"; - vendorSha256 = "sha256-WUQHf1LuD3YqaUDSmKaimnIa6pfKqvjf257pDO3P9KQ="; + name = "browser_terminal"; + vendorSha256 = "sha256-WUQHf1LuD3YqaUDSmKaimnIa6pfKqvjf257pDO3P9KQ="; - GOFLAGS = "-trimpath"; + GOFLAGS = "-trimpath"; - ldflags = [ - "-s" - "-w" - ]; -} \ No newline at end of file + ldflags = [ + "-s" + "-w" + ]; +}