diff options
| author | Fuwn <[email protected]> | 2024-09-20 05:45:43 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-20 05:45:43 -0700 |
| commit | 9e5f5c54d9ca9e976541f65d2b76bb723a807aca (patch) | |
| tree | e87c9ff000a04241bd4e48c041c0f66e47df4877 | |
| parent | modules: server and core modules (diff) | |
| download | nixos-config-9e5f5c54d9ca9e976541f65d2b76bb723a807aca.tar.xz nixos-config-9e5f5c54d9ca9e976541f65d2b76bb723a807aca.zip | |
server: modular container engine
| -rw-r--r-- | hosts/himeji/default.nix | 2 | ||||
| -rw-r--r-- | hosts/himeji/options.nix | 7 | ||||
| -rw-r--r-- | modules/options/default.nix | 19 | ||||
| -rw-r--r-- | modules/server/systemd.nix | 4 | ||||
| -rw-r--r-- | modules/server/virtualisation.nix | 4 |
5 files changed, 27 insertions, 9 deletions
diff --git a/hosts/himeji/default.nix b/hosts/himeji/default.nix index 94adf70..9d3045d 100644 --- a/hosts/himeji/default.nix +++ b/hosts/himeji/default.nix @@ -1,9 +1,9 @@ { imports = [ - ../../modules/server ../../disks/himeji.nix ./hardware-configuration.nix ../../modules/options + ../../modules/server ./options.nix ]; diff --git a/hosts/himeji/options.nix b/hosts/himeji/options.nix index d8e2298..ed067da 100644 --- a/hosts/himeji/options.nix +++ b/hosts/himeji/options.nix @@ -1 +1,6 @@ -{ config.modules.nix.extend = false; } +{ + config.modules = { + nix.extend = false; + server.containerEngine = "podman"; + }; +} diff --git a/modules/options/default.nix b/modules/options/default.nix index bd831dc..97afab3 100644 --- a/modules/options/default.nix +++ b/modules/options/default.nix @@ -1,7 +1,20 @@ { lib, ... }: +with lib.options; +with lib.types; { - options.modules.nix.extend = lib.options.mkOption { - default = true; - type = lib.types.bool; + options.modules = { + nix.extend = mkOption { + default = true; + type = types.bool; + }; + + server.containerEngine = mkOption { + default = "podman"; + + type = types.enum [ + "podman" + "docker" + ]; + }; }; } diff --git a/modules/server/systemd.nix b/modules/server/systemd.nix index acdcef4..8d0b118 100644 --- a/modules/server/systemd.nix +++ b/modules/server/systemd.nix @@ -1,6 +1,6 @@ -{ secrets, ... }: +{ secrets, config, ... }: let - containerEngine = "podman"; + inherit (config.modules.server) containerEngine; in { systemd.services.tailscale-up = { diff --git a/modules/server/virtualisation.nix b/modules/server/virtualisation.nix index 3d8effe..0bda69e 100644 --- a/modules/server/virtualisation.nix +++ b/modules/server/virtualisation.nix @@ -1,6 +1,6 @@ -{ secrets, ... }: +{ secrets, config, ... }: let - containerEngine = "podman"; + inherit (config.modules.server) containerEngine; in { virtualisation = { |