From c47437116b76efb6769361f2661e9dd27d70bc89 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 18 Apr 2024 16:23:25 +0200 Subject: [PATCH] feat(modules): Introduce per node module import from meta --- meta/nodes.nix | 4 ++++ meta/options.nix | 8 ++++++++ modules/default.nix | 22 ++++++++++++++-------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/meta/nodes.nix b/meta/nodes.nix index 7a63a26..12bcbfe 100644 --- a/meta/nodes.nix +++ b/meta/nodes.nix @@ -26,6 +26,8 @@ stateVersion = "23.05"; vm-cluster = "Hyperviseur NPS"; + + nix-modules = [ "services/crabfit" ]; }; compute01 = { @@ -53,6 +55,8 @@ storage01 = { site = "pav01"; stateVersion = "23.11"; + + nix-modules = [ "services/forgejo-nix-runners" ]; }; vault01 = { diff --git a/meta/options.nix b/meta/options.nix index 1b722d6..9214b73 100644 --- a/meta/options.nix +++ b/meta/options.nix @@ -95,6 +95,14 @@ in ''; }; + nix-modules = mkOption { + type = listOf str; + default = [ ]; + description = '' + List of modules to import from [nix-modules](https://git.hubrecht.ovh/hubrecht/nix-modules). + ''; + }; + admins = mkOption { type = listOf str; default = [ ]; diff --git a/modules/default.nix b/modules/default.nix index dacde26..a395f72 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -32,7 +32,12 @@ # pris connaissance de la licence CeCILL, et que vous en avez accepté les # termes. -{ lib, sources, ... }: +{ + lib, + nodeMeta, + sources, + ... +}: { imports = @@ -57,11 +62,12 @@ "${sources.attic}/nixos/atticd.nix" "${sources.arkheon}/module.nix" ] - ++ ((import sources.nix-modules { inherit lib; }).importModules [ - "age-secrets" - "services/crabfit" - "services/forgejo-nix-runners" - "services/bupstash" - "services/systemd-notify" - ]); + ++ ((import sources.nix-modules { inherit lib; }).importModules ( + [ + "age-secrets" + "services/bupstash" + "services/systemd-notify" + ] + ++ nodeMeta.nix-modules + )); }