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:
parent
cceae6c63c
commit
cbd22db8c0
4 changed files with 67 additions and 1 deletions
19
flake.nix
19
flake.nix
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue