diff options
author | Martin Fischer <martin@push-f.com> | 2025-08-24 08:15:37 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-08-27 19:31:43 +0200 |
commit | 63e381fc495cc3ef7a4afd1265b2e9722d56d317 (patch) | |
tree | 8114e61dbf7107d8fd414c5c5456c9fcb98b37a6 /nixos/helpers.nix | |
parent | 565fffe39d8bc511fa0feb98a245f20295f806fd (diff) |
refactor: generate Alloy config from nix attribute set
Diffstat (limited to 'nixos/helpers.nix')
-rw-r--r-- | nixos/helpers.nix | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/helpers.nix b/nixos/helpers.nix index cadf230..f8f1384 100644 --- a/nixos/helpers.nix +++ b/nixos/helpers.nix @@ -60,6 +60,17 @@ '}'; ''; + writeAlloyConfig = cfg: + let + alloy-nix-config = "${pkgs.callPackage <top/shared/alloy-nix-config> {}}/bin/alloy-nix-config"; + in + pkgs.runCommand "generated-config" {} '' + ${alloy-nix-config} ${pkgs.writeText "input.json" (builtins.toJSON cfg)} $out + # FUTURE: run alloy validate + ''; + + alloyConfigRef = s: { "$ref" = s; }; + joinWgNamespace = ns: cfg: lib.attrsets.recursiveUpdate cfg { bindsTo = ["netns@${ns}.service"]; |