Skip to content

Commit 0680dfb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents acde6c2 + 9c86348 commit 0680dfb

4 files changed

Lines changed: 100 additions & 10 deletions

File tree

default.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
{ lib, rustPlatform }:
1+
{ lib, rustPlatform, pkg-config, openssl, rust }:
22

33
rustPlatform.buildRustPackage {
44
pname = "goboscript";
5-
version = "3.0.0";
5+
version = "3.3.0";
66

77
src = ./.;
88

99
cargoLock = {
1010
lockFile = ./Cargo.lock;
1111
};
1212

13+
nativeBuildInputs = [ pkg-config rust ];
14+
buildInputs = [ openssl ];
15+
1316
meta = {
14-
description = "Scratch compiler";
17+
description = "goboscript is the Scratch compiler";
1518
homepage = "https://github.com/aspizu/goboscript";
1619
license = lib.licenses.mit;
1720
};
18-
}
21+
}

docs/install.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,45 @@ To update:
3838
```bash
3939
cargo +nightly install --git https://github.com/aspizu/goboscript --force
4040
```
41+
42+
## Install with nix
43+
44+
!!! note
45+
46+
The nix flake installs goboscript from source, like the other methods, so you will need to be patient.
47+
48+
### devShell
49+
50+
You can test goboscript without installing it to your system with the nix devshell, a bit like `nix-shell -p {some package}`.
51+
This will create a subshell where `goboscript` is installed.
52+
Once you exit this subshell, you will no longer be able to use the `goboscript` command
53+
(until you open a new devShell or install it system-wide).
54+
Once you run `nix-collect-garbage`, the `goboscript` installation files will actually be removed from your system.
55+
56+
Simply run the command `nix develop github:aspizu/goboscript`
57+
58+
### Nixos standalone installation (flake)
59+
60+
This is for if you want to have `goboscript` available system-wide.
61+
For nix flakes, add the input `goboscript` and add it to `environment.systemPackages` in your flake, roughly like so:
62+
63+
```nix
64+
{
65+
inputs = {
66+
nixpkgs.url = "github:nixos/nixpkgs?ref=25.11";
67+
goboscript.url = "github:aspizu/goboscript";
68+
};
69+
outputs = { self, nixpkgs, goboscript, ... }: {
70+
nixosConfigurations.yourHostname = nixpkgs.lib.nixosSystem {
71+
modules = [
72+
({ pkgs, ... }: {
73+
environment.systemPackages = [
74+
goboscript.packages.${pkgs.stdenv.hostPlatform.system}.goboscript
75+
];
76+
})
77+
];
78+
};
79+
};
80+
}
81+
```
82+

flake.lock

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
11
{
2-
description = "Scratch compiler";
2+
description = "goboscript is the Scratch compiler";
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
66
flake-utils.url = "github:numtide/flake-utils";
7+
rust-overlay.url = "github:oxalica/rust-overlay";
78
};
89

9-
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
10+
outputs = inputs@{ self, nixpkgs, flake-utils, rust-overlay, ... }:
1011
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-darwin" ] (system: let
11-
pkgs = nixpkgs.legacyPackages.${system};
12+
overlays = [ (import rust-overlay) ];
13+
pkgs = import nixpkgs {
14+
inherit system overlays;
15+
};
16+
rust = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
1217
in rec {
13-
packages.goboscript = pkgs.callPackage ./default.nix { };
18+
packages.goboscript = pkgs.callPackage ./default.nix {
19+
inherit (pkgs) pkg-config openssl;
20+
inherit rust;
21+
};
1422

1523
legacyPackages = packages;
1624

1725
defaultPackage = packages.goboscript;
1826

1927
devShell = pkgs.mkShell {
20-
buildInputs = with pkgs; [ cargo rustc git ];
28+
buildInputs = with pkgs; [ git openssl pkg-config ];
29+
packages = [ packages.goboscript ];
30+
nativeBuildInputs = [ rust ];
2131
};
2232
});
2333
}

0 commit comments

Comments
 (0)