added stuff
This commit is contained in:
parent
e8d9044d2b
commit
9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions
34
nyx/lib/helpers/modules.nix
Normal file
34
nyx/lib/helpers/modules.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{lib}: let
|
||||
inherit (lib) mkEnableOption mkOption;
|
||||
inherit (lib.types) str int;
|
||||
|
||||
# mkModule takes a few arguments to generate a module for a service without
|
||||
# repeating the same options over and over
|
||||
# this is actually a horrendous abstractation
|
||||
mkModule = {
|
||||
name,
|
||||
type ? "", # type being an empty string means it can be skipped, ommitted
|
||||
host ? "127.0.0.1", # default to listening only on localhost
|
||||
port ? 0, # don't set a port by default
|
||||
extraOptions ? {}, # used to define additional modules
|
||||
}: {
|
||||
enable = mkEnableOption "${name} ${type} service";
|
||||
settings =
|
||||
{
|
||||
host = mkOption {
|
||||
type = str;
|
||||
default = host;
|
||||
description = "The host ${name} will listen on";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = int;
|
||||
default = port;
|
||||
description = "The port ${name} will listen on";
|
||||
};
|
||||
}
|
||||
// extraOptions;
|
||||
};
|
||||
in {
|
||||
inherit mkModule;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue