refactor(nixos): use new persistDirs option and remove environment.persistence where possible

This commit is contained in:
Mohammad Rafiq 2025-06-14 19:59:42 +08:00
parent 16b7f375bd
commit 77d8ed7a13
No known key found for this signature in database
9 changed files with 98 additions and 36 deletions

View file

@ -23,7 +23,7 @@ in
};
config = mkIf cfg.enable {
environment.persistence."/persist".directories = singleton {
persistDirs = singleton {
directory = upstreamCfg.logDir;
inherit (upstreamCfg) user group;
};

View file

@ -33,7 +33,7 @@ in
message = "You must enable a local instance of postgresql.";
}
];
environment.persistence."/persist".directories = [
persistDirs = [
(mkDir cfg.configDir)
(mkDir cfg.logDir)
(mkDir cfg.dataDir)

View file

@ -0,0 +1,27 @@
{ config, lib, ... }:
let
inherit (lib) singleton mkEnableOption mkIf;
cfg = config.server.sd-webui-forge;
upstreamCfg = config.services.sd-webui-forge;
in
{
options.server.sd-webui-forge = {
enable = mkEnableOption "";
};
config = mkIf cfg.enable {
assertions = singleton {
assertion = config.hardware.gpu == "nvidia";
message = "You must run the sd-webui-forge service only with an nvidia gpu.";
};
persistDirs = singleton {
directory = upstreamCfg.dataDir;
inherit (upstreamCfg) user group;
};
services.sd-webui-forge = {
enable = true;
listen = true;
extraArgs = "--cuda-malloc";
};
};
}