dotfiles/nix/hosts/thought/digitalocean.nix (view raw)
| 1 | { lib, modulesPath, ... }: |
| 2 | { |
| 3 | imports = [ |
| 4 | "${modulesPath}/virtualisation/digital-ocean-config.nix" |
| 5 | ]; |
| 6 | |
| 7 | # do not use DHCP, as DigitalOcean provisions IPs using cloud-init |
| 8 | networking.useDHCP = lib.mkForce false; |
| 9 | |
| 10 | # Disables all modules that do not work with NixOS |
| 11 | services.cloud-init = { |
| 12 | enable = true; |
| 13 | network.enable = true; |
| 14 | settings = { |
| 15 | datasource_list = [ |
| 16 | "ConfigDrive" |
| 17 | "Digitalocean" |
| 18 | ]; |
| 19 | datasource.ConfigDrive = { }; |
| 20 | datasource.Digitalocean = { }; |
| 21 | # Based on https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl |
| 22 | cloud_init_modules = [ |
| 23 | "seed_random" |
| 24 | "bootcmd" |
| 25 | "write_files" |
| 26 | "growpart" |
| 27 | "resizefs" |
| 28 | "set_hostname" |
| 29 | "update_hostname" |
| 30 | # Not support on NixOS |
| 31 | #"update_etc_hosts" |
| 32 | # throws error |
| 33 | #"users-groups" |
| 34 | # tries to edit /etc/ssh/sshd_config |
| 35 | #"ssh" |
| 36 | "set_password" |
| 37 | ]; |
| 38 | cloud_config_modules = [ |
| 39 | "ssh-import-id" |
| 40 | "keyboard" |
| 41 | # doesn't work with nixos |
| 42 | #"locale" |
| 43 | "runcmd" |
| 44 | "disable_ec2_metadata" |
| 45 | ]; |
| 46 | ## The modules that run in the 'final' stage |
| 47 | cloud_final_modules = [ |
| 48 | "write_files_deferred" |
| 49 | "puppet" |
| 50 | "chef" |
| 51 | "ansible" |
| 52 | "mcollective" |
| 53 | "salt_minion" |
| 54 | "reset_rmc" |
| 55 | # install dotty agent fails |
| 56 | #"scripts_vendor" |
| 57 | "scripts_per_once" |
| 58 | "scripts_per_boot" |
| 59 | # /var/lib/cloud/scripts/per-instance/machine_id.sh has broken shebang |
| 60 | #"scripts_per_instance" |
| 61 | "scripts_user" |
| 62 | "ssh_authkey_fingerprints" |
| 63 | "keys_to_console" |
| 64 | "install_hotplug" |
| 65 | "phone_home" |
| 66 | "final_message" |
| 67 | ]; |
| 68 | }; |
| 69 | }; |
| 70 | } |