Refactor inquisitor directory to interpolation
This commit is contained in:
parent
59142cf240
commit
410ff66a11
|
@ -10,13 +10,16 @@ let
|
|||
};
|
||||
inquisitor = pkgs.callPackage inquisitorSource {};
|
||||
|
||||
# Define the inquisitor data directory
|
||||
inquisiDir = "/var/lib/inquisitor";
|
||||
|
||||
# Create the inquisitor config file in the nix store, pointing to /var/lib/
|
||||
inquisitorConfig = pkgs.writeTextFile {
|
||||
name = "inquisitor.conf";
|
||||
text = ''
|
||||
DataPath = /var/lib/inquisitor/data/
|
||||
SourcePath = /var/lib/inquisitor/sources/
|
||||
CachePath = /var/lib/inquisitor/cache/
|
||||
DataPath = ${inquisiDir}/data/
|
||||
SourcePath = ${inquisiDir}/sources/
|
||||
CachePath = ${inquisiDir}/cache/
|
||||
Verbose = false
|
||||
LogFile = /var/log/inquisitor.log
|
||||
'';
|
||||
|
@ -25,15 +28,15 @@ let
|
|||
# Create a run script for the server that sets up all necessary state
|
||||
inquisitorRun = pkgs.writeShellScriptBin "run.sh" ''
|
||||
# Ensure inquisitor directories and inquisitor source folder
|
||||
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/data/inquisitor/
|
||||
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/sources/
|
||||
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/cache/
|
||||
if [ ! -f /var/lib/inquisitor/data/inquisitor/state ]; then
|
||||
${pkgs.coreutils}/bin/echo "{}" > /var/lib/inquisitor/data/inquisitor/state
|
||||
${pkgs.coreutils}/bin/mkdir -p ${inquisiDir}/data/inquisitor/
|
||||
${pkgs.coreutils}/bin/mkdir -p ${inquisiDir}/sources/
|
||||
${pkgs.coreutils}/bin/mkdir -p ${inquisiDir}/cache/
|
||||
if [ ! -f ${inquisiDir}/data/inquisitor/state ]; then
|
||||
${pkgs.coreutils}/bin/echo "{}" > ${inquisiDir}/data/inquisitor/state
|
||||
fi
|
||||
|
||||
# Run inquisitor
|
||||
cd /var/lib/inquisitor/
|
||||
cd ${inquisiDir}
|
||||
${inquisitor}/bin/gunicorn \
|
||||
--bind=localhost:24133 \
|
||||
--workers=4 \
|
||||
|
@ -52,7 +55,7 @@ in
|
|||
users.users.inquisitor = {
|
||||
description = "Inquisitor service user";
|
||||
isSystemUser = true;
|
||||
home = "/var/lib/inquisitor";
|
||||
home = "${inquisiDir}";
|
||||
createHome = true;
|
||||
packages = [ inquisitor ];
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue