m
This commit is contained in:
parent
f81d5604ae
commit
d88355267a
4 changed files with 60 additions and 73 deletions
|
|
@ -1,16 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.leo-ed;
|
||||
cfg = config.services.kotsukotsu;
|
||||
in
|
||||
{
|
||||
options.services.leo-ed = {
|
||||
enable = lib.mkEnableOption "leo-ed typing app";
|
||||
options.services.kotsukotsu = {
|
||||
enable = lib.mkEnableOption "kotsukotsu typing app";
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.package;
|
||||
default = null;
|
||||
description = "The leo-ed package to run, typically inputs.leo-ed.packages.${pkgs.system}.default.";
|
||||
description = "The kotsukotsu package to run, typically inputs.kotsukotsu.packages.${pkgs.system}.default.";
|
||||
};
|
||||
|
||||
host = lib.mkOption {
|
||||
|
|
@ -34,19 +34,19 @@ in
|
|||
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/var/lib/leo-ed";
|
||||
default = "/var/lib/kotsukotsu";
|
||||
description = "Directory for the persistent SQLite database.";
|
||||
};
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "leo-ed";
|
||||
default = "kotsukotsu";
|
||||
description = "User account for the service.";
|
||||
};
|
||||
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "leo-ed";
|
||||
default = "kotsukotsu";
|
||||
description = "Group for the service.";
|
||||
};
|
||||
|
||||
|
|
@ -61,24 +61,24 @@ in
|
|||
assertions = [
|
||||
{
|
||||
assertion = cfg.package != null;
|
||||
message = "services.leo-ed.package must be set, usually from this flake input.";
|
||||
message = "services.kotsukotsu.package must be set, usually from this flake input.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.domain != null && cfg.domain != "";
|
||||
message = "services.leo-ed.domain must be set.";
|
||||
message = "services.kotsukotsu.domain must be set.";
|
||||
}
|
||||
{
|
||||
assertion = lib.hasPrefix "/" cfg.dataDir;
|
||||
message = "services.leo-ed.dataDir must be an absolute path.";
|
||||
message = "services.kotsukotsu.dataDir must be an absolute path.";
|
||||
}
|
||||
];
|
||||
|
||||
users.groups = lib.mkIf (cfg.group == "leo-ed") {
|
||||
leo-ed = { };
|
||||
users.groups = lib.mkIf (cfg.group == "kotsukotsu") {
|
||||
kotsukotsu = { };
|
||||
};
|
||||
|
||||
users.users = lib.mkIf (cfg.user == "leo-ed") {
|
||||
leo-ed = {
|
||||
users.users = lib.mkIf (cfg.user == "kotsukotsu") {
|
||||
kotsukotsu = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
home = toString cfg.dataDir;
|
||||
|
|
@ -90,8 +90,8 @@ in
|
|||
"d ${toString cfg.dataDir} 0750 ${cfg.user} ${cfg.group} -"
|
||||
];
|
||||
|
||||
systemd.services.leo-ed = {
|
||||
description = "leo-ed typing app";
|
||||
systemd.services.kotsukotsu = {
|
||||
description = "kotsukotsu typing app";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue