From 1f9f40ed414d347139d5025d79f645da5af391c0 Mon Sep 17 00:00:00 2001 From: rtk Date: Fri, 2 Oct 2026 18:02:17 +0100 Subject: [PATCH 1/7] refactor(nix): reformat and remove unnecessary arguments pkgs.callPackage automatically fills the arguments to default.nix from the nixpkgs package set. But rust still needs to be overridden. However, since goboscript builds on stable rust again, it may be possible to remove the rust-overlay dependency and use rust directly from nixpkgs --- default.nix | 17 ++++++++++------- flake.nix | 45 +++++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/default.nix b/default.nix index 4e2d9e27..22d3310f 100644 --- a/default.nix +++ b/default.nix @@ -1,17 +1,20 @@ -{ lib, rustPlatform, pkg-config, openssl, rust }: - +{ + lib, + rustPlatform, + pkg-config, + openssl, + rust, +}: rustPlatform.buildRustPackage { pname = "goboscript"; version = "3.3.0"; src = ./.; - cargoLock = { - lockFile = ./Cargo.lock; - }; + cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [ pkg-config rust ]; - buildInputs = [ openssl ]; + nativeBuildInputs = [pkg-config rust]; + buildInputs = [openssl]; meta = { description = "goboscript is the Scratch compiler"; diff --git a/flake.nix b/flake.nix index 4d6b67fc..8f5f4d1d 100644 --- a/flake.nix +++ b/flake.nix @@ -7,27 +7,32 @@ rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = inputs@{ self, nixpkgs, flake-utils, rust-overlay, ... }: - flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-darwin" ] (system: let - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { - inherit system overlays; - }; - rust = pkgs.rust-bin.stable.latest.default; - in rec { - packages.goboscript = pkgs.callPackage ./default.nix { - inherit (pkgs) pkg-config openssl; - inherit rust; - }; + outputs = { + nixpkgs, + flake-utils, + rust-overlay, + ... + }: + flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let + pkgs = import nixpkgs { + inherit system; + overlays = [ + (import rust-overlay) + ]; + }; + rust = pkgs.rust-bin.stable.latest.default; + in rec { + packages.goboscript = pkgs.callPackage ./default.nix { + inherit rust; + }; - legacyPackages = packages; + legacyPackages = packages; - defaultPackage = packages.goboscript; + defaultPackage = packages.goboscript; - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ git openssl pkg-config ]; - packages = [ packages.goboscript ]; - nativeBuildInputs = [ rust ]; - }; - }); + devShell = pkgs.mkShell { + buildInputs = with pkgs; [rust git]; + packages = [packages.goboscript]; + }; + }); } From 0ce6b37159d6c02ac73861217b39b36039154c36 Mon Sep 17 00:00:00 2001 From: rtk Date: Fri, 2 Oct 2026 18:28:23 +0100 Subject: [PATCH 2/7] refactor: remove rust-overlay dependency this required an update of nixpkgs --- default.nix | 3 +-- flake.lock | 43 ++++--------------------------------------- flake.nix | 16 +++------------- 3 files changed, 8 insertions(+), 54 deletions(-) diff --git a/default.nix b/default.nix index 22d3310f..11b844fc 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,6 @@ rustPlatform, pkg-config, openssl, - rust, }: rustPlatform.buildRustPackage { pname = "goboscript"; @@ -13,7 +12,7 @@ rustPlatform.buildRustPackage { cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [pkg-config rust]; + nativeBuildInputs = [pkg-config]; buildInputs = [openssl]; meta = { diff --git a/flake.lock b/flake.lock index f22118b1..36fda4e8 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1741513245, - "narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=", + "lastModified": 1790822859, + "narHash": "sha256-69xHQhAeMAD2wDXO7T2pcOZIF9Sga2W+JkmY2a11Ops=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1", + "rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa", "type": "github" }, "original": { @@ -34,45 +34,10 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1744536153, - "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1773975983, - "narHash": "sha256-zrRVwdfhDdohANqEhzY/ydeza6EXEi8AG6cyMRNYT9Q=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "cc80954a95f6f356c303ed9f08d0b63ca86216ac", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" + "nixpkgs": "nixpkgs" } }, "systems": { diff --git a/flake.nix b/flake.nix index 8f5f4d1d..cf251237 100644 --- a/flake.nix +++ b/flake.nix @@ -4,34 +4,24 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { nixpkgs, flake-utils, - rust-overlay, ... }: flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let - pkgs = import nixpkgs { - inherit system; - overlays = [ - (import rust-overlay) - ]; - }; - rust = pkgs.rust-bin.stable.latest.default; + pkgs = nixpkgs.legacyPackages.${system}; in rec { - packages.goboscript = pkgs.callPackage ./default.nix { - inherit rust; - }; + packages.goboscript = pkgs.callPackage ./default.nix {}; legacyPackages = packages; defaultPackage = packages.goboscript; devShell = pkgs.mkShell { - buildInputs = with pkgs; [rust git]; + buildInputs = with pkgs; [git cargo rustc]; packages = [packages.goboscript]; }; }); From 6164ca0339bedb0a7e4fc919703c735c652916ec Mon Sep 17 00:00:00 2001 From: rtk Date: Fri, 2 Oct 2026 19:53:39 +0100 Subject: [PATCH 3/7] refactor: remove flake-utils dependency However this means that legacyPackages is no longer exported among any other implicit flake-utils behavior Also refactored default.nix to return an attribute set, so the vscode extension can be added in that same file. --- default.nix | 26 ++++++++++++++------------ flake.lock | 34 ---------------------------------- flake.nix | 30 ++++++++++++++++-------------- 3 files changed, 30 insertions(+), 60 deletions(-) diff --git a/default.nix b/default.nix index 11b844fc..62dc7ea1 100644 --- a/default.nix +++ b/default.nix @@ -3,21 +3,23 @@ rustPlatform, pkg-config, openssl, -}: -rustPlatform.buildRustPackage { - pname = "goboscript"; - version = "3.3.0"; +}: rec { + default = goboscript; + goboscript = rustPlatform.buildRustPackage { + pname = "goboscript"; + version = "3.3.0"; - src = ./.; + src = ./.; - cargoLock.lockFile = ./Cargo.lock; + cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [pkg-config]; - buildInputs = [openssl]; + nativeBuildInputs = [pkg-config]; + buildInputs = [openssl]; - meta = { - description = "goboscript is the Scratch compiler"; - homepage = "https://github.com/aspizu/goboscript"; - license = lib.licenses.mit; + meta = { + description = "goboscript is the Scratch compiler"; + homepage = "https://github.com/aspizu/goboscript"; + license = lib.licenses.mit; + }; }; } diff --git a/flake.lock b/flake.lock index 36fda4e8..04210c1d 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1790822859, @@ -36,24 +18,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index cf251237..75d54805 100644 --- a/flake.nix +++ b/flake.nix @@ -3,26 +3,28 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; }; outputs = { + self, nixpkgs, - flake-utils, ... - }: - flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in rec { - packages.goboscript = pkgs.callPackage ./default.nix {}; - - legacyPackages = packages; - - defaultPackage = packages.goboscript; - - devShell = pkgs.mkShell { + }: let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system (pkgsFor system)); + pkgsFor = system: nixpkgs.legacyPackages.${system}; + in { + packages = forAllSystems (_: pkgs: pkgs.callPackages ./default.nix {}); + devShells = forAllSystems (system: pkgs: { + default = pkgs.mkShell { buildInputs = with pkgs; [git cargo rustc]; - packages = [packages.goboscript]; + packages = [self.packages.${system}.goboscript]; }; }); + }; } From 6e5d4e8fced80508c18561fdf35e896c0f1a1719 Mon Sep 17 00:00:00 2001 From: rtk Date: Fri, 2 Oct 2026 20:11:45 +0100 Subject: [PATCH 4/7] feat: package vscode extension with nix This just fetches the built extension from the marketplace closes #389 --- default.nix | 10 ++++++++++ flake.nix | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 62dc7ea1..3a26bca0 100644 --- a/default.nix +++ b/default.nix @@ -3,6 +3,7 @@ rustPlatform, pkg-config, openssl, + vscode-utils, }: rec { default = goboscript; goboscript = rustPlatform.buildRustPackage { @@ -22,4 +23,13 @@ license = lib.licenses.mit; }; }; + # Just fetch the existing builds which are sent to the VS Marketplace + goboscript-vscode = vscode-utils.buildVscodeMarketplaceExtension { + mktplcRef = { + name = "goboscript"; + publisher = "aspizu"; + version = "1.0.3"; + hash = "sha256-myVGhoighWMktD78qHTTs/t0dU0S68xX0aWbWiFEtqs="; + }; + }; } diff --git a/flake.nix b/flake.nix index 75d54805..cf70d7ee 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system (pkgsFor system)); pkgsFor = system: nixpkgs.legacyPackages.${system}; in { - packages = forAllSystems (_: pkgs: pkgs.callPackages ./default.nix {}); + packages = forAllSystems (_: pkgs: pkgs.callPackage ./default.nix {}); devShells = forAllSystems (system: pkgs: { default = pkgs.mkShell { buildInputs = with pkgs; [git cargo rustc]; From 563d63a945ff4e8e8fe5198f23d13538f26dba52 Mon Sep 17 00:00:00 2001 From: rtk Date: Fri, 2 Oct 2026 21:09:49 +0100 Subject: [PATCH 5/7] docs: nix flake usage for vscode extension --- docs/editor-integration/vscode.md | 19 +++++++++++++++++++ docs/install.md | 11 ++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/editor-integration/vscode.md b/docs/editor-integration/vscode.md index 234407c4..d4fb99c9 100644 --- a/docs/editor-integration/vscode.md +++ b/docs/editor-integration/vscode.md @@ -28,3 +28,22 @@ updated `.sb3` file. The preview does not reload automatically. The preview's **Console** shows messages from [`log`, `warn`, and `error`](../language/blocks/debugger.md), along with the sprite or clone that sent them. Messages can be filtered by level. + +## Install on nix + +To install with nix, add the goboscript flake to your flake inputs. +You can then use `inputs.goboscript.packages.${system}.goboscript-vscode` +(`${system}` is a string like `x86_64-linux` or `aarch64-darwin`) to access the +packaged VSCode extension. You can then use this package much like any other +VSCode package which you would find in nixpkgs: e.g. for use with `home-manager`: + +```nix +programs.vscode = { + enable = true; + profiles.default = { + extensions = [ + inputs.goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript-vscode + ]; + }; +}; +``` diff --git a/docs/install.md b/docs/install.md index f4eb1091..6a09d058 100644 --- a/docs/install.md +++ b/docs/install.md @@ -39,6 +39,8 @@ cargo install --git https://github.com/aspizu/goboscript --locked --force The nix flake installs goboscript from source, like the other methods, so you will need to be patient. + You can also [install the goboscript VSCode extension with nix](./editor-integration/vscode.md). + ### devShell You can test goboscript without installing it to your system with the nix devshell, a bit like `nix-shell -p {some package}`. @@ -51,13 +53,15 @@ Simply run the command `nix develop github:aspizu/goboscript` ### Nixos standalone installation (flake) -This is for if you want to have `goboscript` available system-wide. -For nix flakes, add the input `goboscript` and add it to `environment.systemPackages` in your flake, roughly like so: +To install the goboscript *compiler*, you can add `goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript` to your system packages list. +For nix flakes, add the input `goboscript` and add it to `environment.systemPackages` in your flake like so: + +[This repository](https://codeberg.org/rtk/dotfiles) is an example usage of the goboscript flake. ```nix { inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=25.11"; + nixpkgs.url = "github:nixos/nixpkgs?ref=26.05"; goboscript.url = "github:aspizu/goboscript"; }; outputs = { self, nixpkgs, goboscript, ... }: { @@ -68,6 +72,7 @@ For nix flakes, add the input `goboscript` and add it to `environment.systemPack goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript ]; }) + # The rest of your nixos configuration... ]; }; }; From 25c436154ede3d1e7e0de67632f298b292404542 Mon Sep 17 00:00:00 2001 From: rtk Date: Mon, 19 Oct 2026 19:12:27 +0100 Subject: [PATCH 6/7] feat: separate devshell and demo shell --- flake.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flake.nix b/flake.nix index cf70d7ee..57b7f3bd 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,13 @@ devShells = forAllSystems (system: pkgs: { default = pkgs.mkShell { buildInputs = with pkgs; [git cargo rustc]; + inputsFrom = [self.packages.${system}.goboscript]; + }; + demo = pkgs.mkShell { packages = [self.packages.${system}.goboscript]; + shellHook = '' + goboscript --help + ''; }; }); }; From d6b2f19f27af6219e40798a351edbddd1ae94712 Mon Sep 17 00:00:00 2001 From: rtk Date: Mon, 19 Oct 2026 19:17:17 +0100 Subject: [PATCH 7/7] docs: update devshell documentation --- docs/install.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/install.md b/docs/install.md index 6a09d058..d19f621b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -43,13 +43,7 @@ cargo install --git https://github.com/aspizu/goboscript --locked --force ### devShell -You can test goboscript without installing it to your system with the nix devshell, a bit like `nix-shell -p {some package}`. -This will create a subshell where `goboscript` is installed. -Once you exit this subshell, you will no longer be able to use the `goboscript` command -(until you open a new devShell or install it system-wide). -Once you run `nix-collect-garbage`, the `goboscript` installation files will actually be removed from your system. - -Simply run the command `nix develop github:aspizu/goboscript` +The demo devshell can be accessed with `nix develop github:aspizu/goboscript#demo` ### Nixos standalone installation (flake) @@ -69,7 +63,7 @@ For nix flakes, add the input `goboscript` and add it to `environment.systemPack modules = [ ({ pkgs, ... }: { environment.systemPackages = [ - goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript + goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript # this is the important line ]; }) # The rest of your nixos configuration...