mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/gancio: fix quotes and indentation, exec into configured user (#397194)
This commit is contained in:
commit
a89584761e
1 changed files with 12 additions and 14 deletions
|
@ -57,7 +57,7 @@ in
|
|||
default = "http${
|
||||
lib.optionalString config.services.nginx.virtualHosts."${cfg.settings.hostname}".enableACME "s"
|
||||
}://${cfg.settings.hostname}";
|
||||
defaultText = lib.literalExpression ''"https://''${cfg.settings.hostname}"'';
|
||||
defaultText = lib.literalExpression ''"https://''${config.services.gancio.settings.hostname}"'';
|
||||
example = "https://demo.gancio.org/gancio";
|
||||
description = "The full URL under which the server is reachable.";
|
||||
};
|
||||
|
@ -89,9 +89,7 @@ in
|
|||
readOnly = true;
|
||||
type = types.nullOr types.str;
|
||||
default = if cfg.settings.db.dialect == "sqlite" then "/var/lib/gancio/db.sqlite" else null;
|
||||
defaultText = ''
|
||||
if cfg.settings.db.dialect == "sqlite" then "/var/lib/gancio/db.sqlite" else null
|
||||
'';
|
||||
defaultText = ''if config.services.gancio.settings.db.dialect == "sqlite" then "/var/lib/gancio/db.sqlite" else null'';
|
||||
};
|
||||
host = mkOption {
|
||||
description = ''
|
||||
|
@ -100,9 +98,7 @@ in
|
|||
readOnly = true;
|
||||
type = types.nullOr types.str;
|
||||
default = if cfg.settings.db.dialect == "postgres" then "/run/postgresql" else null;
|
||||
defaultText = ''
|
||||
if cfg.settings.db.dialect == "postgres" then "/run/postgresql" else null
|
||||
'';
|
||||
defaultText = ''if config.services.gancio.settings.db.dialect == "postgres" then "/run/postgresql" else null'';
|
||||
};
|
||||
database = mkOption {
|
||||
description = ''
|
||||
|
@ -111,9 +107,7 @@ in
|
|||
readOnly = true;
|
||||
type = types.nullOr types.str;
|
||||
default = if cfg.settings.db.dialect == "postgres" then cfg.user else null;
|
||||
defaultText = ''
|
||||
if cfg.settings.db.dialect == "postgres" then cfg.user else null
|
||||
'';
|
||||
defaultText = ''if config.services.gancio.settings.db.dialect == "postgres" then cfg.user else null'';
|
||||
};
|
||||
};
|
||||
log_level = mkOption {
|
||||
|
@ -174,10 +168,14 @@ in
|
|||
environment.systemPackages = [
|
||||
(pkgs.runCommand "gancio" { } ''
|
||||
mkdir -p $out/bin
|
||||
echo "#!${pkgs.runtimeShell}
|
||||
cd /var/lib/gancio/
|
||||
exec ${lib.getExe cfg.package} ''${1:---help}
|
||||
" > $out/bin/gancio
|
||||
echo '#!${pkgs.runtimeShell}
|
||||
cd /var/lib/gancio/
|
||||
sudo=exec
|
||||
if [[ "$USER" != ${cfg.user} ]]; then
|
||||
sudo="exec /run/wrappers/bin/sudo -u ${cfg.user}"
|
||||
fi
|
||||
$sudo ${lib.getExe cfg.package} ''${1:--help}
|
||||
' > $out/bin/gancio
|
||||
chmod +x $out/bin/gancio
|
||||
'')
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue