mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
Add a complete example for nixos
This commit is contained in:
parent
61bbdab8b5
commit
1c8a143623
@ -127,3 +127,108 @@ in
|
||||
Please see the `nix/module-server.nix` and `nix/module-joex.nix` files
|
||||
for the set of options. The nixos options are modelled after the
|
||||
default configuration file.
|
||||
|
||||
|
||||
## NixOs Example
|
||||
|
||||
This is a example system configuration that installs docspell with a
|
||||
postgres database. This snippet can be used to create a vm (using
|
||||
`nixos-rebuild build-vm` as shown above) or a container, for example.
|
||||
|
||||
``` nix
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
docspellsrc = builtins.fetchTarball "https://github.com/eikek/docspell/archive/master.tar.gz";
|
||||
docspell = import "${docspellsrc}/nix/release.nix";
|
||||
in
|
||||
{
|
||||
imports = docspell.modules;
|
||||
|
||||
nixpkgs = {
|
||||
config = {
|
||||
packageOverrides = pkgs:
|
||||
let
|
||||
callPackage = pkgs.lib.callPackageWith(custom // pkgs);
|
||||
custom = {
|
||||
docspell = callPackage docspell.currentPkg {};
|
||||
};
|
||||
in custom;
|
||||
};
|
||||
};
|
||||
|
||||
##### just for the example…
|
||||
users.users.root = {
|
||||
password = "root";
|
||||
};
|
||||
#####
|
||||
|
||||
# install docspell-joex and enable the systemd service
|
||||
services.docspell-joex = {
|
||||
enable = true;
|
||||
base-url = "http://localhost:7878";
|
||||
bind = {
|
||||
address = "0.0.0.0";
|
||||
port = 7878;
|
||||
};
|
||||
scheduler = {
|
||||
pool-size = 1;
|
||||
};
|
||||
jdbc = {
|
||||
url = "jdbc:postgresql://localhost:5432/docspell";
|
||||
user = "docspell";
|
||||
password = "docspell";
|
||||
};
|
||||
};
|
||||
|
||||
# install docspell-restserver and enable the systemd service
|
||||
services.docspell-restserver = {
|
||||
enable = true;
|
||||
base-url = "http://localhost:7880";
|
||||
bind = {
|
||||
address = "0.0.0.0";
|
||||
port = 7880;
|
||||
};
|
||||
auth = {
|
||||
server-secret = "b64:EirgaudMyNvWg4TvxVGxTu-fgtrto4ETz--Hk9Pv2o4=";
|
||||
};
|
||||
backend = {
|
||||
signup = {
|
||||
mode = "invite";
|
||||
new-invite-password = "dsinvite2";
|
||||
invite-time = "30 days";
|
||||
};
|
||||
jdbc = {
|
||||
url = "jdbc:postgresql://localhost:5432/docspell";
|
||||
user = "docspell";
|
||||
password = "docspell";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# install postgresql and initially create user/database
|
||||
services.postgresql =
|
||||
let
|
||||
pginit = pkgs.writeText "pginit.sql" ''
|
||||
CREATE USER docspell WITH PASSWORD 'docspell' LOGIN CREATEDB;
|
||||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO docspell;
|
||||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO docspell;
|
||||
CREATE DATABASE DOCSPELL OWNER 'docspell';
|
||||
'';
|
||||
in {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_11;
|
||||
enableTCPIP = true;
|
||||
initialScript = pginit;
|
||||
port = 5432;
|
||||
authentication = ''
|
||||
host all all 0.0.0.0/0 md5
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
networking = {
|
||||
hostName = "docspellexample";
|
||||
firewall.allowedTCPPorts = [7880];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user