Fediversity/default.nix
Kiara Grouwstra 2e97b4b647
data model: add run-time configuration
have run-time environments use their corresponding run-time configurations

grant run-time environments their own modules with their own description

data model: runtime environment

allows declaring options so instantiations may configure required
settings

data model: deployment

data model: migration

better reflect naming from diagram configuration data flow

WIP: implement data model as in diagram

this doesn't update the tests yet because we don't have all the data
types in place anyway yet, and I still need to come up with testable examples.

WIP: add missing types

WIP: start writing an evaluation test

turns out we also need a collection of configurations, obviously
next: figure out where to wire everything up to obtain a deployment

WIP: implement mappings

WIP: (broken) implement test

WIP: illustrate an entire NixOS configuration as a resource

fix typos, lint, format

test for configuration passes, test for deployment wip

use `mapAttrs` right

`mapAttrs'` takes two args rather than a set, whereas if only the val
changes `mapAttrs (_: v: ...)` should do

rm deployment/resources
2025-07-06 11:09:04 +02:00

77 lines
1.8 KiB
Nix

{
system ? builtins.currentSystem,
sources ? import ./npins,
pkgs ? import sources.nixpkgs { inherit system; },
}:
let
inherit (sources)
nixpkgs
git-hooks
gitignore
;
inherit (import sources.flake-inputs) import-flake;
inputs = (import-flake { src = ./.; }).inputs;
inherit (pkgs) lib;
pre-commit-check =
(import "${git-hooks}/nix" {
inherit nixpkgs system;
gitignore-nix-src = {
lib = import gitignore { inherit lib; };
};
}).run
{
src = ./.;
hooks =
let
## Add a directory here if pre-commit hooks shouldn't apply to it.
optout = [
"npins"
];
excludes = map (dir: "^${dir}/") optout;
addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; });
in
addExcludes {
nixfmt-rfc-style.enable = true;
deadnix.enable = true;
trim-trailing-whitespace.enable = true;
shellcheck.enable = true;
};
};
in
{
# shell for testing TF directly
shell = pkgs.mkShellNoCC {
inherit (pre-commit-check) shellHook;
buildInputs = pre-commit-check.enabledPackages;
packages =
let
test-loop = pkgs.writeShellApplication {
name = "test-loop";
runtimeInputs = [
pkgs.watchexec
pkgs.nix-unit
];
text = ''
watchexec -w ${builtins.toString ./.} -- nix-unit ${builtins.toString ./deployment/data-model-test.nix} "$@"
'';
};
in
[
pkgs.nix-unit
test-loop
];
};
tests = {
inherit pre-commit-check;
};
# re-export inputs so they can be overridden granularly
# (they can't be accessed from the outside any other way)
inherit
inputs
sources
system
pkgs
;
}