virtlyst service: init
This commit is contained in:
parent
1d235be208
commit
2ef3ae5590
@ -662,6 +662,7 @@
|
||||
./services/web-apps/tt-rss.nix
|
||||
./services/web-apps/selfoss.nix
|
||||
./services/web-apps/quassel-webserver.nix
|
||||
./services/web-apps/virtlyst.nix
|
||||
./services/web-apps/youtrack.nix
|
||||
./services/web-servers/apache-httpd/default.nix
|
||||
./services/web-servers/caddy.nix
|
||||
|
72
nixos/modules/services/web-apps/virtlyst.nix
Normal file
72
nixos/modules/services/web-apps/virtlyst.nix
Normal file
@ -0,0 +1,72 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.virtlyst;
|
||||
stateDir = "/var/lib/virtlyst";
|
||||
|
||||
ini = pkgs.writeText "virtlyst-config.ini" ''
|
||||
[wsgi]
|
||||
master = true
|
||||
threads = auto
|
||||
http-socket = ${cfg.httpSocket}
|
||||
application = ${pkgs.virtlyst}/lib/libVirtlyst.so
|
||||
chdir2 = ${stateDir}
|
||||
static-map = /static=${pkgs.virtlyst}/root/static
|
||||
|
||||
[Cutelyst]
|
||||
production = true
|
||||
DatabasePath = virtlyst.sqlite
|
||||
TemplatePath = ${pkgs.virtlyst}/root/src
|
||||
|
||||
[Rules]
|
||||
cutelyst.* = true
|
||||
virtlyst.* = true
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options.services.virtlyst = {
|
||||
enable = mkEnableOption "Virtlyst libvirt web interface";
|
||||
|
||||
adminPassword = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Initial admin password with which the database will be seeded.
|
||||
'';
|
||||
};
|
||||
|
||||
httpSocket = mkOption {
|
||||
type = types.str;
|
||||
default = "localhost:3000";
|
||||
description = ''
|
||||
IP and/or port to which to bind the http socket.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.extraUsers.virtlyst = {
|
||||
home = stateDir;
|
||||
createHome = true;
|
||||
group = mkIf config.virtualisation.libvirtd.enable "libvirtd";
|
||||
};
|
||||
|
||||
systemd.services.virtlyst = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment = {
|
||||
VIRTLYST_ADMIN_PASSWORD = cfg.adminPassword;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.cutelyst}/bin/cutelyst-wsgi2 --ini ${ini}";
|
||||
User = "virtlyst";
|
||||
WorkingDirectory = stateDir;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user