From 74cee01680bb6c4baa42cd1452590796e8482eef Mon Sep 17 00:00:00 2001 From: kat witch Date: Sat, 3 Apr 2021 21:51:07 +0100 Subject: [PATCH] project-wide: Accessing tf config from NixOS now possible --- default.nix | 2 +- hosts/samhain/nixos/default.nix | 2 +- lib/hosts.nix | 4 ++-- modules/nixos/tf-glue/default.nix | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index d93e6fb7..d577044c 100644 --- a/default.nix +++ b/default.nix @@ -9,7 +9,7 @@ rec { hosts = import ./lib/hosts.nix { inherit pkgs sources witch profiles; - inherit (deploy) tf; + inherit (deploy) target; }; inherit (pkgs) lib; diff --git a/hosts/samhain/nixos/default.nix b/hosts/samhain/nixos/default.nix index e19bbbf4..d1cb5deb 100644 --- a/hosts/samhain/nixos/default.nix +++ b/hosts/samhain/nixos/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, profiles, sources, witch, ... }: +{ tf, config, pkgs, lib, profiles, sources, witch, ... }: { imports = [ diff --git a/lib/hosts.nix b/lib/hosts.nix index c6a299d9..2799c9d8 100644 --- a/lib/hosts.nix +++ b/lib/hosts.nix @@ -1,4 +1,4 @@ -{ pkgs, tf, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { } +{ pkgs, target, hostsDir ? ../hosts, profiles, pkgsPath ? ../pkgs, sources ? { } , witch ? { } }: with pkgs.lib; @@ -27,7 +27,7 @@ rec { else { }) ]; - specialArgs = { inherit sources tf profiles witch hostName; }; + specialArgs = { inherit sources target profiles witch hostName; }; })) hostNames); targets = foldAttrs (host: hosts: [ host ] ++ hosts) [ ] (mapAttrsToList diff --git a/modules/nixos/tf-glue/default.nix b/modules/nixos/tf-glue/default.nix index 6b8861de..3e4dc1b7 100644 --- a/modules/nixos/tf-glue/default.nix +++ b/modules/nixos/tf-glue/default.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ tf, target, config, lib, ... }: with lib; let cfg = config.deploy.tf; @@ -26,5 +26,6 @@ in { attrs = [ "out" "attrs" ]; out.set = removeAttrs cfg cfg.attrs; }; + _module.args.tf = target.${config.deploy.target}; }; }