{"id":13798855,"url":"https://github.com/nix-community/namaka","last_synced_at":"2025-10-27T20:30:25.575Z","repository":{"id":158328279,"uuid":"625406125","full_name":"nix-community/namaka","owner":"nix-community","description":"Snapshot testing for Nix based on haumea [maintainer=@figsoda]","archived":false,"fork":false,"pushed_at":"2025-02-12T16:53:55.000Z","size":407,"stargazers_count":131,"open_issues_count":10,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-21T00:35:52.878Z","etag":null,"topics":["flake","flakes","golden","nix","snapshot-testing","test","testing"],"latest_commit_sha":null,"homepage":"https://discourse.nixos.org/t/27125","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nix-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"nix-community"}},"created_at":"2023-04-09T02:24:14.000Z","updated_at":"2025-10-19T21:45:05.000Z","dependencies_parsed_at":"2023-11-28T19:44:48.066Z","dependency_job_id":"2750b687-a131-481f-baf5-e611dd7d3af5","html_url":"https://github.com/nix-community/namaka","commit_stats":{"total_commits":188,"total_committers":2,"mean_commits":94.0,"dds":"0.22872340425531912","last_synced_commit":"7d9535cac71b773dc0bdac7d6369b6836d1be7aa"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nix-community/namaka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnamaka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnamaka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnamaka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnamaka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nix-community","download_url":"https://codeload.github.com/nix-community/namaka/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nix-community%2Fnamaka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281336436,"owners_count":26483826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flake","flakes","golden","nix","snapshot-testing","test","testing"],"created_at":"2024-08-04T00:00:55.356Z","updated_at":"2025-10-27T20:30:25.211Z","avatar_url":"https://github.com/nix-community.png","language":"Rust","funding_links":["https://opencollective.com/nix-community"],"categories":["Development"],"sub_categories":["Discovery"],"readme":"# namaka\n\n[![release](https://img.shields.io/github/v/release/nix-community/namaka?logo=github\u0026style=flat-square)](https://github.com/nix-community/namaka/releases)\n[![version](https://img.shields.io/crates/v/namaka?logo=rust\u0026style=flat-square)](https://crates.io/crates/namaka)\n[![deps](https://deps.rs/repo/github/nix-community/namaka/status.svg?style=flat-square\u0026compact=true)](https://deps.rs/repo/github/nix-community/namaka)\n[![license](https://img.shields.io/badge/license-MPL--2.0-blue?style=flat-square)](https://www.mozilla.org/en-US/MPL/2.0)\n[![ci](https://img.shields.io/github/actions/workflow/status/nix-community/namaka/ci.yml?label=ci\u0026logo=github-actions\u0026style=flat-square)](https://github.com/nix-community/namaka/actions/workflows/ci.yml)\n\n[Snapshot testing](#snapshot-testing) for Nix based on [haumea]\n\n![](https://user-images.githubusercontent.com/40620903/230751675-b1eb1076-bcd8-4c21-a420-f4c914716bb9.gif)\n\n## Quick Start\n\n```bash\nnix flake init -t github:nix-community/namaka\nnix develop # add namaka to the environment\nnamaka check # run checks\nnamaka review # review pending snapshots\n```\n\n## Versioning\n\nNamaka follows [semantic versioning](https://semver.org).\nBreaking changes can happen in main branch at any time,\nso it is recommended to pin namaka to a specific tag.\nA list of available versions can be found on the\n[releases](https://github.com/nix-community/namaka/releases) page.\n\n## Usage\n\n```\nUsage: namaka [OPTIONS] [DIR] \u003cCOMMAND\u003e\n\nCommands:\n  check   Wrapper around `nix flake check` to prepare snapshots for failed tests [aliases: c]\n  clean   Remove unused and pending snapshots [aliases: cl]\n  review  Review pending snapshots and selectively accept or reject them [aliases: r]\n  help    Print this message or the help of the given subcommand(s)\n\nArguments:\n  [DIR]  Change to this working directory\n\nOptions:\n  -c, --cmd \u003cCMD\u003e...  Command to run instead of `nix flake check`\n  -h, --help          Print help (see more with '--help')\n  -V, --version       Print version\n```\n\n### [`load`](nix/load.nix)\n\nType: `{ ... } -\u003e { }`\n\nWrapper around [`haumea.load`] to load snapshot tests from a directory.\n\nIt throws an error if any of the tests fail, otherwise it always returns `{ }`.\n`load { src = ./tests; }` will load tests from the `tests` directory,\nwhich should be structured like this:\n\n```\ntests\n├─ foo/\n│  ├─ expr.nix\n└─ bar/\n   ├─ expr.nix\n   └─ format.nix (optional)\n```\n\n`expr.nix` contains the Nix expression you want to test.\n\n`format.nix` contains a Nix string specifying how the expression should be serialized.\nHere are the possible values:\n\n- `\"json\"` serializes the expression using `builtins.toJSON` (default)\n- `\"pretty\"` serializes the expression using `lib.generators.toPretty { }`\n- `\"string\"` serializes the string as is\n\nSee the [tests](tests) directory or one of the templates for an example.\nIgnore the `_snapshots` directory, as it is automatically generated by namaka.\n\nThe rest of the available options are documented in [`haumea.load`],\nas they will function exactly the same.\n\n## Configuration\n\n`namaka` will try to read `namaka.toml` in the working directory.\nHere is an example configuration file (all fields are optional):\n\n```toml\n# namaka.toml\n\n# change the working directory\n# this stacks with the command line option\n#`namaka check bar` will read `bar/namaka.toml` and change the working directory to `bar/foo`\ndir = \"foo\"\n\n[check]\n# the command to run with `namaka check`\n# defaults to `nix flake check --extra-experimental-features \"flakes nix-command\"`\ncmd = [\"nix\", \"eval\", \"./dev#checks\"]\n\n[eval]\n# the command to run with `namaka review` and `namaka clean`\n# defaults to `nix eval ./checks --extra-experimental-features \"flakes nix-command\"`\ncmd = [\"nix\", \"flake\", \"check\"]\n```\n\n## Snapshot Testing\n\nSnapshot testing is a strategy that allows you to write tests without manually writing reference values.\nInstead of `assert foo == bar;`, you only need to have `foo`,\nand namaka will store `bar` in a snapshot file and ask you to update it with `namaka review`.\n\nTo start, you can follow the [Quick Start](#quick-start) guide,\nor refer to [load](#load) for more detailed documentation.\n\n## Related Tools\n\n- Namaka is largely inspired by [insta](https://github.com/mitsuhiko/insta),\n  a snapshot testing library for Rust.\n- Namaka is based on [haumea], which also has some testing functionalities.\n\n[haumea]: https://github.com/nix-community/haumea\n[`haumea.load`]: https://github.com/nix-community/haumea#load\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fnamaka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnix-community%2Fnamaka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnix-community%2Fnamaka/lists"}