Skip to content

Commit

Permalink
Format nix flake and add installation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
BatteredBunny committed Aug 16, 2023
1 parent 429533f commit 9f46e35
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 53 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
49 changes: 27 additions & 22 deletions build.nix
Original file line number Diff line number Diff line change
@@ -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
# chromium
yarn --offline build:chromium
mv deps/${name}/web-ext-artifacts/${name}-${version}.zip $out/chromium-${name}-${version}.zip
'';
};
in
buildExtension
43 changes: 23 additions & 20 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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 {};
}
);
}
}
14 changes: 14 additions & 0 deletions installation.md
Original file line number Diff line number Diff line change
@@ -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`)
21 changes: 11 additions & 10 deletions native.nix
Original file line number Diff line number Diff line change
@@ -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"
];
}
ldflags = [
"-s"
"-w"
];
}

0 comments on commit 9f46e35

Please sign in to comment.