postgresql: running initdb
from command line now works (#65309)
The issue was only with NixOS service, `postgresql` installed through `nix-env` was not affected. Fixes https://github.com/NixOS/nixpkgs/issues/23655
This commit is contained in:
parent
b1d00b71b6
commit
0730e81785
2 changed files with 30 additions and 0 deletions
|
@ -251,6 +251,10 @@ in
|
|||
|
||||
environment.systemPackages = [ postgresql ];
|
||||
|
||||
environment.pathsToLink = [
|
||||
"/share/postgresql"
|
||||
];
|
||||
|
||||
systemd.services.postgresql =
|
||||
{ description = "PostgreSQL Server";
|
||||
|
||||
|
|
26
nixos/tests/initdb.nix
Normal file
26
nixos/tests/initdb.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> { };
|
||||
in
|
||||
with import <nixpkgs/nixos/lib/testing.nix> { inherit pkgs; system = builtins.currentSystem; };
|
||||
with pkgs.lib;
|
||||
|
||||
makeTest {
|
||||
name = "pg-initdb";
|
||||
|
||||
machine = {...}:
|
||||
{
|
||||
documentation.enable = false;
|
||||
services.postgresql.enable = true;
|
||||
services.postgresql.package = pkgs.postgresql_9_6;
|
||||
environment.pathsToLink = [
|
||||
"/share/postgresql"
|
||||
];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
$machine->start;
|
||||
$machine->succeed("sudo -u postgres initdb -D /tmp/testpostgres2");
|
||||
$machine->shutdown;
|
||||
'';
|
||||
|
||||
}
|
Loading…
Reference in a new issue