modules.services: 整理

This commit is contained in:
2025-02-04 21:55:54 +08:00
parent cd65aeab6f
commit 5f7957560e
6 changed files with 11 additions and 18 deletions

View File

@@ -48,7 +48,6 @@ inputs:
{
sshd = {};
xray.client = { enable = true; dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1"; };
smartd.enable = true;
beesd.instances =
{
root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };

View File

@@ -26,7 +26,6 @@ inputs:
services =
{
xray.client.enable = true;
smartd.enable = true;
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
wireguard =
{

View File

@@ -108,7 +108,6 @@ inputs:
};
};
nix-serve = { enable = true; hostname = "nix-store.chn.moe"; };
smartd.enable = true;
misskey.instances.misskey.hostname = "xn--qbtm095lrg0bfka60z.chn.moe";
beesd.instances.root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };
wireguard =

View File

@@ -23,7 +23,6 @@ inputs:
services =
{
sshd.passwordAuthentication = true;
smartd.enable = true;
slurm =
{
enable = true;

View File

@@ -39,7 +39,6 @@ inputs:
services =
{
sshd = { passwordAuthentication = true; groupBanner = true; };
smartd.enable = true;
slurm =
{
enable = true;

View File

@@ -3,18 +3,16 @@ inputs:
imports = inputs.localLib.findModules ./.;
options.nixos.services = let inherit (inputs.lib) mkOption types; in
{
smartd.enable = mkOption { type = types.bool; default = false; };
noisetorch.enable = mkOption { type = types.bool; default = inputs.config.nixos.model.type == "desktop"; };
smartd = mkOption { type = types.nullOr (types.submodule {}); default = {}; };
noisetorch = mkOption
{
type = types.nullOr (types.submodule {});
default = if inputs.config.nixos.model.type == "desktop" then {} else null;
};
};
config =
let
inherit (inputs.lib) mkMerge mkIf;
inherit (inputs.localLib) stripeTabs attrsToList;
inherit (inputs.config.nixos) services;
inherit (builtins) map listToAttrs toString;
in mkMerge
[
(mkIf services.smartd.enable { services.smartd.enable = true; })
(mkIf services.noisetorch.enable { programs.noisetorch.enable = true; })
];
config = let inherit (inputs.config.nixos.services) smartd noisetorch; in inputs.lib.mkMerge
[
(inputs.lib.mkIf (smartd != null) { services.smartd.enable = true; })
(inputs.lib.mkIf (noisetorch != null) { programs.noisetorch.enable = true; })
];
}