Skip to content

Instantly share code, notes, and snippets.

@ian-h-chamberlain
Last active August 10, 2025 04:26
Show Gist options
  • Select an option

  • Save ian-h-chamberlain/0c31a7e76c72985449ffad5a6d5e6b4a to your computer and use it in GitHub Desktop.

Select an option

Save ian-h-chamberlain/0c31a7e76c72985449ffad5a6d5e6b4a to your computer and use it in GitHub Desktop.
Flake for helix + steel
# Nix
result*
# Misc
.direnv
{
"nodes": {
"cogs": {
"flake": false,
"locked": {
"lastModified": 1750629192,
"narHash": "sha256-1g9j8M9JBiVnQb/pEmKNJ1lXfEPJpUScVk5RTV85bwM=",
"owner": "mattwparas",
"repo": "helix-config",
"rev": "b651bde993a2b2f588d4c9de3ec02f21c66e976b",
"type": "github"
},
"original": {
"owner": "mattwparas",
"repo": "helix-config",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"steel",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"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"
}
},
"helix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1754773544,
"narHash": "sha256-P/cVepOCWXR7WvhQif0SQmOxFjVf6e9/dPDr8BwBW9k=",
"owner": "mattwparas",
"repo": "helix",
"rev": "374412acf03d2764c73c242e67fb2640bfdf4f65",
"type": "github"
},
"original": {
"owner": "mattwparas",
"ref": "steel-event-system",
"repo": "helix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1753939845,
"narHash": "sha256-K2ViRJfdVGE8tpJejs8Qpvvejks1+A4GQej/lBk5y7I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "94def634a20494ee057c76998843c015909d6311",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"cogs": "cogs",
"flake-utils": "flake-utils",
"helix": "helix",
"nixpkgs": "nixpkgs",
"steel": "steel"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"helix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1740623427,
"narHash": "sha256-3SdPQrZoa4odlScFDUHd4CUPQ/R1gtH4Mq9u8CBiK8M=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d342e8b5fd88421ff982f383c853f0fc78a847ab",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"steel": {
"inputs": {
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1754772587,
"narHash": "sha256-3yexvzmVADPMVlDYMWSRjwjCKICBD7ttP4RLC1jBR9U=",
"owner": "mattwparas",
"repo": "steel",
"rev": "6d64abcc789784788b3abfa003d89cb434c10b54",
"type": "github"
},
"original": {
"owner": "mattwparas",
"repo": "steel",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"steel",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743748085,
"narHash": "sha256-uhjnlaVTWo5iD3LXics1rp9gaKgDRQj6660+gbUU3cE=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "815e4121d6a5d504c0f96e5be2dd7f871e4fd99d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
{
description = "Helix + Steel";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
helix = {
url = "github:mattwparas/helix?ref=steel-event-system";
inputs.nixpkgs.follows = "nixpkgs";
};
steel = {
url = "github:mattwparas/steel";
inputs.nixpkgs.follows = "nixpkgs";
};
cogs = {
url = "github:mattwparas/helix-config";
flake = false;
};
};
outputs =
{
nixpkgs,
flake-utils,
helix,
cogs,
steel,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend helix.overlays.default;
steel' = steel.packages.${system}.default;
steelHome = "$out/lib/steel";
helix' = pkgs.helix.overrideAttrs (prev: {
nativeBuildInputs = prev.nativeBuildInputs ++ [ steel' ];
cargoBuildFeatures = prev.cargoBuildFeatures ++ [ "steel" ];
patches = prev.patches ++ [
(pkgs.writeText "skip-source-gen.patch" ''
diff --git c/helix-term/src/commands/engine/steel/mod.rs i/helix-term/src/commands/engine/steel/mod.rs
index 4c1d9b10..454f90d4 100644
--- c/helix-term/src/commands/engine/steel/mod.rs
+++ i/helix-term/src/commands/engine/steel/mod.rs
@@ -4421,11 +4421,11 @@ fn configure_engine_impl(mut engine: Engine) -> Engine {
engine.register_value(
"*helix.id*",
SteelVal::IntV(engine.engine_id().as_usize() as _),
);
- configure_builtin_sources(&mut engine, true);
+ configure_builtin_sources(&mut engine, false);
// Hooks
engine.register_fn("register-hook!", register_hook);
engine.register_fn("log::info!", |message: SteelVal| {
if let SteelVal::StringV(s) = &message {
'')
];
postBuild = ''
${prev.postBuild or ""}
export STEEL_HOME="${steelHome}"
export CARGO_HOME="$TMPDIR/.cargo"
cargo build -p xtask --features helix-term/steel
forge build ${cogs} || exit 1
'';
preInstall = ''
${prev.preInstall or ""}
export STEEL_HOME="${steelHome}"
export CARGO_HOME="$TMPDIR/.cargo"
mkdir -p ${steelHome}/cogs/helix
cargo run -p xtask --features helix-term/steel -- code-gen || exit 1
forge install ${cogs} || exit 1
'';
});
in
{
packages =
let
inherit (pkgs) lib makeWrapper;
wrapExe =
prog: # bash
''wrapProgram "$out/bin/${prog}" --set STEEL_HOME "${steelHome}"'';
wrapExes = lib.concatMapStringsSep "\n" wrapExe [
"hx"
"steel"
"forge"
"repl-connect"
"cargo-steel-lib"
"steel-language-server"
];
in
{
helix = helix';
default = pkgs.symlinkJoin {
name = "helix-cogs";
paths = [
helix'
steel'
];
buildInputs = [
makeWrapper
steel'
];
preInstall = ''
${wrapExes}
mkdir -p $out/share/fish/vendor_completions.d/
steel completions fish > $out/share/fish/vendor_completions.d/steel.fish
'';
meta.mainProgram = "hx";
};
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment