From 4bfcd09682e5f23e6a3bd0d601afd77e02d4933d Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Fri, 2 Apr 2021 12:13:08 +0000 Subject: refactor(ops/nixos): add "depot" argument to NixOS modules For the moment I've opted to not import all of the other things we'd usually provide to things imports via readTree, because I think it's a bit dangerous to accidentally overwrite things like NixOS' notion of "lib" with our own version. So for the moment, baseModule provides only "depot". Change-Id: I3db9132a3d9227055d4c1b00f02effcb84edcc53 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2760 Tested-by: BuildkiteCI Reviewed-by: tazjin --- ops/nixos/default.nix | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'ops') diff --git a/ops/nixos/default.nix b/ops/nixos/default.nix index 312d762f246b..1d1e8da192b8 100644 --- a/ops/nixos/default.nix +++ b/ops/nixos/default.nix @@ -19,15 +19,23 @@ rec { allSystems = import ./all-systems.nix args; - nixosFor = configuration: depot.third_party.nixos { - configuration = { - inherit depot; + # This provides our standard set of arguments to all NixOS modules. + baseModule = { ... }: { + _module.args = { + inherit (args) depot; + }; + }; + + nixosFor = configuration: (depot.third_party.nixos { + configuration = { ... }: { imports = [ + baseModule + "${depot.depotPath}/ops/nixos/depot.nix" # TODO(lukegb): remove this once config.depot is no longer referenced. configuration - "${depot.depotPath}/ops/nixos/depot.nix" ]; + config.depot = depot; }; - }; + }); findSystem = hostname: (findFirst -- cgit 1.4.1