Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ yarn.lock
test-injection/
notepad.md
oauth-success.html
result/
70 changes: 11 additions & 59 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
description = "The Best AI Agent Harness - Batteries-Included OpenCode Plugin";

inputs = {
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
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
version = packageJson.version;

node_modules = pkgs.stdenvNoCC.mkDerivation {
name = "oh-my-opencode-node_modules-${version}";
src = self;

nativeBuildInputs = with pkgs; [
bun
cacert
];

buildPhase = ''
export HOME=$(mktemp -d)
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
bun install --frozen-lockfile --no-progress
'';

installPhase = ''
mkdir -p $out
cp -r node_modules $out/
'';

outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-HMaAcUx7VhvnOIJ1Wl6f4dv/IzL6EVv17KcJ7ivVubk=";
};
in
{
packages.node_modules = node_modules;

packages.oh-my-opencode = pkgs.stdenvNoCC.mkDerivation {
pname = "oh-my-opencode";
inherit version;
src = self;

nativeBuildInputs = with pkgs; [
bun
nodejs_24
makeWrapper
autoPatchelfHook
];

buildInputs = with pkgs; [
pkgs.stdenv.cc.cc.lib
];

buildPhase = ''
cp -r ${node_modules}/node_modules .
chmod -R u+w node_modules
export HOME=$(mktemp -d)
bun run build
'';

installPhase = ''
mkdir -p $out/lib/oh-my-opencode
mkdir -p $out/bin

cp -r dist $out/lib/oh-my-opencode/
cp -r node_modules $out/lib/oh-my-opencode/
cp package.json $out/lib/oh-my-opencode/

makeWrapper ${pkgs.bun}/bin/bun $out/bin/oh-my-opencode \
--add-flags "$out/lib/oh-my-opencode/dist/cli/index.js" \
--prefix PATH : ${
pkgs.lib.makeBinPath [
pkgs.bun
pkgs.nodejs_24
]
}
'';

meta = with pkgs.lib; {
description = "The Best AI Agent Harness - Batteries-Included OpenCode Plugin";
homepage = "https://github.com/code-yeongyu/oh-my-opencode";
license = licenses.unfree; # SUL-1.0
platforms = platforms.linux ++ platforms.darwin;
};
};

packages.default = self.packages.${pkgs.stdenv.hostPlatform.system}.oh-my-opencode;

devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
bun
nodejs_24
];
};
}
);
}