mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
refactor: static networking
This commit is contained in:
parent
1a4b5ee8b2
commit
91d4895c6f
13 changed files with 155 additions and 16 deletions
32
modules/meta/access.nix
Normal file
32
modules/meta/access.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
access,
|
||||
...
|
||||
}: let
|
||||
nixosModule = {
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
config = {
|
||||
_module.args.access = access // {
|
||||
systemFor = hostName: if hostName == config.networking.hostName
|
||||
then config
|
||||
else access.systemFor hostName;
|
||||
systemForOrNull = hostName: if hostName == config.networking.hostName
|
||||
then config
|
||||
else access.systemForOrNull hostName;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
config = {
|
||||
network.nixos.extraModules = [
|
||||
nixosModule
|
||||
];
|
||||
|
||||
_module.args.access = {
|
||||
systemFor = hostName: config.network.nodes.${hostName};
|
||||
systemForOrNull = hostName: config.network.nodes.${hostName} or null;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue