summaryrefslogtreecommitdiff
path: root/derivations/windsurf
diff options
context:
space:
mode:
authorpolwex <code@yago.one>2025-02-21 08:59:27 +0000
committerpolwex <code@yago.one>2025-02-21 08:59:27 +0000
commitc0be55eb72fdad38de6e1c72a52b1500216c3043 (patch)
treec053679bb21a023e115a0ab5f96d7926bd05d3c2 /derivations/windsurf
parentfb39334bcdac65a1ff1d95e7e4db2e28eabcc2d6 (diff)
parent59ab4467b69f3ba455ef23163cfc4543338d8a41 (diff)
Merge pull request 'nvidia-wayland' (#1) from nvidia-wayland into master
Reviewed-on: https://git.sortug.com/polwex/nixconf/pulls/1
Diffstat (limited to 'derivations/windsurf')
-rw-r--r--derivations/windsurf/default.nix39
-rw-r--r--derivations/windsurf/flake.lock27
-rw-r--r--derivations/windsurf/flake.nix21
-rw-r--r--derivations/windsurf/update-shell.nix18
-rw-r--r--derivations/windsurf/update.sh70
-rw-r--r--derivations/windsurf/windsurf.nix41
6 files changed, 216 insertions, 0 deletions
diff --git a/derivations/windsurf/default.nix b/derivations/windsurf/default.nix
new file mode 100644
index 0000000..9dc7cec
--- /dev/null
+++ b/derivations/windsurf/default.nix
@@ -0,0 +1,39 @@
+{
+ lib,
+ stdenv,
+ nixpkgs,
+ callPackage,
+ fetchurl,
+ nixosTests,
+ commandLineArgs ? "",
+ useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin,
+}:
+# https://windsurf-stable.codeium.com/api/update/linux-x64/stable/latest
+let
+ version = "1.2.2"; # "windsurfVersion"
+ hash = "c418a14b63f051e96dafb37fe06f1fe0b10ba3c8"; # "version"
+in
+ callPackage "${nixpkgs}/pkgs/applications/editors/vscode/generic.nix" rec {
+ inherit commandLineArgs useVSCodeRipgrep version;
+
+ pname = "windsurf";
+
+ executableName = "windsurf";
+ longName = "Windsurf";
+ shortName = "windsurf";
+
+ src = fetchurl {
+ url = "https://windsurf-stable.codeiumdata.com/linux-x64/stable/${hash}/Windsurf-linux-x64-${version}.tar.gz";
+ hash = "sha256-fsDPzHtAmQIfFX7dji598Q+KXO6A5F9IFEC+bnmQzVU=";
+ };
+
+ sourceRoot = "Windsurf";
+
+ tests = nixosTests.vscodium;
+
+ updateScript = "nil";
+
+ meta = {
+ description = "The first agentic IDE, and then some";
+ };
+ }
diff --git a/derivations/windsurf/flake.lock b/derivations/windsurf/flake.lock
new file mode 100644
index 0000000..1bb2222
--- /dev/null
+++ b/derivations/windsurf/flake.lock
@@ -0,0 +1,27 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1737885589,
+ "narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/derivations/windsurf/flake.nix b/derivations/windsurf/flake.nix
new file mode 100644
index 0000000..dea1732
--- /dev/null
+++ b/derivations/windsurf/flake.nix
@@ -0,0 +1,21 @@
+{
+ # https://github.com/dtgagnon/nix-config/tree/main/packages/windsurf
+ description = "Windsurf flake";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ };
+
+ outputs = {
+ self,
+ nixpkgs,
+ }: let
+ system = "x86_64-linux";
+ pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ packages.${system}.default = pkgs.callPackage ./windsurf.nix {
+ inherit (pkgs) lib stdenv;
+ inherit nixpkgs;
+ };
+ };
+}
diff --git a/derivations/windsurf/update-shell.nix b/derivations/windsurf/update-shell.nix
new file mode 100644
index 0000000..366cef6
--- /dev/null
+++ b/derivations/windsurf/update-shell.nix
@@ -0,0 +1,18 @@
+{
+ lib,
+ pkgs,
+ ...
+}:
+lib.mkShell {
+ packages = with pkgs; [
+ bash
+ curl
+ gawk
+ gnugrep
+ gnused
+ jq
+ nix
+ nix-prefetch
+ nix-prefetch-scripts
+ ];
+}
diff --git a/derivations/windsurf/update.sh b/derivations/windsurf/update.sh
new file mode 100644
index 0000000..8825b65
--- /dev/null
+++ b/derivations/windsurf/update.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+#! nix-shell update-shell.nix -i bash
+
+# Update script for the windsurf package, including vscode versions and hashes.
+# Usually doesn't need to be called by hand,
+# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
+# Call it by hand if the bot fails to automatically update the versions.
+
+set -euo pipefail
+
+# Directory where this script is located
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+# Supported platforms
+declare -A platforms=(
+ ["x86_64-linux"]="linux-x64"
+ # Uncomment when supported
+ # ["x86_64-darwin"]="macos-x64"
+ # ["aarch64-linux"]="linux-arm64"
+ # ["aarch64-darwin"]="macos-arm64"
+ # ["armv7l-linux"]="linux-armhf"
+)
+
+# Get latest version from API json
+get_latest_version() {
+ local plat="$1"
+ curl -s "https://windsurf-stable.codeium.com/api/update/$plat/stable/latest" | jq -r ".windsurfVersion"
+}
+
+# Get commit hash from API json
+get_commit_hash() {
+ local plat="$1"
+ local version="$2"
+ curl -s "https://windsurf-stable.codeium.com/api/update/$plat/stable/latest" | jq -r ".version"
+}
+
+# Get sha256hash from API json
+get_sha256_hash() {
+ local plat="$1"
+ curl -s "https://windsurf-stable.codeium.com/api/update/$plat/stable/latest" | jq -r ".sha256hash"
+}
+
+# Main update function
+update_package() {
+ echo "Updating Windsurf package..."
+
+ # Get version info for linux-x64 (primary platform)
+ local version
+ version=$(get_latest_version "linux-x64")
+ echo "Latest version: $version"
+
+ local commit_hash
+ commit_hash=$(get_commit_hash "linux-x64" "$version")
+ echo "Commit hash: $commit_hash"
+
+ local sha256_hash
+ sha256_hash=$(get_sha256_hash "linux-x64")
+ echo "sha256 hash: $sha256_hash"
+
+ # Update default.nix
+ local default_nix="$SCRIPT_DIR/default.nix"
+ sed -i "s/version = \".*\"/version = \"$version\"/" "$default_nix"
+ sed -i "s|/stable/[a-f0-9]\{40\}/|/stable/$commit_hash/|" "$default_nix"
+ sed -i "s/x86_64-linux = \".*\"/x86_64-linux = \"$sha256_hash\"/" "$default_nix"
+
+ echo "Update complete!"
+}
+
+# Run the update
+update_package
diff --git a/derivations/windsurf/windsurf.nix b/derivations/windsurf/windsurf.nix
new file mode 100644
index 0000000..237be28
--- /dev/null
+++ b/derivations/windsurf/windsurf.nix
@@ -0,0 +1,41 @@
+{
+ lib,
+ stdenv,
+ nixpkgs,
+ callPackage,
+ fetchurl,
+ nixosTests,
+ commandLineArgs ? "",
+ useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin,
+}:
+# https://windsurf-stable.codeium.com/api/update/linux-x64/stable/latest
+let
+ version = "1.2.2"; # "windsurfVersion"
+ hash = "be4251dfb74e60e80fa973d61f3505da1ac9032e"; # "version"
+in
+ callPackage "${nixpkgs}/pkgs/applications/editors/vscode/generic.nix" rec {
+ inherit commandLineArgs useVSCodeRipgrep version;
+
+ pname = "windsurf";
+
+ executableName = "windsurf";
+ longName = "Windsurf";
+ shortName = "windsurf";
+
+ src = fetchurl {
+ url = "https://windsurf-stable.codeiumdata.com/linux-x64/stable/${hash}/Windsurf-linux-x64-${version}.tar.gz";
+ hash = "sha256-s53azwr+bO7UHVAq0iydP09z7ZK9rvF2P7NKoGPmUMM=";
+ };
+
+ sourceRoot = "Windsurf";
+
+ tests = nixosTests.vscodium;
+
+ updateScript = "nil";
+
+ meta = {
+ description = "The first agentic IDE, and then some";
+ };
+ }
+# https://windsurf-stable.codeiumdata.com/linux-x64/stable/be4251dfb74e60e80fa973d61f3505da1ac9032e/Windsurf-linux-x64-1.2.2.tar.gz
+