Update nix setup

Need to remove solr, because it has been dropped in nixos 23.11
This commit is contained in:
eikek
2024-01-29 22:14:15 +01:00
parent 50dadad48e
commit 96c825e93a
5 changed files with 12 additions and 55 deletions

View File

@ -2,7 +2,7 @@
let let
full-text-search = { full-text-search = {
enabled = true; enabled = true;
solr.url = "http://localhost:${toString config.services.solr.port}/solr/docspell"; backend = "postgresql";
postgresql = { postgresql = {
pg-config = { pg-config = {
"german" = "my-germam"; "german" = "my-germam";
@ -24,7 +24,6 @@ in
services.docspell-joex = { services.docspell-joex = {
enable = true; enable = true;
waitForTarget = "solr-init.target";
bind.address = "0.0.0.0"; bind.address = "0.0.0.0";
base-url = "http://localhost:7878"; base-url = "http://localhost:7878";
jvmArgs = [ "-J-Xmx1536M" ]; jvmArgs = [ "-J-Xmx1536M" ];

View File

@ -2,6 +2,5 @@
{ {
imports = [ imports = [
./configuration-test.nix ./configuration-test.nix
./solr.nix
]; ];
} }

View File

@ -1,41 +0,0 @@
{ 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"
];
};
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";
};
}

8
nix/flake.lock generated
View File

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1673704454, "lastModified": 1706373441,
"narHash": "sha256-5Wdj1MgdOgn3+dMFIBtg+IAYZApjF8JzwLWDPieg0C4=", "narHash": "sha256-S1hbgNbVYhuY2L05OANWqmRzj4cElcbLuIkXTb69xkk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a83ed85c14fcf242653df6f4b0974b7e1c73c6c6", "rev": "56911ef3403a9318b7621ce745f5452fb9ef6867",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-22.11", "ref": "nixos-23.11",
"type": "indirect" "type": "indirect"
} }
}, },

View File

@ -1,7 +1,7 @@
{ {
description = "Docspell flake"; description = "Docspell flake";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11"; nixpkgs.url = "nixpkgs/nixos-23.11";
}; };
outputs = { self, nixpkgs }: outputs = { self, nixpkgs }:
@ -11,19 +11,19 @@
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
# Version config # Version config
cfg = { cfg = {
v0_40_0 = rec { v0_41_0 = rec {
version = "0.40.0"; version = "0.41.0";
server = { server = {
url = "https://github.com/eikek/docspell/releases/download/v${version}/docspell-restserver-${version}.zip"; url = "https://github.com/eikek/docspell/releases/download/v${version}/docspell-restserver-${version}.zip";
sha256 = "sha256-lTvLZ9MBezEhELr2LhrTtm2fRWxdLWEjAhOqxRmBwwg="; sha256 = "sha256-JFftIzI94UNLLh96I++qFsBZhOkquPIPhNhtS2Ov8wI=";
}; };
joex = { joex = {
url = "https://github.com/eikek/docspell/releases/download/v${version}/docspell-joex-${version}.zip"; url = "https://github.com/eikek/docspell/releases/download/v${version}/docspell-joex-${version}.zip";
sha256 = "sha256-lVDRl7CrRmojL7ZIPIlR6VzHoplEB/ew7aID3urYspU="; sha256 = "sha256-flKWjEsMd2/XT3Bu6EjFgf3lCojvLbKFDEXemP1K+/8=";
}; };
}; };
}; };
current_version = cfg.v0_40_0; current_version = cfg.v0_41_0;
inherit (current_version) version; inherit (current_version) version;
in in
rec rec
@ -76,7 +76,7 @@
default = (import nixpkgs { default = (import nixpkgs {
inherit system; inherit system;
overlays = [ self.overlays.default ]; overlays = [ self.overlays.default ];
}).docspell-server; }).docspell-joex;
}); });
checks = forAllSystems checks = forAllSystems