mkModule various + fixes
This commit is contained in:
@@ -6,25 +6,34 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.services.orca-slicer;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
name = "orca-slicer";
|
||||
cfg = config.${namespace}.services.${name};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers."${cfg.name}" = {
|
||||
autoStart = cfg.autoStart;
|
||||
image = cfg.image;
|
||||
ports = [
|
||||
"${cfg.httpPort}:3000"
|
||||
"${cfg.httpsPort}:3001"
|
||||
];
|
||||
volumes = [ "${cfg.configPath}:/config" ];
|
||||
environment = {
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
orcaConfig = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
description = "orca slicer web ui";
|
||||
options = {
|
||||
httpsPort = mkOpt types.int 443 "HTTPS port";
|
||||
};
|
||||
moduleConfig = {
|
||||
virtualisation.oci-containers.containers."${name}" = {
|
||||
autoStart = true;
|
||||
image = "linuxserver/orcaslicer";
|
||||
ports = [
|
||||
"${toString cfg.port}:3000"
|
||||
"${toString cfg.httpsPort}:3001"
|
||||
];
|
||||
volumes = [ "${cfg.configDir}/orca-slicer:/config" ];
|
||||
environment = {
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ orcaConfig ];
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.${namespace}.services.orca-slicer = {
|
||||
enable = mkEnableOption "orca slicer docker service";
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
httpPort = mkOption {
|
||||
type = types.str;
|
||||
default = "3000";
|
||||
};
|
||||
|
||||
httpsPort = mkOption {
|
||||
type = types.str;
|
||||
default = "3001";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "orca-slicer";
|
||||
};
|
||||
|
||||
image = mkOption {
|
||||
type = types.str;
|
||||
default = "linuxserver/orcaslicer";
|
||||
};
|
||||
|
||||
configPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/nas/main/ssd_app_data/orca-slicer";
|
||||
};
|
||||
|
||||
dataPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/nas/main/3d_printer";
|
||||
};
|
||||
|
||||
puid = mkOption {
|
||||
type = types.str;
|
||||
default = "911";
|
||||
};
|
||||
|
||||
pgid = mkOption {
|
||||
type = types.str;
|
||||
default = "1000";
|
||||
};
|
||||
|
||||
timeZone = mkOption {
|
||||
type = types.str;
|
||||
default = "America/Chicago";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user