diff options
author | Luke Granger-Brown <git@lukegb.com> | 2021-04-02T12·13+0000 |
---|---|---|
committer | lukegb <lukegb@tvl.fyi> | 2021-04-02T18·00+0000 |
commit | 4bfcd09682e5f23e6a3bd0d601afd77e02d4933d (patch) | |
tree | 2b76aea786650187d69df06086775880a06830c1 /ops | |
parent | dc9a1754d54aa9890bc6d3f9de856ba6d11579eb (diff) |
refactor(ops/nixos): add "depot" argument to NixOS modules r/2404
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 <mail@tazj.in>
Diffstat (limited to 'ops')
-rw-r--r-- | ops/nixos/default.nix | 18 |
1 files changed, 13 insertions, 5 deletions
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 |