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