2025-01-27 14:03:42 +02:00
|
|
|
{lib}: let
|
2025-01-26 20:11:01 +02:00
|
|
|
inherit (lib.types) str;
|
|
|
|
inherit (lib.options) mkOption mkEnableOption;
|
|
|
|
inherit (lib.attrsets) recursiveUpdate;
|
|
|
|
|
|
|
|
mkGraphicalService = recursiveUpdate {
|
2025-01-27 14:03:42 +02:00
|
|
|
Unit.PartOf = ["graphical-session.target"];
|
|
|
|
Unit.After = ["graphical-session.target"];
|
|
|
|
Install.WantedBy = ["graphical-session.target"];
|
2025-01-26 20:11:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
mkHyprlandService = recursiveUpdate {
|
2025-01-27 14:03:42 +02:00
|
|
|
Unit.PartOf = ["graphical-session.target"];
|
|
|
|
Unit.After = ["graphical-session.target"];
|
|
|
|
Install.WantedBy = ["hyprland-session.target"];
|
2025-01-26 20:11:01 +02:00
|
|
|
};
|
|
|
|
|
2025-01-27 14:03:42 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
A quick way to use my services abstraction
|
2025-01-26 20:11:01 +02:00
|
|
|
|
2025-01-27 14:03:42 +02:00
|
|
|
# Arguments
|
2025-01-26 20:11:01 +02:00
|
|
|
|
2025-01-27 14:03:42 +02:00
|
|
|
- [name]: The name of the service
|
2025-01-26 20:11:01 +02:00
|
|
|
|
2025-01-27 14:03:42 +02:00
|
|
|
# Type
|
2025-01-26 20:11:01 +02:00
|
|
|
|
2025-01-27 14:03:42 +02:00
|
|
|
```
|
|
|
|
mkServiceOption :: String -> (Int -> String -> String -> AttrSet) -> AttrSet
|
|
|
|
```
|
2025-01-26 20:11:01 +02:00
|
|
|
*/
|
2025-01-27 14:03:42 +02:00
|
|
|
mkServiceOption = name: {
|
|
|
|
port ? 0,
|
|
|
|
host ? "127.0.0.1",
|
|
|
|
domain ? "",
|
|
|
|
extraConfig ? {},
|
|
|
|
}:
|
2025-01-26 20:11:01 +02:00
|
|
|
{
|
|
|
|
enable = mkEnableOption "Enable the ${name} service";
|
|
|
|
|
|
|
|
host = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = host;
|
|
|
|
description = "The host for ${name} service";
|
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = lib.types.port;
|
|
|
|
default = port;
|
|
|
|
description = "The port for ${name} service";
|
|
|
|
};
|
|
|
|
|
|
|
|
domain = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = domain;
|
|
|
|
description = "Domain name for the ${name} service";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// extraConfig;
|
2025-01-27 14:03:42 +02:00
|
|
|
in {
|
2025-01-26 20:11:01 +02:00
|
|
|
inherit mkGraphicalService mkHyprlandService mkServiceOption;
|
|
|
|
}
|