2024-05-21 09:22:03 -04:00
|
|
|
# This is an example of a blank module.
|
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
let
|
2024-06-24 11:38:28 -04:00
|
|
|
cfg = config.aux.system.services.myModule;
|
2024-05-21 09:22:03 -04:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2024-06-24 11:38:28 -04:00
|
|
|
aux.system.services.myModule = {
|
2024-09-08 11:58:56 -04:00
|
|
|
enable = lib.mkEnableOption "Enables this example module.";
|
2024-05-21 09:22:03 -04:00
|
|
|
attributes = lib.mkOption {
|
|
|
|
default = { };
|
|
|
|
type = lib.types.attrs;
|
|
|
|
description = "An example of an attributes option.";
|
|
|
|
};
|
|
|
|
string = lib.mkOption {
|
|
|
|
default = "";
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "An example of a string option.";
|
|
|
|
};
|
|
|
|
list = lib.mkOption {
|
|
|
|
default = [ ];
|
|
|
|
type = lib.types.listOf lib.types.int;
|
|
|
|
description = "An example of a list (of integers) option.";
|
|
|
|
};
|
|
|
|
enum = mkOption {
|
|
|
|
default = "one";
|
|
|
|
type = types.enum [
|
|
|
|
"one"
|
|
|
|
"two"
|
|
|
|
];
|
|
|
|
description = "An example of an enum option.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2024-05-22 16:47:55 -04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-05-21 09:22:03 -04:00
|
|
|
# Add changes applied by this module here.
|
|
|
|
};
|
2024-09-07 13:44:14 -04:00
|
|
|
|
|
|
|
systemd.services = {
|
|
|
|
# Forces systemd to wait for the module's configuration directory to be available before starting the service.
|
|
|
|
myModule.unitConfig.RequiresMountsFor = cfg.home;
|
|
|
|
|
|
|
|
# Tells Nginx to wait for the service to be available before coming online.
|
|
|
|
nginx.wants = [ config.systemd.services.myModule.name ];
|
|
|
|
};
|
2024-05-21 09:22:03 -04:00
|
|
|
}
|