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" ];
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ let
|
|||
packageJson = lib.importJSON ../package.json;
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "leo-ed";
|
||||
pname = "kotsukotsu";
|
||||
version = packageJson.version;
|
||||
|
||||
src = lib.cleanSource ../.;
|
||||
|
|
@ -35,12 +35,12 @@ stdenvNoCC.mkDerivation {
|
|||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share/leo-ed $out/bin
|
||||
cp -r build/. $out/share/leo-ed/
|
||||
mkdir -p $out/share/kotsukotsu $out/bin
|
||||
cp -r build/. $out/share/kotsukotsu/
|
||||
|
||||
makeWrapper ${lib.getExe bun} $out/bin/leo-ed \
|
||||
--run "cd $out/share/leo-ed" \
|
||||
--add-flags "$out/share/leo-ed/server.js"
|
||||
makeWrapper ${lib.getExe bun} $out/bin/kotsukotsu \
|
||||
--run "cd $out/share/kotsukotsu" \
|
||||
--add-flags "$out/share/kotsukotsu/server.js"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
|
@ -48,7 +48,7 @@ stdenvNoCC.mkDerivation {
|
|||
meta = {
|
||||
description = "Typing practice app with passkey auth";
|
||||
homepage = "https://example.invalid";
|
||||
mainProgram = "leo-ed";
|
||||
mainProgram = "kotsukotsu";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue