Skip to content
Merged
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
44 changes: 29 additions & 15 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
{ lib, rustPlatform, pkg-config, openssl, rust }:
{
lib,
rustPlatform,
pkg-config,
openssl,
vscode-utils,
}: rec {
default = goboscript;
goboscript = rustPlatform.buildRustPackage {
pname = "goboscript";
version = "3.3.0";

rustPlatform.buildRustPackage {
pname = "goboscript";
version = "3.3.0";
src = ./.;

src = ./.;
cargoLock.lockFile = ./Cargo.lock;

cargoLock = {
lockFile = ./Cargo.lock;
};

nativeBuildInputs = [ pkg-config rust ];
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;
};
};
# 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=";
};
};
}
19 changes: 19 additions & 0 deletions docs/editor-integration/vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
};
};
```
21 changes: 10 additions & 11 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,34 @@ 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.

### devShell
You can also [install the goboscript VSCode extension with nix](./editor-integration/vscode.md).

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.
### devShell

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)

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to remove the link to my dotfiles repo. I just added since it is relatively common for nix projects to have reference configs. In this case, the use of the goboscript nix stuff is rather simple so perhaps it is unnecessary.


```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, ... }: {
nixosConfigurations.yourHostname = nixpkgs.lib.nixosSystem {
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...
];
};
};
Expand Down
77 changes: 4 additions & 73 deletions flake.lock

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

53 changes: 28 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,34 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
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;
};

legacyPackages = packages;

defaultPackage = packages.goboscript;

devShell = pkgs.mkShell {
buildInputs = with pkgs; [ git openssl pkg-config ];
packages = [ packages.goboscript ];
nativeBuildInputs = [ rust ];
};
});
outputs = {
self,
nixpkgs,
...
}: 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.callPackage ./default.nix {});
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];
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
shellHook = ''
goboscript --help
'';
};
});
};
}
Loading