diff --git a/devices/homie/default.nix b/devices/homie/default.nix index 07003323..b8c3aa18 100644 --- a/devices/homie/default.nix +++ b/devices/homie/default.nix @@ -13,6 +13,7 @@ in { ./modules + self.nixosModules.docker self.nixosModules.kmscon self.nixosModules.server ]; diff --git a/devices/nos/default.nix b/devices/nos/default.nix index c8265aee..e79aab81 100644 --- a/devices/nos/default.nix +++ b/devices/nos/default.nix @@ -13,6 +13,7 @@ in { ./modules + self.nixosModules.docker self.nixosModules.kmscon self.nixosModules.server ]; diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 10bc1101..e3a35d80 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -7,5 +7,5 @@ self: { nvidia = import ./nvidia; plymouth = import ./plymouth; server = import ./server; - wyoming-plus = import ./wyoming-plus self; + wyoming-plus = import ./wyoming-plus; } diff --git a/nixosModules/docker/default.nix b/nixosModules/docker/default.nix index 766243ec..e96b125b 100644 --- a/nixosModules/docker/default.nix +++ b/nixosModules/docker/default.nix @@ -4,9 +4,10 @@ khepri: { pkgs, ... }: let - inherit (lib) mkOption types; - + inherit (lib) mkIf mkOption types; inherit (config.vars) mainUser; + + cfg = config.khepri; in { imports = [khepri.nixosModules.default]; @@ -18,15 +19,20 @@ in { Directory to place persistent data in. ''; }; + + storageDriver = mkOption { + default = "btrfs"; # I use BTRFS on all my servers + type = types.str; + }; }; - config = { + config = mkIf (cfg.compositions != {}) { users.extraUsers.${mainUser}.extraGroups = ["docker"]; virtualisation = { docker = { enable = true; - storageDriver = "btrfs"; + storageDriver = cfg.storageDriver; package = pkgs.docker_27; diff --git a/nixosModules/wyoming-plus/default.nix b/nixosModules/wyoming-plus/default.nix index b860c478..9697a6ab 100644 --- a/nixosModules/wyoming-plus/default.nix +++ b/nixosModules/wyoming-plus/default.nix @@ -1,4 +1,4 @@ -self: { +{ config, lib, pkgs, @@ -10,6 +10,7 @@ self: { escapeShellArgs flatten filterAttrs + hasAttr listToAttrs map mkEnableOption @@ -26,8 +27,6 @@ self: { cfg = config.services.wyoming.openwakeword-docker; in { - imports = [self.nixosModules.docker]; - options.services.wyoming.openwakeword-docker = { enable = mkEnableOption "Wyoming openWakeWord server"; @@ -114,6 +113,19 @@ in { }; config = { + assertions = [ + { + assertion = + (cfg.enable + && hasAttr "khepri" config + && hasAttr "rwDataDir" config.khepri) || !cfg.enable; + message = '' + The module `docker` from this same flake is needed to use + this openwakeword implementation. + ''; + } + ]; + systemd.services = let unitNames = attrNames ( filterAttrs (_: v: v.device == "cpu") config.services.wyoming.faster-whisper.servers @@ -147,7 +159,4 @@ in { }; }; }; - - # For accurate stack trace - _file = ./default.nix; }