refactor(wyoming+): assert instead of import docker module
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
e61ada3cd2
commit
79e642451a
5 changed files with 28 additions and 11 deletions
|
@ -13,6 +13,7 @@ in {
|
|||
|
||||
./modules
|
||||
|
||||
self.nixosModules.docker
|
||||
self.nixosModules.kmscon
|
||||
self.nixosModules.server
|
||||
];
|
||||
|
|
|
@ -13,6 +13,7 @@ in {
|
|||
|
||||
./modules
|
||||
|
||||
self.nixosModules.docker
|
||||
self.nixosModules.kmscon
|
||||
self.nixosModules.server
|
||||
];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue