mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
nixos/lasuite-docs: admin improvements (#482329)
This commit is contained in:
commit
5e525a2616
1 changed files with 20 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue