-
Notifications
You must be signed in to change notification settings - Fork 3
chore: add nix flake #181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: add nix flake #181
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,3 +45,6 @@ tmp/ | |
| # Temporary files | ||
| *.tmp | ||
| *.bak | ||
|
|
||
| # Nix build result | ||
| /result | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -95,6 +95,24 @@ cd helix-trainer-*/ | |||||||||||||||
| > [!TIP] | ||||||||||||||||
| > Verify checksums with `sha256sum -c helix-trainer-*.sha256` | ||||||||||||||||
|
|
||||||||||||||||
| ### Nix | ||||||||||||||||
|
|
||||||||||||||||
| Run directly without installing: | ||||||||||||||||
|
|
||||||||||||||||
| ```bash | ||||||||||||||||
| nix run github:bug-ops/helix-trainer | ||||||||||||||||
| ``` | ||||||||||||||||
|
|
||||||||||||||||
| Or add to your NixOS/home-manager configuration: | ||||||||||||||||
|
|
||||||||||||||||
| ```nix | ||||||||||||||||
| # flake.nix | ||||||||||||||||
| inputs.helix-trainer.url = "github:bug-ops/helix-trainer"; | ||||||||||||||||
|
|
||||||||||||||||
| # configuration.nix or home.nix | ||||||||||||||||
| environment.systemPackages = [ inputs.helix-trainer.packages.${system}.default ]; | ||||||||||||||||
|
Comment on lines
+112
to
+113
|
||||||||||||||||
| # configuration.nix or home.nix | |
| environment.systemPackages = [ inputs.helix-trainer.packages.${system}.default ]; | |
| # configuration.nix (NixOS) | |
| environment.systemPackages = [ inputs.helix-trainer.packages.${pkgs.system}.default ]; | |
| # home.nix (home-manager) | |
| home.packages = [ inputs.helix-trainer.packages.${pkgs.system}.default ]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,141 @@ | ||||||
| { | ||||||
| description = "Interactive trainer for learning Helix editor keybindings"; | ||||||
|
|
||||||
| inputs = { | ||||||
| nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||||||
| flake-parts.url = "github:hercules-ci/flake-parts"; | ||||||
| rust-overlay = { | ||||||
| url = "github:oxalica/rust-overlay"; | ||||||
| inputs.nixpkgs.follows = "nixpkgs"; | ||||||
| }; | ||||||
| crane.url = "github:ipetkov/crane"; | ||||||
| helix-src = { | ||||||
| url = "github:helix-editor/helix/25.07.1"; | ||||||
| flake = false; | ||||||
| }; | ||||||
| }; | ||||||
|
|
||||||
| outputs = inputs: | ||||||
| inputs.flake-parts.lib.mkFlake {inherit inputs;} { | ||||||
| systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; | ||||||
|
|
||||||
| perSystem = { | ||||||
| self', | ||||||
| pkgs, | ||||||
| lib, | ||||||
| system, | ||||||
| ... | ||||||
| }: let | ||||||
| rustToolchain = pkgs.rust-bin.stable."1.89.0".default; | ||||||
| craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain; | ||||||
|
|
||||||
| nativeBuildInputs = with pkgs; [ | ||||||
| pkg-config | ||||||
| rustToolchain | ||||||
| ]; | ||||||
|
|
||||||
| buildInputs = with pkgs; | ||||||
| [ | ||||||
| oniguruma # syntect regex-onig | ||||||
| ] | ||||||
| ++ lib.optionals stdenv.isLinux [ | ||||||
| alsa-lib # rodio audio playback | ||||||
| ] | ||||||
| ++ lib.optionals stdenv.isDarwin [ | ||||||
| darwin.apple_sdk.frameworks.AudioUnit | ||||||
| darwin.apple_sdk.frameworks.CoreAudio | ||||||
| darwin.apple_sdk.frameworks.CoreFoundation | ||||||
| ]; | ||||||
|
|
||||||
| # Patch the vendored deps to include languages.toml that | ||||||
| # helix-loader expects via include_bytes!("../../languages.toml") | ||||||
| vendorDir = craneLib.vendorCargoDeps {src = ./.;}; | ||||||
|
||||||
| vendorDir = craneLib.vendorCargoDeps {src = ./.;}; | |
| vendorDir = craneLib.vendorCargoDeps { src = src; }; |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Nix clippy check doesn’t enable all Cargo features (--all-features), so it can miss warnings that CI currently catches. Align this with the repository’s clippy invocation used in CI to avoid drift.
| cargoClippyExtraArgs = "--all-targets -- --deny warnings"; | |
| cargoClippyExtraArgs = "--all-features --all-targets -- --deny warnings"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The quick start now suggests
nix developprovides the dev tooling, but later steps requirecargo +nightly fmt(rustup toolchain selector). The Nix dev shell currently pins a stable toolchain, so contributors following these instructions insidenix developmay be unable to run the formatting step. Either include a nightly toolchain/rustfmt in the dev shell or adjust the docs for Nix users.