setup ttrss postgres database through disnixos
This commit is contained in:
parent
3e8970e5cc
commit
e88b3e1413
2 changed files with 40 additions and 0 deletions
26
PostgresDB/default.nix
Normal file
26
PostgresDB/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ stdenv, pkgs }:
|
||||
{ postgresUsername
|
||||
, postgresPassword
|
||||
, postgresDatabase
|
||||
}:
|
||||
|
||||
# From https://github.com/svanderburg/dysnomia/blob/master/dysnomia-modules/postgresql-database.in
|
||||
# and https://github.com/svanderburg/dysnomia/blob/master/tests/deployment/postgresql-database.nix
|
||||
#
|
||||
# On activation, an initial dump can be restored. If the mutable component
|
||||
# contains a sub folder named postgresql-databases/, then the dump files stored
|
||||
# inside get imported.
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = postgresDatabase;
|
||||
|
||||
src = pkgs.writeTextDir "${postgresDatabase}.sql" ''
|
||||
CREATE USER "${postgresUsername}" WITH PASSWORD '${postgresPassword}';
|
||||
GRANT ALL PRIVILEGES ON DATABASE "${postgresUsername}" TO "${postgresDatabase}";
|
||||
'';
|
||||
|
||||
buildCommand = ''
|
||||
mkdir -p $out/postgresql-databases
|
||||
cp $src/*.sql $out/postgresql-databases
|
||||
'';
|
||||
}
|
14
all-packages.nix
Normal file
14
all-packages.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ distribution ? null
|
||||
, services ? null
|
||||
, system ? builtins.currentSystem
|
||||
, pkgs ? import <nixpkgs> { inherit system; }
|
||||
}:
|
||||
|
||||
let
|
||||
callPackage = pkgs.lib.callPackageWith (pkgs // self);
|
||||
|
||||
self = {
|
||||
PostgresDB = callPackage ./PostgresDB {};
|
||||
};
|
||||
in
|
||||
self
|
Loading…
Reference in a new issue