5.4 KiB
5.4 KiB
sessionId
| sessionId |
|---|
| session-260819-004513-s2vk |
Requirements
Overview & Goals
Tailor flake.nix, development environments, and packaging configurations specifically to the coldIron project (a Rust + iced desktop GUI application). Prune obsolete template boilerplate and microcontroller/embedded targets, structure the package derivation to conform to standard nixpkgs packaging practices (with runtime library wrapping for winit/wayland/x11/wgpu), and retain Flatpak build capabilities with a project-tailored manifest.
Scope
- In Scope:
- Pruning generic template outputs (
templates.default,devHelperbinary, embeddedrustup target addhooks) fromflake.nix. - Creating a clean, idiomatic
nixpkgs-compatible package derivation (buildRustPackagewithmakeBinaryWrapperandLD_LIBRARY_PATHwrapping) socoldIroncan be built withnix buildand easily contributed/published tonixpkgs. - Retaining Flatpak build capabilities by maintaining
flatpakandflatpak-builderin the development environment and updatingflatpak/app.flatpak.jsonto targetcoldIron. - Aligning
project.toml,shell.nix,default.nix, andREADME.mdwith thecoldIronproject metadata.
- Pruning generic template outputs (
- Out of Scope:
- Modifying the application's UI logic or Rust code in
src/main.rs.
- Modifying the application's UI logic or Rust code in
Technical Design
Current Implementation
flake.nixcontains leftover template outputs (templates.default), a helper script (devHelper/dev-helper), and shell hooks attempting to install embedded targets (ARM Cortex-M, RISC-V, ESP32).packages.defaultbuilds a dummysample-rust-appwithout wrapping required Linux GUI runtime libraries (wayland,libxkbcommon,libGL,vulkan-loader,xorglibraries).flatpak/app.flatpak.jsonreferences placeholder IDs (org.example.rustdevshell) and binary namerustdevshell-appinstead ofColdIron.project.tomlandREADME.mddescribe a generic reusable template rather than thecoldIronapplication.
Key Decisions
- Nixpkgs Standard Package (
package.nix/packages.default):- Define the package derivation using
pkgs.rustPlatform.buildRustPackagewithnativeBuildInputs = [ pkgs.pkg-config pkgs.makeBinaryWrapper ]andbuildInputs = runtimeLibs. - Wrap the installed binary (
$out/bin/ColdIron) withLD_LIBRARY_PATHprefixingruntimeLibsso thatnix runornix buildproduces a standalone binary that starts up without Wayland/X11 dynamic library errors. - Structure
package.nix(ordefault.nix) as a standardcallPackagefunction suitable for inclusion innixpkgs(e.g.pkgs/by-name/co/coldiron/package.nix).
- Define the package derivation using
- Streamlined devShell:
- Retain essential tools for Rust desktop GUI development:
rustToolchain(fenix),rust-analyzer,pkg-config,cargo-watch,cargo-edit,flatpak,flatpak-builder,alejandra, andruntimeLibs. - Remove embedded microcontroller hooks (
rustup target add ...) and embedded tools from the shell hook and tool summary.
- Retain essential tools for Rust desktop GUI development:
- Flatpak Retention & Modernization:
- Retain
Makefiletargetflatpak-buildandflatpak-builderin the devShell. - Update
flatpak/app.flatpak.jsonto specifyapp-id: "io.github.gooba42.coldiron", commandColdIron, and clean module definitions.
- Retain
File Structure Changes
flake.nix: Prune template/embedded artifacts; configurepackages.default,apps.default, and tailoreddevShells.default.package.nix(ordefault.nix): Standardnixpkgspackaging expression usingcallPackageconventions.flatpak/app.flatpak.json: Tailor manifest metadata and build command forcoldIron.project.toml&README.md: Update metadata and documentation to reflect thecoldIronproject.
Delivery Steps
✓ Step 1: Create standard nixpkgs-compatible package derivation in package.nix and default.nix
- Create
package.nixas acallPackage-compatible function usingrustPlatform.buildRustPackage. - Add
pkg-configandmakeBinaryWrappertonativeBuildInputs, and includeruntimeLibsinbuildInputs. - Add
postInstallhook usingwrapProgramto prefixLD_LIBRARY_PATHwithruntimeLibsso the GUI application can dynamically load Wayland/X11 libraries. - Update
default.nixto callpackage.nix.
✓ Step 2: Update flake.nix packaging, applications, devShell, and prune template/embedded artifacts
- Remove
templatesoutput anddevHelper/dev-helper. - Configure
packages.default(andpackages.coldiron) to usepackage.nix. - Configure
apps.defaultto run$out/bin/ColdIron. - Streamline
devShells.defaultby removing embedded microcontroller targets (rustup target add) and updating the shell banner forcoldIron. - Ensure Flatpak tools (
flatpak,flatpak-builder) and formatting tools are present.
✓ Step 3: Update Flatpak manifest, project metadata, and documentation
- Update
flatpak/app.flatpak.jsonwith app-idio.github.gooba42.coldiron, commandColdIron, graphics/wayland/x11 permissions, and build commands. - Update
project.tomlwithcoldironproject name and description. - Update
README.mdto describe thecoldIronIced application, dev workflow, Nix build/run, and Flatpak build.
✓ Step 4: Verify package build, dev shell, tests, and formatting
- Verify
nix buildbuilds the wrappedColdIronpackage. - Run
cargo checkandcargo testto verify codebase health. - Run
alejandra .to ensure Nix files are formatted cleanly.