nixos/lasuite-docs: admin improvements (#482329)

This commit is contained in:
Guillaume Girol 2026-05-09 21:36:10 +00:00 committed by GitHub
commit 5e525a2616
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,7 @@ let
types
optional
optionalString
escapeShellArg
;
cfg = config.services.lasuite-docs;
@ -76,6 +77,20 @@ let
SystemCallArchitectures = "native";
UMask = "0077";
};
# Convert environment variables to be used as systemd-run arguments
envArgs = lib.concatStringsSep " " (
lib.mapAttrsToList (name: value: "-E ${escapeShellArg "${name}=${value}"}") pythonEnvironment
);
# Easier usage of django manage.py stuff
manage = pkgs.writeShellScriptBin "lasuite-docs-manage" ''
exec ${lib.getExe' config.systemd.package "systemd-run"} \
-p User=${commonServiceConfig.User} -p DynamicUser=yes \
-p StateDirectory=${commonServiceConfig.StateDirectory} --working-directory=${commonServiceConfig.WorkingDirectory} \
--quiet --collect --pipe --pty \
${envArgs} ${lib.getExe cfg.backendPackage} "$@"
'';
in
{
options.services.lasuite-docs = {
@ -346,6 +361,7 @@ in
};
config = mkIf cfg.enable {
environment.systemPackages = [ manage ];
systemd.services.lasuite-docs-postgresql-setup = mkIf cfg.postgresql.createLocally {
wantedBy = [ "lasuite-docs.target" ];
requiredBy = [ "lasuite-docs.service" ];
@ -534,6 +550,10 @@ in
recommendedProxySettings = true;
};
locations."/static/" = {
alias = "${cfg.backendPackage}/share/static/";
};
locations."/collaboration/ws/" = {
proxyPass = "http://localhost:${toString cfg.collaborationServer.port}";
recommendedProxySettings = true;