1
0
Fork 0

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>
master
q3k 2021-10-16 19:14:05 +00:00 committed by q3k
parent ae2886ba10
commit a16af2db91
1 changed files with 11 additions and 3 deletions

View File

@ -69,9 +69,14 @@ let
];
})];
# 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 @@ let
'';
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 {