From 075067bfa2a59c39e960aba92f798cd626cd073d Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 May 2016 01:03:47 +0200 Subject: machines: Add a new callMachines function This is particularly needed for the Labtops and it allows to call a full attribute set of machines to be incorporated into a single file as one big attribute set. Its functionality is kind of similar to the NixOps network expressions by providing default hostnames (in our case with a priority of 900 to still make it overridable without pain). Signed-off-by: aszlig --- machines/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'machines/default.nix') diff --git a/machines/default.nix b/machines/default.nix index 0f972829..11335a14 100644 --- a/machines/default.nix +++ b/machines/default.nix @@ -2,6 +2,17 @@ let callMachine = import ../lib/call-machine.nix; + callMachines = path: args: let + machines = import path; + in with builtins; listToAttrs (map (name: { + inherit name; + value = callMachine machines.${name} ({ + extraConfig = { lib, ... }: { + imports = lib.singleton (args.extraConfig or {}); + networking.hostName = lib.mkOverride 900 name; + }; + } // removeAttrs args [ "extraConfig" ]); + }) (attrNames machines)); nixpkgs = import (import ../nixpkgs-path.nix) {}; in { aszlig = { -- cgit 1.4.1