about summary refs log tree commit diff
path: root/corp
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2023-09-22T16·37+0300
committertazjin <tazjin@tvl.su>2023-09-22T17·52+0000
commit9eede1c4df124c98bedb9b82827e25f011aadb76 (patch)
tree3d64697497a6605fc88cea17f7ff12d979a0432f /corp
parent732dc68727caa09c2e430fa6822b40ed9b6153f7 (diff)
chore(ops): move yandex-cloud image module out of corp r/6634
Change-Id: Idc8cc3a640fc895cd3882e93a193212adb743abb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9425
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'corp')
-rw-r--r--corp/ops/default.nix2
-rw-r--r--corp/ops/modules/yandex-cloud.nix79
2 files changed, 1 insertions, 80 deletions
diff --git a/corp/ops/default.nix b/corp/ops/default.nix
index 59d63bd510..213cb8dcc9 100644
--- a/corp/ops/default.nix
+++ b/corp/ops/default.nix
@@ -39,7 +39,7 @@ depot.nix.readTree.drvTargets rec {
   yandex-base-image = (depot.third_party.nixos {
     configuration = { ... }: {
       imports = [
-        (depot.path.origSrc + ("/corp/ops/modules/yandex-cloud.nix"))
+        (depot.path.origSrc + ("/ops/modules/yandex-cloud.nix"))
       ];
     };
   }).config.system.build.yandexCloudImage;
diff --git a/corp/ops/modules/yandex-cloud.nix b/corp/ops/modules/yandex-cloud.nix
deleted file mode 100644
index cca81bc0ca..0000000000
--- a/corp/ops/modules/yandex-cloud.nix
+++ /dev/null
@@ -1,79 +0,0 @@
-# Profile for virtual machines on Yandex Cloud, intended for disk
-# images.
-#
-# https://cloud.yandex.com/en/docs/compute/operations/image-create/custom-image
-#
-# TODO(tazjin): Upstream to nixpkgs once it works well.
-{ config, lib, pkgs, modulesPath, ... }:
-
-let
-  cfg = config.virtualisation.yandexCloud;
-
-  # Kernel modules required for interacting with the hypervisor. These
-  # must be available during stage 1 boot and during normal operation,
-  # as disks and network do not work without them.
-  modules = [
-    "virtio-net"
-    "virtio-blk"
-    "virtio-pci"
-    "virtiofs"
-  ];
-in
-{
-  imports = [
-    "${modulesPath}/profiles/headless.nix"
-  ];
-
-  options = {
-    virtualisation.yandexCloud.rootPartitionUuid = with lib; mkOption {
-      type = types.str;
-      default = "C55A5EE2-E5FA-485C-B3AE-CC928429AB6B";
-
-      description = ''
-        UUID to use for the root partition of the disk image. Yandex
-        Cloud requires that root partitions are mounted by UUID.
-
-        Most users do not need to set this to a non-default value.
-      '';
-    };
-  };
-
-  config = {
-    fileSystems."/" = {
-      device = "/dev/disk/by-uuid/${lib.toLower cfg.rootPartitionUuid}";
-      fsType = "ext4";
-      autoResize = true;
-    };
-
-    boot = {
-      loader.grub.device = "/dev/vda";
-
-      initrd.kernelModules = modules;
-      kernelModules = modules;
-      kernelParams = [
-        # Enable support for the serial console
-        "console=ttyS0"
-      ];
-
-      growPartition = true;
-    };
-
-    environment.etc.securetty = {
-      text = "ttyS0";
-      mode = "0644";
-    };
-
-    systemd.services."serial-getty@ttyS0".enable = true;
-
-    services.openssh.enable = true;
-    services.cloud-init.enable = true;
-
-    system.build.yandexCloudImage = import (pkgs.path + "/nixos/lib/make-disk-image.nix") {
-      inherit lib config pkgs;
-      additionalSpace = "128M";
-      format = "qcow2";
-      partitionTableType = "legacy+gpt";
-      rootGPUID = cfg.rootPartitionUuid;
-    };
-  };
-}