windsurf: init at 1.2.6

This commit is contained in:
ZHAO Jin-Xiang 2025-02-08 15:18:48 +08:00
parent b6c8f0a897
commit ff705b9dd5
8 changed files with 188 additions and 1 deletions

View File

@ -33,6 +33,7 @@
# Attributes inherit from specific versions
version,
vscodeVersion ? version,
src,
meta,
sourceRoot,
@ -303,7 +304,7 @@ stdenv.mkDerivation (
let
vscodeRipgrep =
if stdenv.hostPlatform.isDarwin then
if lib.versionAtLeast version "1.94.0" then
if lib.versionAtLeast vscodeVersion "1.94.0" then
"Contents/Resources/app/node_modules/@vscode/ripgrep/bin/rg"
else
"Contents/Resources/app/node_modules.asar.unpacked/@vscode/ripgrep/bin/rg"

View File

@ -0,0 +1,20 @@
{
"aarch64-darwin": {
"version": "1.2.6",
"vscodeVersion": "1.94.0",
"url": "https://windsurf-stable.codeiumdata.com/darwin-arm64/stable/d08b8ea13d580d24be204c76e5dd1651d7234cd2/Windsurf-darwin-arm64-1.2.6.zip",
"sha256": "b9a63785454003f7ccb3b6adebe232e24618247244b556ef61e9e974a4b77f65"
},
"x86_64-darwin": {
"version": "1.2.6",
"vscodeVersion": "1.94.0",
"url": "https://windsurf-stable.codeiumdata.com/darwin-x64/stable/d08b8ea13d580d24be204c76e5dd1651d7234cd2/Windsurf-darwin-x64-1.2.6.zip",
"sha256": "4a4beae35117162b484521a64fc67cac044ced17a971553ab75ba8823b3cbb75"
},
"x86_64-linux": {
"version": "1.2.6",
"vscodeVersion": "1.94.0",
"url": "https://windsurf-stable.codeiumdata.com/linux-x64/stable/d08b8ea13d580d24be204c76e5dd1651d7234cd2/Windsurf-linux-x64-1.2.6.tar.gz",
"sha256": "ad71eb02b9302d4cf1413c0a83763f45fe455e5be74ee9e1477bea2e85a02caa"
}
}

View File

@ -0,0 +1,57 @@
{
lib,
stdenv,
callPackage,
vscode-generic,
fetchurl,
nixosTests,
commandLineArgs ? "",
useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin,
}:
let
info =
(lib.importJSON ./info.json)."${stdenv.hostPlatform.system}"
or (throw "windsurf: unsupported system ${stdenv.hostPlatform.system}");
in
callPackage vscode-generic rec {
inherit commandLineArgs useVSCodeRipgrep;
inherit (info) version vscodeVersion;
pname = "windsurf";
executableName = "windsurf";
longName = "Windsurf";
shortName = "windsurf";
sourceRoot = if stdenv.hostPlatform.isDarwin then "Windsurf.app" else "Windsurf";
src = fetchurl { inherit (info) url sha256; };
tests = nixosTests.vscodium;
updateScript = ./update/update.mts;
# Editing the `codium` binary (and shell scripts) within the app bundle causes the bundle's signature
# to be invalidated, which prevents launching starting with macOS Ventura, because VSCodium is notarized.
# See https://eclecticlight.co/2022/06/17/app-security-changes-coming-in-ventura/ for more information.
dontFixup = stdenv.hostPlatform.isDarwin;
meta = {
description = "Agentic IDE powered by AI Flow paradigm";
longDescription = ''
The first agentic IDE, and then some.
The Windsurf Editor is where the work of developers and AI truly flow together, allowing for a coding experience that feels like literal magic.
'';
homepage = "https://codeium.com/windsurf";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
xiaoxiangmoe
];
platforms = [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
};
}

View File

@ -0,0 +1,2 @@
node_modules
package-lock.json

View File

@ -0,0 +1,12 @@
{
"name": "windsurf-scripts",
"version": "1.0.0",
"scripts": {
"update": "node update.mts"
},
"dependencies": {
"@types/node": "^22.13.1",
"prettier": "^3.4.2",
"typescript": "^5.7.3"
}
}

View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"module": "NodeNext",
"noEmit": true,
"strict": true
}
}

View File

@ -0,0 +1,82 @@
#!/usr/bin/env nix-shell
/*
#!nix-shell -i node --pure --packages cacert nodejs_23
*/
import * as assert from "node:assert/strict";
import * as fsPromises from "node:fs/promises";
import * as path from "node:path";
import * as process from "node:process";
const __dirname = import.meta.dirname;
const __filename = import.meta.filename;
interface LatestInfo {
readonly url: string;
readonly sha256hash: string;
readonly windsurfVersion: string;
readonly productVersion: string;
}
const platforms = ["aarch64-darwin", "x86_64-darwin", "x86_64-linux"] as const;
type Platform = (typeof platforms)[number];
type InfoMap = Record<
Platform,
{
readonly version: string;
readonly vscodeVersion: string;
readonly url: string;
readonly sha256: string;
}
>;
async function getInfo(targetSystem: "darwin-arm64" | "darwin-x64" | "linux-x64") {
const url =
`https://windsurf-stable.codeium.com/api/update/${targetSystem}/stable/latest` as const;
const response = await fetch(url);
assert.ok(response.ok, `Failed to fetch ${url}`);
const latestInfo: LatestInfo = JSON.parse(await response.text());
assert.ok(latestInfo.sha256hash, "sha256hash is required");
assert.ok(latestInfo.url, "url is required");
assert.ok(latestInfo.windsurfVersion, "windsurfVersion is required");
assert.ok(latestInfo.productVersion, "productVersion is required");
return {
version: latestInfo.windsurfVersion,
vscodeVersion: latestInfo.productVersion,
url: latestInfo.url,
sha256: latestInfo.sha256hash,
};
}
async function main() {
const filePath = path.join(__dirname, "../info.json");
const oldInfo = JSON.parse(
await fsPromises.readFile(filePath, { encoding: "utf-8" }),
);
const info: InfoMap = {
"aarch64-darwin": await getInfo("darwin-arm64"),
"x86_64-darwin": await getInfo("darwin-x64"),
"x86_64-linux": await getInfo("linux-x64"),
};
if (JSON.stringify(oldInfo) === JSON.stringify(info)) {
console.log("[update] No updates found");
return;
}
for (const platform of platforms) {
console.log(
`[update] Updating Windsurf ${platform} ${oldInfo[platform].version} -> ${info[platform].version}`,
);
}
await fsPromises.writeFile(
filePath,
JSON.stringify(info, null, 2) + "\n",
"utf-8",
);
console.log("[update] Updating Windsurf complete");
}
if (process.argv[1] === __filename) {
main();
}

View File

@ -15594,6 +15594,10 @@ with pkgs;
vscodium-fhs = vscodium.fhs;
vscodium-fhsWithPackages = vscodium.fhsWithPackages;
windsurf = callPackage ../by-name/wi/windsurf/package.nix {
vscode-generic = ../applications/editors/vscode/generic.nix;
};
openvscode-server = callPackage ../servers/openvscode-server {
nodejs = nodejs_18;
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa Security;