mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #288622 from Stunkymonkey/photoprism-manage-script
nixos/photoprism: improve manage script
This commit is contained in:
commit
27f19c1efd
1 changed files with 8 additions and 11 deletions
|
@ -12,17 +12,14 @@ let
|
||||||
lib.mapAttrs (_: toString) cfg.settings
|
lib.mapAttrs (_: toString) cfg.settings
|
||||||
);
|
);
|
||||||
|
|
||||||
manage =
|
manage = pkgs.writeShellScript "manage" ''
|
||||||
let
|
set -o allexport # Export the following env vars
|
||||||
setupEnv = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: val: "export ${name}=${lib.escapeShellArg val}") env);
|
${lib.toShellVars env}
|
||||||
in
|
eval "$(${config.systemd.package}/bin/systemctl show -pUID,MainPID photoprism.service | ${pkgs.gnused}/bin/sed "s/UID/ServiceUID/")"
|
||||||
pkgs.writeShellScript "manage" ''
|
exec ${pkgs.util-linux}/bin/nsenter \
|
||||||
${setupEnv}
|
-t $MainPID -m -S $ServiceUID -G $ServiceUID --wdns=${cfg.storagePath} \
|
||||||
eval "$(${config.systemd.package}/bin/systemctl show -pUID,MainPID photoprism.service | ${pkgs.gnused}/bin/sed "s/UID/ServiceUID/")"
|
${cfg.package}/bin/photoprism "$@"
|
||||||
exec ${pkgs.util-linux}/bin/nsenter \
|
'';
|
||||||
-t $MainPID -m -S $ServiceUID -G $ServiceUID --wdns=${cfg.storagePath} \
|
|
||||||
${cfg.package}/bin/photoprism "$@"
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
meta.maintainers = with lib.maintainers; [ stunkymonkey ];
|
meta.maintainers = with lib.maintainers; [ stunkymonkey ];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue