Unable to install paperless-ngx

Hey!

I am pretty new to nix and NixOS. My first project is to host some things on a NUC at home. One of those things is paperless. A module for paperless exists so I decided to use that.

When enabling paperless with services.paperless.enable = true; and starting my deployment with colmena apply --on example for some reason it tries to build libdecor-0.1.0 and fails:

$ colmena apply --on example --verbose
[INFO ] Using configuration: /home/bl1nk/src/github.com/bl1nk/nixos-config/hive.nix
[INFO ] Enumerating nodes...
[INFO ] Selected 1 out of 3 hosts.
example | Evaluating example
example | Evaluated example
example | Building example
example | these 47 derivations will be built:
example |   /nix/store/bwivlyd52l9v3vnqhzcm6304x9g99qpm-nginx.conf.drv
example |   /nix/store/pl8ppi30nav196y3s94ngqrnjvac1z1i-unit-script-nginx-pre-start.drv
example |   /nix/store/05zlmmzh8r2l82xnhyljc4wwkr0ln2kf-unit-nginx.service.drv
example |   /nix/store/34zb0g1z7i4hj1ql90m9cvl0fch5ajsn-python3.9-python-gnupg-0.4.8.drv
example |   /nix/store/lnhnhgv3rr90crh3am51idkbjk2fixlr-mplsetup.cfg.drv
example |   /nix/store/m1s3jcpk5zmzxgizpgsfk3mkga1m4w22-python3.9-matplotlib-3.5.2.drv
example |   /nix/store/zqbd8jnn9c20pa0ivbb4ain8pklsbbj8-python3.9-numpydoc-1.2.1.drv
example |   /nix/store/ycfs9sna4p6xfc4vmh3zwfn2vjz8rjp4-python3.9-joblib-1.1.0.drv
example |   /nix/store/543bpp2g59ydfnxxnykprskmj6xklzks-python3.9-scikit-learn-1.0.2.drv
example |   /nix/store/sknfnqaira8m1jg87h45f9lhkxy4s00p-mupdf.desktop.drv
example |   /nix/store/2v0qwc2awwhcs8kyyp8yslkms9ysmg0w-mupdf-1.19.0.drv
example |   /nix/store/jlr1md1vv133ym9qq011w5bqsl1s11nj-poppler-utils-22.06.0.drv
example |   /nix/store/fjsgrn6lh0i71hfww3hrkc5hszvz2fzi-librsvg-2.54.4.drv
example |   /nix/store/8n4wxja9rg0k4qagdrfi31gf9r9hfax7-djvulibre-3.5.28.drv
example |   /nix/store/9sv79ai1vkm8h6mjvq4pdsj743x25ayh-libjxl-0.6.1.drv
example |   /nix/store/l9si2dkv0m2yjmi09rfgxphxxrjgrivh-imagemagick-7.1.0-39.drv
example |   /nix/store/q3yx29l7wdymg0fkmh5bmvb4yngh84xj-paths.patch.drv
example |   /nix/store/q8x910v0xj6qrx2rmcfyn9lnhab6agnc-python3.9-pikepdf-5.1.3.drv
example |   /nix/store/c764m69pmi6b5513az805x4x2vh41js2-python3.9-img2pdf-0.4.4.drv
example |   /nix/store/hhrin2y6ki0v4s3pyh09jv7fmbx6h9h4-tesseract-4.1.1.drv
example |   /nix/store/f6dq88rhgjd0mrddrpb9753jclsr142j-tesseract-4.1.1.drv
example |   /nix/store/drdpylm1mrsqhp69p4pdqavdmfwkamhq-libdecor-0.1.0.drv
example |   /nix/store/icsz29v59mr1yym0xvrg0rvzch76cc1x-SDL2-2.0.20.drv
example |   /nix/store/d20qilvg2gfxwdl1bbp92l79cb1m5a0q-ffmpeg-4.4.1.drv
example |   /nix/store/rd3y78jv111yxwmnq165dxfgbr1sh4n0-pipewire-0.3.51.drv
example |   /nix/store/gfl5k9dzrrf4ydwd8k1xawmr70n24igz-SDL2-2.0.20.drv
example |   /nix/store/g5kv475c1g93c9g6b8y90gp5w5ak9n3f-ffmpeg-4.4.1.drv
example |   /nix/store/ij6xi3xxz09fls2a1hzg3d8gk6939yi1-unpaper-6.1.drv
example |   /nix/store/qbva0hfg1g47cgj4cz8vmh9gqfcfzrj1-paths.patch.drv
example |   /nix/store/yb4372wal6131c12p198mi3qixfk5fks-python3.9-ocrmypdf-13.4.4.drv
example |   /nix/store/jb81q42ybyl3jdfipakybiwcvlvfz689-paperless-ngx-1.6.0.drv
example |   /nix/store/0zidq20cx15k3l6n1b08gjby0wjwwp0q-unit-paperless-consumer.service.drv
example |   /nix/store/1m4c2bpw08gmj605vbgcnybi2gabf98k-unit-paperless-web.service.drv
example |   /nix/store/38vyi0fbb3cazn8c880195dz7vl78rik-redis.conf.drv
example |   /nix/store/b6dyyc68aamxlscvrgh2cidmxcg62h0p-unit-systemd-fsck-.service.drv
example |   /nix/store/h30hjwdb21ykdz656578a3460imkwhd3-unit-polkit.service.drv
example |   /nix/store/hh4p094qrk320ndsczbqn216yynyzg0h-unit-systemd-sysctl.service.drv
example |   /nix/store/sjax7d480vry6b49wlxpffsxpc3cdypw-unit-dbus.service.drv
example |   /nix/store/6nk5108p9lammpq1chlnk93avilza3w2-redis-paperless-credentials.drv
example |   /nix/store/wqk8bfxynlzm7086qr3p8j29higrcv9h-unit-redis-paperless.service.drv
example |   /nix/store/834nnhkwa0lzvkmc2h2xgvz246fb4dkh-manage.drv
example |   /nix/store/h3zclxd2yk8ab0l2wxpwqgbpd8qrnydd-unit-script-paperless-scheduler-pre-start.drv
example |   /nix/store/ygc892z4jqbnd7wxkhi35ymadxa0f93q-unit-paperless-scheduler.service.drv
example |   /nix/store/d1cr1xsv6ln1hxf1bm6s27mggv46kyw5-system-units.drv
example |   /nix/store/z8jm8by8alir4ni7zvbx9sh42qgsvkgh-user-units.drv
example |   /nix/store/hzpzxxaxlhf6lqvjx17dm6f46qhzxj79-etc.drv
example |   /nix/store/4kmv13cry9snims5pgc2h85jz6xvirkg-nixos-system-example-22.05.1191.ccf8bdf7262.drv
example | building '/nix/store/z8jm8by8alir4ni7zvbx9sh42qgsvkgh-user-units.drv'...
example | building '/nix/store/drdpylm1mrsqhp69p4pdqavdmfwkamhq-libdecor-0.1.0.drv'...
example | unpacking sources
example | unpacking source archive /nix/store/pj8kla3kgs3w0fbcvhb7dvp7g2kjlj6a-source
example | source root is source
example | patching sources
example | configuring
example | meson flags: --buildtype=plain         --libdir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/lib --libexecdir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/libexec         --bindir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/bin --sbindir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/sbin         --includedir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/include         --mandir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/share/man --infodir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/share/info         --localedir=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0/share/locale         -Dauto_features=enabled         -Dwrap_mode=nodownload         --prefix=/nix/store/6aksx12g10kq8ay3aip0zgcm9r5b2z4j-libdecor-0.1.0
example | The Meson build system
example | Version: 0.61.2
example | Source dir: /build/source
example | Build dir: /build/source/build
example | Build type: native build
example | Project name: libdecor
example | Project version: 0.1.0
example | C compiler for the host machine: gcc (gcc 11.3.0 "gcc (GCC) 11.3.0")
example | C linker for the host machine: gcc ld.bfd 2.38
example | Host machine cpu family: x86_64
example | Host machine cpu: x86_64
example | Compiler for C supports arguments -Wno-unused-parameter: YES
example | Compiler for C supports arguments -Wno-missing-field-initializers: YES
example | Found pkg-config: /nix/store/szc9mx70l0lk32rbyixpq5mska4fzj61-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
example | Run-time dependency wayland-client found: YES 1.20.0
example | Run-time dependency wayland-protocols found: YES 1.25
example | Library dl found: YES
example | Run-time dependency dbus-1 found: YES 1.14.0
example | Checking for function "memfd_create" : YES
example | Checking for function "posix_fallocate" : YES
example | Checking for function "asprintf" : YES
example | Configuring config.h using configuration
example | Program wayland-scanner found: YES (/nix/store/sly7wm6a65lpm2a46rmzd20af0faafyq-wayland-1.20.0-bin/bin/wayland-scanner)
example | Run-time dependency cairo found: YES 1.16.0
example | Run-time dependency pangocairo found: YES 1.50.7
example | Run-time dependency wayland-cursor found: YES 1.20.0
example | Library m found: YES
example | C++ compiler for the host machine: g++ (gcc 11.3.0 "g++ (GCC) 11.3.0")
example | C++ linker for the host machine: g++ ld.bfd 2.38
example | Dependency wayland-cursor found: YES 1.20.0 (cached)
example | Library m found: YES
example | Did not find CMake 'cmake'
example | Found CMake: NO
example | Run-time dependency egl found: NO (tried pkgconfig)
example |
example | demo/meson.build:7:0: ERROR: Dependency "egl" not found, tried pkgconfig
example |
example | A full log can be found at /build/source/build/meson-logs/meson-log.txt
example | error: builder for '/nix/store/drdpylm1mrsqhp69p4pdqavdmfwkamhq-libdecor-0.1.0.drv' failed with exit code 1
example | error: 1 dependencies of derivation '/nix/store/gfl5k9dzrrf4ydwd8k1xawmr70n24igz-SDL2-2.0.20.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/g5kv475c1g93c9g6b8y90gp5w5ak9n3f-ffmpeg-4.4.1.drv' failed to build
example | building '/nix/store/9sv79ai1vkm8h6mjvq4pdsj743x25ayh-libjxl-0.6.1.drv'...
example | error: 1 dependencies of derivation '/nix/store/ij6xi3xxz09fls2a1hzg3d8gk6939yi1-unpaper-6.1.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/jb81q42ybyl3jdfipakybiwcvlvfz689-paperless-ngx-1.6.0.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/1m4c2bpw08gmj605vbgcnybi2gabf98k-unit-paperless-web.service.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/d1cr1xsv6ln1hxf1bm6s27mggv46kyw5-system-units.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/hzpzxxaxlhf6lqvjx17dm6f46qhzxj79-etc.drv' failed to build
example | error: 1 dependencies of derivation '/nix/store/4kmv13cry9snims5pgc2h85jz6xvirkg-nixos-system-example-22.05.1191.ccf8bdf7262.drv' failed to build
example | Build failed: Child process exited with error code: 100
      | Failed: Child process exited with error code: 100
[ERROR] Failed to build example - Last 20 lines of logs:
[ERROR]   stderr) Dependency wayland-cursor found: YES 1.20.0 (cached)
[ERROR]   stderr) Library m found: YES
[ERROR]   stderr) Did not find CMake 'cmake'
[ERROR]   stderr) Found CMake: NO
[ERROR]   stderr) Run-time dependency egl found: NO (tried pkgconfig)
[ERROR]   stderr)
[ERROR]   stderr) demo/meson.build:7:0: ERROR: Dependency "egl" not found, tried pkgconfig
[ERROR]   stderr)
[ERROR]   stderr) A full log can be found at /build/source/build/meson-logs/meson-log.txt
[ERROR]   stderr) error: builder for '/nix/store/drdpylm1mrsqhp69p4pdqavdmfwkamhq-libdecor-0.1.0.drv' failed with exit code 1
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/gfl5k9dzrrf4ydwd8k1xawmr70n24igz-SDL2-2.0.20.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/g5kv475c1g93c9g6b8y90gp5w5ak9n3f-ffmpeg-4.4.1.drv' failed to build
[ERROR]   stderr) building '/nix/store/9sv79ai1vkm8h6mjvq4pdsj743x25ayh-libjxl-0.6.1.drv'...
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/ij6xi3xxz09fls2a1hzg3d8gk6939yi1-unpaper-6.1.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/jb81q42ybyl3jdfipakybiwcvlvfz689-paperless-ngx-1.6.0.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/1m4c2bpw08gmj605vbgcnybi2gabf98k-unit-paperless-web.service.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/d1cr1xsv6ln1hxf1bm6s27mggv46kyw5-system-units.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/hzpzxxaxlhf6lqvjx17dm6f46qhzxj79-etc.drv' failed to build
[ERROR]   stderr) error: 1 dependencies of derivation '/nix/store/4kmv13cry9snims5pgc2h85jz6xvirkg-nixos-system-example-22.05.1191.ccf8bdf7262.drv' failed to build
[ERROR]  failure) Child process exited with error code: 100
[ERROR] Failed to complete requested operation - Last 1 lines of logs:
[ERROR]  failure) Child process exited with error code: 100
[ERROR] -----
[ERROR] Operation failed with error: Child process exited with error code: 100

Why does it not download paperless-ngx from the cache? I do not use any overlays as far as I can tell and I think paperless-ngx is successfully built by hydra and should be cached, right?

Also, am I right with the assumption that my build does not work because I’m running this on Windows with WSL? Unfortunately I also cannot run this on my Mac without setting up a Linux build machine in a VM or Docker.

For completeness I included my configuration here:

Configuration

I wrapped everything in my own module to, for now, also enable a nginx vhost.

# ./modules/paperless/default.nix
{ lib
, config
, ...
}:
with lib;
let cfg = config.my.paperless;
in
{
  options.my.paperless = {
    enable = mkEnableOption "Paperless";
    virtualHost = mkOption
      {
        type = types.string;
        default = "paperless.home.arpa";
      }
      };
    config = mkIf cfg.enable {
      services.paperless.enable = true;
      services.nginx.virtualHosts.virtualHost.locations."/".proxyPass = "http://127.0.0.1:${toString config.services.paperless.port}";
    };
  }

The machine configuration:

# ./machines/example.nix
{ config
, lib
, pkgs
, modulesPath
, ...
}:
{
  imports = [
    ../modules/paperless
  ];
  my.paperless.enable = true;
# ...
}

To roll out my configuration to the NUC I decided to use colmena, as it is stateless.

# ./hive.nix
let
  sources = import ./npins;
  nixos-stable = import sources.nixos-22_05;
in
{
  meta = {
    nixpkgs = nixos-stable;
  };
  example = { name, nodes, ... }: {
    deployment.targetHost = "192.168.10.35";
    imports = [ ./machines/example.nix ];
  };
}

I use npins to pin nixpkgs. Here is the ./npins/sources.json:

{
  "pins": {
    "nixos-22_05": {
      "type": "Channel",
      "name": "nixos-22.05",
      "url": "https://releases.nixos.org/nixos/22.05/nixos-22.05.1191.ccf8bdf7262/nixexprs.tar.xz",
      "hash": "14hgdbqyd13p8yfgaxqqcxgdvzgg6rpmklqsybzxp0rcj425c7zd"
    }
  },
  "version": 2
}

For that nixpkgs revision, I can substitute paperless-ngx(i.e. /nix/store/4nfyn9nfffnaj4njp2cdzwd74ji0c0cf-paperless-ngx-1.6.0) without any problems, but your build log shows different drv hashes than I get for that pin. Maybe something messes with nixpkgs in the configuration? A stale nixpkgs gets used somehow?

Had a similar issue when installing paperless-ngx recently. Do you have the minimal profile enabled on that machine or otherwise set environment.noXlibs = true;? This changes the derivation for libdecor because the cairo dependency changes, causing the build and subsequent failure. Try adding environment.noXlibs = false; to your system config, it fixed this for me.

1 Like

Thank you, that was it. :sweat_smile:

the following new units were started: paperless-consumer.service, paperless-scheduler.service, paperless-web.service, redis-paperless.service

Can we just remove that option? I don’t even want to know how many hours I myself and we all togheter already wasted with it and the benefits are just a few Megabytes.

Not sure if we can remove that option altogether. But I am considering adding a Warning or an Assert to the Paperless module since this trap seems to be pretty easy to step into.

Then we would need to add many many warnings. The main problem right now is, that containers get the setting by default and often people don’t even know that. I think we should at least remove it from containers.