ops/machines.nix: inject workspace
This makes the hscloud readTree object available as following in NixOS
modules:
{ config, pkgs, workspace, ... }: {
environment.systemPackages = [
workspace.hswaw.laserproxy
];
}
Change-Id: I9c8146f5156ffe5d06cb8408a2ce632657990d59
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1164
Reviewed-by: q3k <q3k@hackerspace.pl>
diff --git a/ops/machines.nix b/ops/machines.nix
index 9a54c56..d0e6ae3 100644
--- a/ops/machines.nix
+++ b/ops/machines.nix
@@ -69,9 +69,14 @@
];
})];
- # mkMachine builds NixOS modules into a NixOS derivation, and injects
- # passthru.hscloud.provision which deploys that configuration over SSH to a
- # production machine.
+ # mkMachine builds NixOS modules into a NixOS derivation.
+ # It:
+ # 1) injects passthru.hscloud.provision which deploys that configuration
+ # over SSH to a production machine.
+ # 2) injects 'workspace' as a nixos module argument which points to the root
+ # of the hscloud readTree object. It will contain whatever nixpkgs
+ # checkout this file has been invoked with, ie. will not be 'mixed in'
+ # with the pkgs argument.
mkMachine = pkgs: paths: pkgs.nixos ({ config, pkgs, ... }: {
imports = paths;
@@ -123,6 +128,9 @@
'';
in {
passthru.hscloud.provision = pkgs.writeScript "provision-${fqdn}" runProvision;
+
+ # TODO(q3k): this should be named hscloud, but that seems to not work. Debug and rename.
+ _module.args.workspace = hscloud;
};
});
in {