mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
nix: implement flake
This commit introduces the ability to install Docspell from a Nix flake. There are no major changes to the logic of the previous modules outside of organizing them in a flake and adding a simple check script.
This commit is contained in:
43
nix/checks/solr.nix
Normal file
43
nix/checks/solr.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# This module sets up solr with one core. It is a bit tedious…. If you
|
||||
# know a better solution, please let me know.
|
||||
{
|
||||
nixpkgs.config = {
|
||||
permittedInsecurePackages = [
|
||||
"solr-8.6.3"
|
||||
# NOTE: Qtwebkit is a dep for wkhtmltopdf, this line is needed until #201765 is fixed in nixpkgs
|
||||
"qtwebkit-5.212.0-alpha4"
|
||||
];
|
||||
};
|
||||
|
||||
services.solr = {
|
||||
enable = true;
|
||||
};
|
||||
# This is needed to run solr script as user solr
|
||||
users.users.solr.useDefaultShell = true;
|
||||
|
||||
systemd.services.solr-init =
|
||||
let
|
||||
solrPort = toString config.services.solr.port;
|
||||
initSolr = ''
|
||||
if [ ! -f ${config.services.solr.stateDir}/docspell_core ]; then
|
||||
while ! echo "" | ${pkgs.inetutils}/bin/telnet localhost ${solrPort}
|
||||
do
|
||||
echo "Waiting for SOLR become ready..."
|
||||
sleep 1.5
|
||||
done
|
||||
${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh solr -c "${pkgs.solr}/bin/solr create_core -c docspell -p ${solrPort}";
|
||||
touch ${config.services.solr.stateDir}/docspell_core
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
script = initSolr;
|
||||
after = [ "solr.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "solr.target" ];
|
||||
description = "Create a core at solr";
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user