aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2025-09-08 08:19:43 -0700
committerFranck Cuny <franck@fcuny.net>2025-09-08 08:19:43 -0700
commite72b2b9d08ac8b6575a2f6c3504b94dcf3a84b96 (patch)
tree63fca796db04315a5248bb4ed5a614f181362c7f
parentmove droplet specific settings to its own module (diff)
downloadinfra-e72b2b9d08ac8b6575a2f6c3504b94dcf3a84b96.tar.gz
Revert "move droplet specific settings to its own module"
This reverts commit 3b47113c28c5180d4d5d710e3c1fe74f95aa7226.
-rw-r--r--flake/hosts.nix8
-rw-r--r--machines/nixos/x86_64-linux/do-rproxy/default.nix9
-rw-r--r--machines/nixos/x86_64-linux/do-rproxy/digitalocean.nix55
-rw-r--r--modules/default.nix11
-rw-r--r--modules/hardware/default.nix6
-rw-r--r--modules/hardware/do-droplet.nix70
6 files changed, 67 insertions, 92 deletions
diff --git a/flake/hosts.nix b/flake/hosts.nix
index 42a3ae3..e02ff2d 100644
--- a/flake/hosts.nix
+++ b/flake/hosts.nix
@@ -58,14 +58,18 @@ let
inputs.agenix.nixosModules.age
inputs.disko.nixosModules.disko
inputs.home-manager.nixosModules.home-manager
- "${self}/modules"
+ "${self}/modules/home.nix"
+ "${self}/modules/host-config.nix"
+ "${self}/modules/nas-client.nix"
+ "${self}/modules/backups.nix"
];
darwinDefaultModules = [
nixSettings
inputs.agenix.darwinModules.age
inputs.home-manager.darwinModules.home-manager
- "${self}/modules"
+ "${self}/modules/home.nix"
+ "${self}/modules/host-config.nix"
];
darwinConfigurations = mapAttrs' (
diff --git a/machines/nixos/x86_64-linux/do-rproxy/default.nix b/machines/nixos/x86_64-linux/do-rproxy/default.nix
index 5152b57..e187bd2 100644
--- a/machines/nixos/x86_64-linux/do-rproxy/default.nix
+++ b/machines/nixos/x86_64-linux/do-rproxy/default.nix
@@ -1,8 +1,9 @@
{
adminUser,
config,
- self,
+ lib,
modulesPath,
+ self,
...
}:
{
@@ -11,6 +12,7 @@
(modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/virtualisation/digital-ocean-config.nix")
./disks.nix
+ ./digitalocean.nix
./secrets.nix
{
home-manager.users.${adminUser.name} = {
@@ -34,6 +36,9 @@
./profiles/nginx.nix
];
+ # do not use DHCP, as DigitalOcean provisions IPs using cloud-init
+ networking.useDHCP = lib.mkForce false;
+
networking.hostName = "do-rproxy";
boot.loader.grub = {
@@ -60,7 +65,5 @@
networking.firewall.trustedInterfaces = [ "wg0" ];
networking.firewall.allowedUDPPorts = [ 51871 ];
- my.hardware.do-droplet.enable = true;
-
system.stateVersion = "25.05"; # Did you read the comment?
}
diff --git a/machines/nixos/x86_64-linux/do-rproxy/digitalocean.nix b/machines/nixos/x86_64-linux/do-rproxy/digitalocean.nix
new file mode 100644
index 0000000..574fe99
--- /dev/null
+++ b/machines/nixos/x86_64-linux/do-rproxy/digitalocean.nix
@@ -0,0 +1,55 @@
+{ ... }:
+{
+ # this one seems to always be broken
+ systemd.services.growpart.enable = false;
+
+ # in order to get networking setup we need to enable it in cloud-init
+ # Disables all modules that do not work with NixOS
+ # Based on https://github.com/nix-community/nixos-anywhere-examples/blob/7f945ff0ae676c0eb77360b892add91328dd1f17/digitalocean.nix
+ services.cloud-init = {
+ enable = true;
+ network.enable = true;
+ settings = {
+ datasource_list = [
+ "ConfigDrive"
+ "Digitalocean"
+ ];
+ datasource.ConfigDrive = { };
+ datasource.Digitalocean = { };
+ # Based on https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl
+ cloud_init_modules = [
+ "seed_random"
+ "bootcmd"
+ "write_files"
+ "growpart"
+ "resizefs"
+ "set_hostname"
+ "update_hostname"
+ "set_password"
+ ];
+ cloud_config_modules = [
+ "ssh-import-id"
+ "keyboard"
+ "runcmd"
+ "disable_ec2_metadata"
+ ];
+ cloud_final_modules = [
+ "write_files_deferred"
+ "puppet"
+ "chef"
+ "ansible"
+ "mcollective"
+ "salt_minion"
+ "reset_rmc"
+ "scripts_per_once"
+ "scripts_per_boot"
+ "scripts_user"
+ "ssh_authkey_fingerprints"
+ "keys_to_console"
+ "install_hotplug"
+ "phone_home"
+ "final_message"
+ ];
+ };
+ };
+}
diff --git a/modules/default.nix b/modules/default.nix
deleted file mode 100644
index 267ecec..0000000
--- a/modules/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ ... }:
-{
- imports = [
- ./home.nix
- ./hardware
- ./backups.nix
- ./fcuny-net.nix
- ./nas-client.nix
- ./host-config.nix
- ];
-}
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
deleted file mode 100644
index f6ea0d9..0000000
--- a/modules/hardware/default.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ ... }:
-{
- imports = [
- ./do-droplet.nix
- ];
-}
diff --git a/modules/hardware/do-droplet.nix b/modules/hardware/do-droplet.nix
deleted file mode 100644
index 50317d6..0000000
--- a/modules/hardware/do-droplet.nix
+++ /dev/null
@@ -1,70 +0,0 @@
-{ lib, config, ... }:
-let
- cfg = config.my.hardware.do-droplet;
- inherit (lib) mkEnableOption mkIf;
-in
-{
- options.my.hardware.do-droplet = {
- enable = mkEnableOption "DigitalOcean Droplet hardware defaults";
- };
-
- config = mkIf cfg.enable {
- boot.loader.grub.device = "/dev/vda";
-
- # do not use DHCP, as DigitalOcean provisions IPs using cloud-init
- networking.useDHCP = lib.mkForce false;
-
- # this one seems to always be broken
- systemd.services.growpart.enable = false;
-
- # in order to get networking setup we need to enable it in cloud-init
- # Disables all modules that do not work with NixOS
- # Based on https://github.com/nix-community/nixos-anywhere-examples/blob/7f945ff0ae676c0eb77360b892add91328dd1f17/digitalocean.nix
- services.cloud-init = {
- enable = true;
- network.enable = true;
- settings = {
- datasource_list = [
- "ConfigDrive"
- "Digitalocean"
- ];
- datasource.ConfigDrive = { };
- datasource.Digitalocean = { };
- # Based on https://github.com/canonical/cloud-init/blob/main/config/cloud.cfg.tmpl
- cloud_init_modules = [
- "seed_random"
- "bootcmd"
- "write_files"
- "growpart"
- "resizefs"
- "set_hostname"
- "update_hostname"
- "set_password"
- ];
- cloud_config_modules = [
- "ssh-import-id"
- "keyboard"
- "runcmd"
- "disable_ec2_metadata"
- ];
- cloud_final_modules = [
- "write_files_deferred"
- "puppet"
- "chef"
- "ansible"
- "mcollective"
- "salt_minion"
- "reset_rmc"
- "scripts_per_once"
- "scripts_per_boot"
- "scripts_user"
- "ssh_authkey_fingerprints"
- "keys_to_console"
- "install_hotplug"
- "phone_home"
- "final_message"
- ];
- };
- };
- };
-}