Gram: Difference between revisions
Init Gram |
Add Section: Installing Extensions |
||
| Line 4: | Line 4: | ||
Gram is available in <code>nixpkgs</code> as {{nixos:package|gram}}. | Gram is available in <code>nixpkgs</code> as {{nixos:package|gram}}. | ||
== Configuration == | |||
=== Installing Extensions === | |||
Gram, unlike Zed, builds extensions locally. This means it needs a Rust WASI Toolchain and <code>clang</code> available to it. | |||
The easiest way to do this is using something like [https://github.com/nix-community/fenix nix-community/fenix] (the same should be able to be done with [https://github.com/oxalica/rust-overlay rust-overlay]). | |||
Add <code>fenix</code> to your flake | |||
{{file|flake.nix|nix| | |||
<nowiki> | |||
{ | |||
inputs = { | |||
fenix = { | |||
url = "github:nix-community/fenix"; | |||
inputs.nixpkgs.follows = "nixpkgs"; | |||
}; | |||
nixpkgs.url = "nixpkgs/nixos-unstable"; # or any other branch | |||
}; | |||
} | |||
</nowiki> | |||
}} | |||
The examples all use the stable version attribute set, but any provided by <code>fenix</code> should work. | |||
{{info| Make sure the versions match between <code>${version}.toolchain</code> (or <code>${version}.rustc</code> + <code>${version}.cargo</code>) & <code>targets.wasm32-wasip2.${version}.stable.rust-std</code> | |||
}} | |||
If Gram gets an official HomeManager module, adding these to <code>programs.gram.extraPackages</code> will be the preferred method, until then here are some options. You should be able to copy & paste the <code>let in</code> statement with any of the usage examples below (unless otherwise specified) into a nix module of the appropriate type (<code>homeManager</code>, <code>nixos</code>, <code>devShell</code>). | |||
==== Let In Statement ==== | |||
<syntaxhighlight lang="nix"> | |||
{inputs, pkgs, system, ... }: | |||
let | |||
# full toolchain: | |||
/* | |||
extension-toolchain = with inputs.fenix.packages.${system}; combine [ | |||
stable.toolchain | |||
targets.wasm32-wasip2.stable.rust-std | |||
]; | |||
*/ | |||
# minimum required to build: | |||
extension-toolchain = with inputs.fenix.packages.${system}; combine [ | |||
stable.rustc | |||
stable.cargo | |||
targets.wasm32-wasip2.stable.rust-std | |||
]; | |||
in | |||
</syntaxhighlight> | |||
==== HomeManager Packages ==== | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
home.packages = with pkgs; [ | |||
clang | |||
extension-toolchain | |||
]; | |||
} | |||
</syntaxhighlight> | |||
==== NixOS Packages ==== | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
environment.systemPackages = with pkgs; [ | |||
clang | |||
extension-toolchain | |||
]; | |||
} | |||
</syntaxhighlight> | |||
==== devShell ==== | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
packages = with pkgs; [ | |||
clang | |||
extension-toolchain | |||
]; | |||
} | |||
</syntaxhighlight> | |||
==== Flake Parts devShell ==== | |||
If using flake parts, devShells need to have their inputs passed to them by <code>perSystem</code> rather than as a top-level attribute. The file paths are only examples and can be replaced to fit the structure of your project. | |||
{{file|default.nix|nix| | |||
<nowiki> | |||
{ inputs, ... }: | |||
{ | |||
perSystem = { config, pkgs, system, flake, ... }: { | |||
devShells.gram = pkgs.callPackage nix/shells/default { fenix = inputs.fenix.packages.${system}; }; | |||
}; | |||
}; | |||
} | |||
</nowiki> | |||
}} | |||
{{file|nix/shells/default/default.nix|nix| | |||
<nowiki> | |||
{ pkgs, fenix, }: | |||
let | |||
# 1. full toolchain: | |||
/* | |||
extension-toolchain = with fenix; combine [ | |||
stable.toolchain | |||
targets.wasm32-wasip2.stable.rust-std | |||
]; | |||
*/ | |||
# 2. minimum required to build: | |||
extension-toolchain = with fenix; combine [ | |||
stable.rustc | |||
stable.cargo | |||
targets.wasm32-wasip2.stable.rust-std | |||
]; | |||
in | |||
pkgs.mkShell { | |||
packages = with pkgs; [ | |||
extension-toolchain | |||
clang | |||
]; | |||
} | |||
</nowiki> | |||
}} | |||
Revision as of 23:32, 28 June 2026
Gram is a fork of Zed removing AI integration and telemetry as well as no user agreement or subscription. For more on the reasoning for and purpose of the fork see the mission statement.
Installation
Gram is available in nixpkgs as gram.
Configuration
Installing Extensions
Gram, unlike Zed, builds extensions locally. This means it needs a Rust WASI Toolchain and clang available to it.
The easiest way to do this is using something like nix-community/fenix (the same should be able to be done with rust-overlay).
Add fenix to your flake
{
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixos-unstable"; # or any other branch
};
}
The examples all use the stable version attribute set, but any provided by fenix should work.
${version}.toolchain (or ${version}.rustc + ${version}.cargo) & targets.wasm32-wasip2.${version}.stable.rust-std
If Gram gets an official HomeManager module, adding these to programs.gram.extraPackages will be the preferred method, until then here are some options. You should be able to copy & paste the let in statement with any of the usage examples below (unless otherwise specified) into a nix module of the appropriate type (homeManager, nixos, devShell).
Let In Statement
{inputs, pkgs, system, ... }:
let
# full toolchain:
/*
extension-toolchain = with inputs.fenix.packages.${system}; combine [
stable.toolchain
targets.wasm32-wasip2.stable.rust-std
];
*/
# minimum required to build:
extension-toolchain = with inputs.fenix.packages.${system}; combine [
stable.rustc
stable.cargo
targets.wasm32-wasip2.stable.rust-std
];
in
HomeManager Packages
{
home.packages = with pkgs; [
clang
extension-toolchain
];
}
NixOS Packages
{
environment.systemPackages = with pkgs; [
clang
extension-toolchain
];
}
devShell
{
packages = with pkgs; [
clang
extension-toolchain
];
}
Flake Parts devShell
If using flake parts, devShells need to have their inputs passed to them by perSystem rather than as a top-level attribute. The file paths are only examples and can be replaced to fit the structure of your project.
{ inputs, ... }:
{
perSystem = { config, pkgs, system, flake, ... }: {
devShells.gram = pkgs.callPackage nix/shells/default { fenix = inputs.fenix.packages.${system}; };
};
};
}
{ pkgs, fenix, }:
let
# 1. full toolchain:
/*
extension-toolchain = with fenix; combine [
stable.toolchain
targets.wasm32-wasip2.stable.rust-std
];
*/
# 2. minimum required to build:
extension-toolchain = with fenix; combine [
stable.rustc
stable.cargo
targets.wasm32-wasip2.stable.rust-std
];
in
pkgs.mkShell {
packages = with pkgs; [
extension-toolchain
clang
];
}