From 336dc00a94e39337c64decd6d0f4f6e4a4d43187 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 11 Mar 2025 16:31:03 -0400 Subject: initial commit --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..d1b8f49 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# cores + +> [!WARNING] +> I made this on a whim in an afternoon. It's not production ready and may never be. Here be dragons! 🐲 + +Your Nix code, in ~~modules~~ cores! + +## What does it do? + +`cores` brings the module system from NixOS right into your stable Nix code. This comes with a few big advantages, like: + +- No more manual importing of files +- Improved re-usability of code +- Self documenting interfaces +- Less boilerplate +- A lot of composability! + +## Usage + +`cores` is best used with tools like [`npins`](https://github.com/andir/npins) and [`niv`](https://github.com/nmattia/niv). In this example, we'll use the former: + +```console +$ npins init +$ npins add github --branch main getchoo cores +``` + +Then create a `default.nix`: + +```nix +let + sources = import ./npins; +in + +import sources.cores { inherit sources; } { + outputs = { + hello = "this is cores!"; + }; +} +``` + +## Why? + +As someone who primarily uses Flakes, one of my favorite parts of them for a while has been [flake-parts](https://github.com/hercules-ci/flake-parts). There isn't much of an equivalent in stable Nix for it's functions though, so after a couple [social media](https://hachyderm.io/@jakehamilton/114126394605099447) [posts](https://wetdry.world/@getchoo/114129209075883077) and taking inspiration from [previous work I've done](https://github.com/getchoo/borealis/blob/90c094cb3dfd4a68bd04202695373500394ee5f4/secrets/secrets.nix), I came up with this -- cgit v1.2.3