Development Setup
Requirements
- Nix with flakes enabled (Lix or the Determinate installer)
- Rust 1.83+
- Git
Dev shell
git clone https://gitlab.com/pixel-racks/flk.git
cd flk
nix develop --impure .#rust
--impure is needed because the rust profile fetches rust-overlay with builtins.getFlake. The shell has the Rust toolchain, clippy, rustfmt and the cargo helpers.
Build
cargo build # debug
cargo build --release # target/release/flk
Tests
cargo test
cargo test test_add_package # one test
cargo test -- --nocapture # show output
Lint and format
cargo fmt --all -- --check
cargo fmt --all
cargo clippy --all-targets -- -D warnings
Running the CLI
cargo run -- init --template rust
cargo run -- add ripgrep
cargo run -- list
cargo run --release -- search git
To use your build as flk:
cargo install --path .
# or
alias flk="cargo run --release --"
Docs
cargo doc --no-deps --open # API docs
cd flk-book
mdbook serve # http://localhost:3000, reloads on change
mdbook build # output in flk-book/book/
nix build .#docs # both, output in result/
Project layout
flk/
├── src/
│ ├── main.rs # CLI entrypoint
│ ├── lib.rs # library exports
│ ├── commands/ # one module per subcommand
│ ├── flake/ # generation and parsing
│ │ ├── generator.rs # templates
│ │ ├── parsers/ # Nix section parsers
│ │ └── interfaces/ # data types
│ ├── nix/ # nix subprocess wrappers
│ └── utils/ # backups, spinner, output helpers
├── templates/ # Nix templates, embedded at compile time
├── tests/ # integration tests
├── flk-book/ # this book
└── flake.nix
Before a merge request
cargo fmt --all -- --check
cargo clippy --all-targets -- -D warnings
cargo test
cargo doc --no-deps
For a crash, run with RUST_BACKTRACE=1.