From a64d153004c7777e1b86658eee0bd3bd46e48174 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Fri, 30 Jan 2026 15:19:11 +0100 Subject: [PATCH] feat: add 'azure' cloud option (and generalized module) --- home/hosts/andromache/default.nix | 4 ++-- home/hosts/astyanax/default.nix | 4 ++-- home/hosts/work/default.nix | 2 ++ home/modules/cloud/azure.nix | 12 ++++++++++++ home/modules/cloud/default.nix | 17 +++++++++++++++++ .../{hcloud/default.nix => cloud/hetzner.nix} | 7 ++++++- home/modules/hetzner/default.nix | 7 ------- 7 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 home/modules/cloud/azure.nix create mode 100644 home/modules/cloud/default.nix rename home/modules/{hcloud/default.nix => cloud/hetzner.nix} (65%) delete mode 100644 home/modules/hetzner/default.nix diff --git a/home/hosts/andromache/default.nix b/home/hosts/andromache/default.nix index b11124c..2b97ade 100644 --- a/home/hosts/andromache/default.nix +++ b/home/hosts/andromache/default.nix @@ -11,11 +11,10 @@ let in { imports = [ + ../../modules/cloud ../../modules/desktop/niri - ../../modules/3d ../../modules/git.nix - # ../../modules/hetzner.nix ../../modules/k9s.nix ../../modules/kitty.nix ../../modules/ssh.nix @@ -37,6 +36,7 @@ in xdg.userDirs.download = "${config.home.homeDirectory}/dl"; browser.primary = "librewolf"; + cloud.hetzner.enable = true; shell.bash = { enable = true; diff --git a/home/hosts/astyanax/default.nix b/home/hosts/astyanax/default.nix index 9d05903..ad0011e 100644 --- a/home/hosts/astyanax/default.nix +++ b/home/hosts/astyanax/default.nix @@ -1,5 +1,4 @@ { - inputs, config, pkgs, ... @@ -12,9 +11,9 @@ in imports = [ ../../modules/ai-tools.nix ../../modules/anki.nix + ../../modules/cloud ../../modules/desktop/niri ../../modules/git.nix - # ../../modules/hetzner.nix ../../modules/k9s.nix ../../modules/kitty.nix ../../modules/ssh.nix @@ -34,6 +33,7 @@ in xdg.userDirs.download = "${config.home.homeDirectory}/dl"; browser.primary = "librewolf"; + cloud.hetzner.enable = true; shell.bash = { enable = true; diff --git a/home/hosts/work/default.nix b/home/hosts/work/default.nix index d3101fe..f4108eb 100644 --- a/home/hosts/work/default.nix +++ b/home/hosts/work/default.nix @@ -12,6 +12,7 @@ in imports = [ inputs.sops-nix.homeManagerModules.sops ../../modules/ai-tools.nix + ../../modules/cloud ../../modules/dconf.nix ../../modules/git.nix ../../modules/k9s.nix @@ -59,6 +60,7 @@ in browser.primary = "firefox"; browser.secondary = "chromium"; + cloud.azure.enable = true; shell.bash.enable = true; starship.enable = true; diff --git a/home/modules/cloud/azure.nix b/home/modules/cloud/azure.nix new file mode 100644 index 0000000..85bcfcd --- /dev/null +++ b/home/modules/cloud/azure.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + config = lib.mkIf config.cloud.azure.enable { + home.packages = with pkgs; [ azure-cli ]; + }; +} diff --git a/home/modules/cloud/default.nix b/home/modules/cloud/default.nix new file mode 100644 index 0000000..cab8f31 --- /dev/null +++ b/home/modules/cloud/default.nix @@ -0,0 +1,17 @@ +{ lib, ... }: + +{ + options.cloud = { + azure = { + enable = lib.mkEnableOption "azure CLI"; + }; + hetzner = { + enable = lib.mkEnableOption "hetzner CLI"; + }; + }; + + imports = [ + ./azure.nix + ./hetzner.nix + ]; +} diff --git a/home/modules/hcloud/default.nix b/home/modules/cloud/hetzner.nix similarity index 65% rename from home/modules/hcloud/default.nix rename to home/modules/cloud/hetzner.nix index 1d8c1cc..9c3d5df 100644 --- a/home/modules/hcloud/default.nix +++ b/home/modules/cloud/hetzner.nix @@ -1,5 +1,7 @@ { + config, lib, + pkgs, osConfig ? null, ... }: @@ -8,9 +10,12 @@ let isNixOS = osConfig != null; in { - config = { + config = lib.mkIf config.cloud.hetzner.enable { warnings = lib.optional (!isNixOS) "hcloud module requires NixOS host configuration. This module will not work with standalone home-manager."; + home = { + packages = with pkgs; [ hcloud ]; + }; }; } diff --git a/home/modules/hetzner/default.nix b/home/modules/hetzner/default.nix deleted file mode 100644 index 7cadfc5..0000000 --- a/home/modules/hetzner/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: - -{ - home = { - packages = with pkgs; [ hcloud ]; - }; -}