tvl-depot/corp/ops/default.nix
Vincent Ambo 6daf91c9cd feat(corp/ops): add NixOS profile for Yandex Cloud machines
Sets up a virtual machine image that is bootable on Yandex Cloud.

There are some slightly wonky behaviours still, like cloud-init
apparently putting all keys into root's authorized_keys no matter what
is specified in the metadata, but it does work now.

Change-Id: I57dcb7fcfa6872a28855dc1347f73a6db3c56828
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8496
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2023-04-24 10:56:40 +00:00

46 lines
1.1 KiB
Nix

{ depot, lib, pkgs, ... }:
depot.nix.readTree.drvTargets rec {
# Provide a Terraform wrapper with Yandex Cloud support.
terraform = pkgs.terraform.withPlugins (p: [
p.yandex
]);
validate = depot.tools.checks.validateTerraform {
inherit terraform;
name = "corp";
src = lib.cleanSource ./.;
};
# Yandex Cloud CLI
yc-cli = pkgs.stdenv.mkDerivation rec {
pname = "yc-cli";
version = "0.104.0";
src = pkgs.fetchurl {
url = "https://storage.yandexcloud.net/yandexcloud-yc/release/${version}/linux/amd64/yc";
sha256 = "sha256:1k1dfqqmpy1kdzgg2d8byhsfpfh3fxrckpbvffwngb712isvqpdb";
};
phases = [ "installPhase" ];
installPhase = "install -D $src $out/bin/yc";
};
deps = depot.tools.depot-deps.overrideDeps {
tf-yandex = {
attr = "corp.ops.terraform";
cmd = "terraform";
};
yc.attr = "corp.ops.yc-cli";
};
# Base image for Yandex VMs.
yandex-base-image = (depot.third_party.nixos {
configuration = { ... }: {
imports = [
(depot.path.origSrc + ("/corp/ops/modules/yandex-cloud.nix"))
];
};
}).config.system.build.yandexCloudImage;
}