diff --git a/nix/module.nix b/nix/module.nix index 7565f68..8b5ee71 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -70,6 +70,16 @@ in default = false; description = "Whether to upload to the integration endpoint."; }; + header-file = mkOption { + type = types.nullOr types.path; + default = null; + description = "A file containing the `header:value` pair for the integration endpoint."; + }; + basic-file = mkOption { + type = types.nullOr types.path; + default = null; + description = "A file containing the `user:password` pair for the integration endpoint."; + }; header = mkOption { type = types.nullOr types.str; default = null; @@ -116,16 +126,15 @@ in args = (if cfg.recursive then [ "-r" ] else [ ]) ++ (if cfg.delete-files then [ "--delete" ] else [ ]) ++ (if cfg.integration-endpoint.enabled then [ "-i" ] else [ ]) ++ - (if cfg.integration-endpoint.header != null - then - [ "--header" "'${cfg.integration-endpoint.header}'" ] - else - [ ]) ++ - (if cfg.integration-endpoint.basic != null - then - [ "--basic" "'${cfg.integration-endpoint.basic}'" ] - else - [ ]) ++ + (if cfg.integration-endpoint.header-file != null + then [ "--header-file" "'${cfg.integration-endpoint.header-file}'" ] + else if cfg.integration-endpoint.basic-file != null + then [ "--basic-file" "'${cfg.integration-endpoint.basic-file}'" ] + else if cfg.integration-endpoint.header != null + then [ "--header" "'${cfg.integration-endpoint.header}'" ] + else if cfg.integration-endpoint.basic != null + then [ "--basic" "'${cfg.integration-endpoint.basic}'" ] + else [ ]) ++ (if cfg.include-filter != null then [ "--matches" "'${toString cfg.include-filter}'" ] else [ ]) ++ diff --git a/nix/nixosConfigurations/default.nix b/nix/nixosConfigurations/default.nix index 3b38fbe..1b53de9 100644 --- a/nix/nixosConfigurations/default.nix +++ b/nix/nixosConfigurations/default.nix @@ -2,7 +2,7 @@ let full-text-search = { enabled = true; - solr.url = "http://localhost:${toString config.services.solr.port}/solr/docspell"; + backend = "postgresql"; postgresql = { pg-config = { "german" = "my-germam"; @@ -43,7 +43,7 @@ in # Docspell { from = "host"; host.port = 64080; guest.port = 7880; } ]; - system.stateVersion = "22.11"; + system.stateVersion = "23.11"; # This slows down the build of a vm documentation.enable = false; @@ -64,16 +64,20 @@ in watchDir # Note, dsc expects files to be in a subdirectory corresponding to a collective. There is no way to declaratively create a collective as of the time of writing ]; integration-endpoint = + let + headerFile = pkgs.writeText "int-header-file" '' + Docspell-Integration:${integrationHeaderValue} + ''; + in { enabled = true; - header = "Docspell-Integration:${integrationHeaderValue}"; + header-file = headerFile; }; }; # Docspell service configuration and its requirements services.docspell-joex = { enable = true; - waitForTarget = "solr-init.target"; bind.address = "0.0.0.0"; base-url = "http://localhost:7878"; jvmArgs = [ "-J-Xmx1536M" ]; @@ -108,40 +112,4 @@ in }; }; }; - 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"; - }; - - }