10
flake.nix
10
flake.nix
@@ -46,7 +46,6 @@
|
|||||||
hostname: let
|
hostname: let
|
||||||
syncthingOverlay = import ./overlays/syncthing-darwin.nix;
|
syncthingOverlay = import ./overlays/syncthing-darwin.nix;
|
||||||
syncthingModule = (syncthingOverlay null {}).darwinSyncthingModule;
|
syncthingModule = (syncthingOverlay null {}).darwinSyncthingModule;
|
||||||
opencodeOverlay = import ./overlays/opencode.nix;
|
|
||||||
in
|
in
|
||||||
inputs.darwin.lib.darwinSystem {
|
inputs.darwin.lib.darwinSystem {
|
||||||
system = "aarch64-darwin";
|
system = "aarch64-darwin";
|
||||||
@@ -61,7 +60,7 @@
|
|||||||
syncthingModule
|
syncthingModule
|
||||||
|
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = [syncthingOverlay opencodeOverlay];
|
nixpkgs.overlays = [syncthingOverlay];
|
||||||
|
|
||||||
nix-homebrew = {
|
nix-homebrew = {
|
||||||
inherit user;
|
inherit user;
|
||||||
@@ -80,9 +79,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
flake.nixosConfigurations = inputs.nixpkgs.lib.genAttrs nixosHosts (
|
flake.nixosConfigurations = inputs.nixpkgs.lib.genAttrs nixosHosts (
|
||||||
hostname: let
|
hostname:
|
||||||
opencodeOverlay = import ./overlays/opencode.nix;
|
|
||||||
in
|
|
||||||
inputs.nixpkgs.lib.nixosSystem {
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs =
|
specialArgs =
|
||||||
@@ -92,9 +89,6 @@
|
|||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
{
|
|
||||||
nixpkgs.overlays = [opencodeOverlay];
|
|
||||||
}
|
|
||||||
./hosts/nixos/${hostname}
|
./hosts/nixos/${hostname}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
final: prev: {
|
|
||||||
opencode = prev.opencode.overrideAttrs (oldAttrs: rec {
|
|
||||||
version = "0.5.12";
|
|
||||||
|
|
||||||
src = prev.fetchFromGitHub {
|
|
||||||
owner = "sst";
|
|
||||||
repo = "opencode";
|
|
||||||
tag = "v${version}";
|
|
||||||
hash = "sha256-iPv6rATpIpf2j81Ud4OSWOt0ZSR0sAYBhBRrQpOH1Bs=";
|
|
||||||
};
|
|
||||||
|
|
||||||
tui = prev.buildGoModule {
|
|
||||||
pname = "opencode-tui";
|
|
||||||
inherit version src;
|
|
||||||
modRoot = "packages/tui";
|
|
||||||
vendorHash = "sha256-acDXCL7ZQYW5LnEqbMgDwpTbSgtf4wXnMMVtQI1Dv9s=";
|
|
||||||
subPackages = ["cmd/opencode"];
|
|
||||||
|
|
||||||
env.CGO_ENABLED = 0;
|
|
||||||
|
|
||||||
ldflags = [
|
|
||||||
"-s"
|
|
||||||
"-X=main.Version=${version}"
|
|
||||||
];
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
install -Dm755 $GOPATH/bin/opencode $out/bin/tui
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
node_modules = prev.stdenvNoCC.mkDerivation {
|
|
||||||
pname = "opencode-node_modules";
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
impureEnvVars =
|
|
||||||
prev.lib.fetchers.proxyImpureEnvVars
|
|
||||||
++ [
|
|
||||||
"GIT_PROXY_COMMAND"
|
|
||||||
"SOCKS_SERVER"
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
prev.bun
|
|
||||||
prev.writableTmpDirAsHomeHook
|
|
||||||
];
|
|
||||||
|
|
||||||
dontConfigure = true;
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
|
|
||||||
|
|
||||||
# Disable post-install scripts to avoid shebang issues
|
|
||||||
bun install \
|
|
||||||
--filter=opencode \
|
|
||||||
--force \
|
|
||||||
--frozen-lockfile \
|
|
||||||
--ignore-scripts \
|
|
||||||
--no-progress \
|
|
||||||
--production
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/node_modules
|
|
||||||
cp -R ./node_modules $out
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontFixup = true;
|
|
||||||
|
|
||||||
outputHash = "sha256-hznCg/7c9uNV7NXTkb6wtn3EhJDkGI7yZmSIA2SqX7g=";
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
};
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
bun build \
|
|
||||||
--define OPENCODE_TUI_PATH="'${oldAttrs.tui}/bin/tui'" \
|
|
||||||
--define OPENCODE_VERSION="'${version}'" \
|
|
||||||
--compile \
|
|
||||||
--target=${
|
|
||||||
{
|
|
||||||
"aarch64-darwin" = "bun-darwin-arm64";
|
|
||||||
"aarch64-linux" = "bun-linux-arm64";
|
|
||||||
"x86_64-darwin" = "bun-darwin-x64";
|
|
||||||
"x86_64-linux" = "bun-linux-x64";
|
|
||||||
}.${
|
|
||||||
prev.stdenvNoCC.hostPlatform.system
|
|
||||||
}
|
|
||||||
} \
|
|
||||||
--outfile=opencode \
|
|
||||||
./packages/opencode/src/index.ts \
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user