project-wide: Accessing tf config from NixOS now possible

This commit is contained in:
kat witch 2021-04-03 21:51:07 +01:00
parent 1ce1328695
commit 74cee01680
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
4 changed files with 6 additions and 5 deletions

View file

@ -9,7 +9,7 @@ rec {
hosts = import ./lib/hosts.nix { hosts = import ./lib/hosts.nix {
inherit pkgs sources witch profiles; inherit pkgs sources witch profiles;
inherit (deploy) tf; inherit (deploy) target;
}; };
inherit (pkgs) lib; inherit (pkgs) lib;

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, profiles, sources, witch, ... }: { tf, config, pkgs, lib, profiles, sources, witch, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
{ pkgs, tf, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { } { pkgs, target, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { }
, witch ? { } }: , witch ? { } }:
with pkgs.lib; with pkgs.lib;
@ -27,7 +27,7 @@ rec {
else else
{ }) { })
]; ];
specialArgs = { inherit sources tf profiles witch hostName; }; specialArgs = { inherit sources target profiles witch hostName; };
})) hostNames); })) hostNames);
targets = foldAttrs (host: hosts: [ host ] ++ hosts) [ ] (mapAttrsToList targets = foldAttrs (host: hosts: [ host ] ++ hosts) [ ] (mapAttrsToList

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { tf, target, config, lib, ... }:
with lib; with lib;
let let
cfg = config.deploy.tf; cfg = config.deploy.tf;
@ -26,5 +26,6 @@ in {
attrs = [ "out" "attrs" ]; attrs = [ "out" "attrs" ];
out.set = removeAttrs cfg cfg.attrs; out.set = removeAttrs cfg cfg.attrs;
}; };
_module.args.tf = target.${config.deploy.target};
}; };
} }