mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
nixos/test/nominatim: replace activation script by ExecStartPre
See https://github.com/NixOS/nixpkgs/issues/475305
This commit is contained in:
parent
888dec0bf6
commit
0818fcf64b
1 changed files with 28 additions and 8 deletions
|
|
@ -59,14 +59,34 @@ in
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
# Database password
|
||||
system.activationScripts = {
|
||||
passwordFile.text = with config.services.nominatim.database; ''
|
||||
mkdir -p /run/secrets
|
||||
echo "${host}:${toString port}:${dbname}:${apiUser}:password" \
|
||||
> /run/secrets/pgpass
|
||||
chown nominatim-api:nominatim-api /run/secrets/pgpass
|
||||
chmod 0600 /run/secrets/pgpass
|
||||
'';
|
||||
systemd.services.nominatim = {
|
||||
serviceConfig.ExecStartPre =
|
||||
let
|
||||
createPasswordFile = lib.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "nominatim-pre-start";
|
||||
text =
|
||||
let
|
||||
inherit (config.services.nominatim.database)
|
||||
host
|
||||
port
|
||||
dbname
|
||||
apiUser
|
||||
;
|
||||
in
|
||||
''
|
||||
mkdir -p /run/secrets
|
||||
echo "${host}:${toString port}:${dbname}:${apiUser}:password" \
|
||||
> /run/secrets/pgpass
|
||||
chown nominatim-api:nominatim-api /run/secrets/pgpass
|
||||
chmod 0600 /run/secrets/pgpass
|
||||
'';
|
||||
}
|
||||
);
|
||||
in
|
||||
[
|
||||
"+${createPasswordFile}"
|
||||
];
|
||||
};
|
||||
|
||||
# Nominatim
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue