-
Notifications
You must be signed in to change notification settings - Fork 15
Add Nix flake #23
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: master
Are you sure you want to change the base?
Add Nix flake #23
Changes from all commits
b3ed697
0308363
cfebe51
d64a8ba
695c512
af32bf3
3bc0366
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use flake |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,13 @@ | |
| # build products | ||
| build/ | ||
|
|
||
| # Nix | ||
| result | ||
| result-*/ | ||
|
|
||
| # direnv | ||
| .direnv/ | ||
|
|
||
| # CMake | ||
| CMakeFiles | ||
| CMakeCache.txt | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Repository Guidelines | ||
|
|
||
| ## Project Structure & Module Organization | ||
| libansilove is a C library that converts ANSI and related art files to PNG. Core headers live in `include/`, while the implementation sits in `src/` with `loaders/` containing format-specific decoders and `fonts/` bundling built-in typefaces. Cross-platform fallbacks are under `compat/`. The `example/` directory shows how to invoke the API end-to-end, and `man/` provides installed manual pages. Dedicated fuzzing harnesses reside in `fuzz/`; build them only when running sanitizer-heavy tests. | ||
|
|
||
| ## Build, Test, and Development Commands | ||
| - `cmake -S . -B build -DCMAKE_BUILD_TYPE=Release`: configure the project after installing GD headers and libs. | ||
| - `cmake --build build`: compile shared and static variants of the library. | ||
| - `cmake --build build --target install`: install artifacts into the default prefix. | ||
| - `cmake -S fuzz -B fuzz-build`: set up clang-based libFuzzer targets. | ||
| - `cmake --build fuzz-build`: produce fuzz binaries such as `ansi` and `tundra`. | ||
| - `nix develop`: enter the flake-backed dev shell with clang, pkg-config, GD, and platform-appropriate debugger preinstalled. | ||
| - `nix build`: build the default flake package (shared/static library) without touching your host toolchain. | ||
| - `nix flake check`: validate the flake packages and dev shell evaluate cleanly across supported systems. | ||
|
|
||
| ## Coding Style & Naming Conventions | ||
| - Target C99 with the default warning set (`-Wall -Wextra -pedantic`). | ||
| - Indent with tabs for blocks; align wrapped parameters using spaces as needed, and avoid trailing whitespace. | ||
| - Public APIs stay in `include/ansilove.h` and use the `ansilove_*` prefix; internal helpers remain lowercase with underscores and `static` linkage. | ||
| - Mirror existing filenames (`loadfile.c`, `savefile.c`) when adding new modules or loaders. | ||
|
|
||
| ## Testing Guidelines | ||
| - There is no unit-test harness; validate behavior with the example app and fuzzers. | ||
| - After building, run `build/example/ansilove_example <input.ans>` to confirm PNG output. | ||
| - For fuzzing, execute `./fuzz-build/ansi -runs=10000 corpus/` (seed the corpus with representative art files). Investigate sanitizer reports immediately and add reproducer samples. | ||
| - Ensure new formats or options ship with updated example inputs or fuzz seeds that exercise the paths. | ||
| - If you touch the flake, rerun `nix build` and `nix flake check` and commit the updated `flake.lock` (keep changes reproducible). | ||
|
|
||
| ## Commit & Pull Request Guidelines | ||
| - Commit messages follow sentence case with concise statements ending in a period (for example, `Update ChangeLog.`). | ||
| - Keep functional changes and formatting adjustments in separate commits and ensure files build before pushing. | ||
| - Pull requests should summarize the change, call out impacted loaders, and link tracking issues. Note which build or fuzz commands were run, and attach PNG outputs or screenshots when visual diffs help reviewers. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md | ||
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,66 @@ | ||||||||||||||
| { | ||||||||||||||
| description = "Development environment for libansilove"; | ||||||||||||||
|
|
||||||||||||||
| inputs = { | ||||||||||||||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; | ||||||||||||||
| flake-utils.url = "github:numtide/flake-utils"; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| outputs = { | ||||||||||||||
| self, | ||||||||||||||
| nixpkgs, | ||||||||||||||
| flake-utils, | ||||||||||||||
| }: | ||||||||||||||
| flake-utils.lib.eachDefaultSystem ( | ||||||||||||||
| system: let | ||||||||||||||
| pkgs = import nixpkgs {inherit system;}; | ||||||||||||||
| version = "1.4.2"; | ||||||||||||||
|
||||||||||||||
| version = "1.4.2"; | |
| # Extract version from CMakeLists.txt | |
| version = let | |
| cmakeContents = builtins.readFile ./CMakeLists.txt; | |
| matches = builtins.match ''set *\( *PROJECT_VERSION +([0-9]+\.[0-9]+\.[0-9]+) *\)'' cmakeContents; | |
| in if matches != null && matches != [] then builtins.elemAt matches 0 else throw "Could not extract version from CMakeLists.txt"; |
Uh oh!
There was an error while loading. Please reload this page.