nixos/pykms: fix launcher

This commit is contained in:
Peter Hoeg 2021-01-31 20:40:45 +08:00
parent a3773da142
commit c9091a9def

View file

@ -1,12 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.pykms; cfg = config.services.pykms;
libDir = "/var/lib/pykms"; libDir = "/var/lib/pykms";
in { in
{
meta.maintainers = with lib.maintainers; [ peterhoeg ]; meta.maintainers = with lib.maintainers; [ peterhoeg ];
imports = [ imports = [
@ -46,14 +46,14 @@ in {
}; };
logLevel = mkOption { logLevel = mkOption {
type = types.enum [ "CRITICAL" "ERROR" "WARNING" "INFO" "DEBUG" "MINI" ]; type = types.enum [ "CRITICAL" "ERROR" "WARNING" "INFO" "DEBUG" "MININFO" ];
default = "INFO"; default = "INFO";
description = "How much to log"; description = "How much to log";
}; };
extraArgs = mkOption { extraArgs = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [ ];
description = "Additional arguments"; description = "Additional arguments";
}; };
}; };
@ -74,8 +74,9 @@ in {
ExecStartPre = "${getBin pykms}/libexec/create_pykms_db.sh ${libDir}/clients.db"; ExecStartPre = "${getBin pykms}/libexec/create_pykms_db.sh ${libDir}/clients.db";
ExecStart = lib.concatStringsSep " " ([ ExecStart = lib.concatStringsSep " " ([
"${getBin pykms}/bin/server" "${getBin pykms}/bin/server"
"--logfile STDOUT" "--logfile=STDOUT"
"--loglevel ${cfg.logLevel}" "--loglevel=${cfg.logLevel}"
"--sqlite=${libDir}/clients.db"
] ++ cfg.extraArgs ++ [ ] ++ cfg.extraArgs ++ [
cfg.listenAddress cfg.listenAddress
(toString cfg.port) (toString cfg.port)