moved db kill to separate file

This commit is contained in:
David Mosbach 2024-01-28 00:19:20 +00:00
parent c4910c9690
commit 7c8747c487
3 changed files with 29 additions and 16 deletions

View File

@ -30,12 +30,6 @@
) )
); );
libPath = pkgs.lib.makeLibraryPath buildInputs; libPath = pkgs.lib.makeLibraryPath buildInputs;
#oms = pkgs.haskell.lib.buildStackProject {
# ghc = pkgs.haskell.packages.ghc927.ghc;
# inherit buildInputs;
# inherit name;
# dontUnpack = true;
#};
oms = pkgs.stdenv.mkDerivation { oms = pkgs.stdenv.mkDerivation {
inherit buildInputs; inherit buildInputs;
inherit name; inherit name;
@ -54,18 +48,32 @@
echo "moved" echo "moved"
''; '';
}; };
mkDB = builtins.readFile ./mkDB.sh;
killDB = builtins.readFile ./killDB.sh;
in { in {
packages.${system} = { packages.${system} = {
${name} = oms; # nixpkgs.legacyPackages.${system}.${name}; ${name} = oms; # nixpkgs.legacyPackages.${system}.${name};
mkOauth2DB = pkgs.writeScriptBin "mkOauth2DB" ''
#!${pkgs.zsh}/bis/zsh -e
${mkDB}
'';
killOauth2DB = pkgs.writeScriptBin "killOauth2DB" ''
#!${pkgs.zsh}/bis/zsh -e
${killDB}
'';
default = self.packages.${system}.${name}; default = self.packages.${system}.${name};
}; };
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
buildInputs = buildInputs; buildInputs = buildInputs;
LD_LIBRARY_PATH = libPath; LD_LIBRARY_PATH = libPath;
shellHook = builtins.readFile ./mkDB.sh; shellHook = ''
${mkDB}
zsh
${killDB}
'';
};
}; };
}; }
}

8
killDB.sh Executable file
View File

@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: 2024 UniWorX Systems
# SPDX-FileContributor: David Mosbach <david.mosbach@uniworx.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
pg_ctl stop -D "${OAUTH2_PGDIR}"
rm -rvf "${OAUTH2_PGDIR}" "${OAUTH2_PGHOST}" "${OAUTH2_PGLOG}"

View File

@ -26,8 +26,5 @@ printf "Postgres logfile is %s\nPostgres socket directory is %s\n" "${pgLogFile}
export OAUTH2_PGHOST="${pgSockDir}" export OAUTH2_PGHOST="${pgSockDir}"
export OAUTH2_PGLOG="${pgLogFile}" export OAUTH2_PGLOG="${pgLogFile}"
export OAUTH2_PGDIR="${pgDir}"
zsh
pg_ctl stop -D "${pgDir}"
rm -rvf "${pgDir}" "${pgSockDir}" "${pgLogFile}"