about summary refs log tree commit diff
path: root/corp/ops/default.nix
blob: dfa62c80bafcafb9acf275deb6d1c9455e8472ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ 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;
}