1jehuang / 1jehuang/jcode

Feature request: Nix flake / dev shell for building jcode from source

Open
#778 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: no enhancement priority: low triage: needs-decision
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Feature Request: Nix development environment for the repo

origin/master has no flake.nix, flake.lock, or Nix-based dev environment. NixOS users building jcode from source have to set up a pinned Rust toolchain and native dependencies manually, and there's no equivalent of a shell.nix/flake.nix to reproduce the exact toolchain, native libs (OpenSSL, mold, etc.), and build flags used for local development.

What I'd like

A Nix flake that provides a development environment, not a Nix build of jcode itself:

  • Pinned Rust toolchain (matching whatever version the project builds against, ideally nightly if the parallel rustc front-end is used).
  • Native build dependencies: OpenSSL, mold linker, pkg-config, and whatever else cargo build needs on Linux/NixOS.
  • Separate shells for different build targets, since desktop pulls in far more (font shaping, GPU deps) than the TUI alone:
    • a small default shell for TUI-only builds
    • an optional larger shell for desktop builds
    • an optional "full" shell with clippy, rustfmt, rust-src, and other tooling for contributors
  • Cargo itself should keep using its normal ~/.cargo registry cache and the repo's target/ directory. Nix should supply toolchain and system libs only, not wrap cargo build in a sandboxed derivation, so incremental builds stay fast.
  • A helper script (or documented nix develop invocation) that self-dev / scripts/dev_cargo.sh-style workflows can call so selfdev build-style commands work correctly from inside the Nix shell.
  • Docs (e.g. docs/NIXOS.md) explaining the fast-start flow, what's cached vs not, and how to enter the environment via nix develop or a wrapper script.

Why

Building jcode from source on NixOS currently means hand-rolling the toolchain and native deps outside of Nix's usual reproducibility guarantees. A flake-based dev shell would make selfdev builds work out of the box on NixOS with a pinned, reproducible environment, matching what non-NixOS contributors get from rustup/system packages.

Notes

Happy to share a prototype flake and dev-shell wrapper scripts I put together locally if useful as a starting point, rather than a full patch, since jcode doesn't take outside contributions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking how cargo build and selfdev build-style workflows are currently invoked, along with the native dependencies and build targets used for TUI and desktop development. Add the requested flake.nix, flake.lock, development shells, helper invocation, and docs/NIXOS.md; done means NixOS contributors can enter a pinned environment with nix develop and build incrementally using the normal Cargo cache and target directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
nixos, rust
Domain
build-system, developer-experience, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.