1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-10 23:00:39 +02:00

feat: introduce shared global variable aggregator with recursive redistribution

This commit is contained in:
oddlama 2024-05-27 01:28:07 +02:00
parent cceae6c63c
commit cbd22db8c0
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
4 changed files with 67 additions and 1 deletions

View file

@ -141,6 +141,25 @@
# Add a shorthand to easily target toplevel derivations
"@" = mapAttrs (_: v: v.config.system.build.toplevel) self.nodes;
globals = let
globalsSystem = nixpkgs.lib.evalModules {
prefix = ["globals"];
modules = [
./modules/globals.nix
({lib, ...}: {
globals = lib.mkMerge (
lib.concatLists (lib.flip lib.mapAttrsToList self.nodes (
name: cfg:
builtins.addErrorContext "while aggregating globals from nixosConfigurations.${name} into flake-level globals:"
cfg.config._globalsDefs
))
);
})
];
};
in
globalsSystem.config.globals;
# For each true NixOS system, we want to expose an installer package that
# can be used to do the initial setup on the node from a live environment.
# We use the minimal sibling configuration to reduce the amount of stuff