Whoogle-Searh with mach-nix does not work

Hello All,

I’m trying to run whoogle-search on my NixOS server. Until now I used the docker image, which works reasonably well, but I would prefer to run it natively. I have tried to build it with mach-nix:

{ config, pkgs, ... }:
let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix";
    ref = "master";
  }) {
    pypiDataRev = "master";
    pypiDataSha256 = "06b9zg4lv9p6d4ynnlbwqi6xp2nn6vlrcwnx73902z53jsk0yifb";
  };
  whoogle-search = mach-nix.buildPythonPackage { 
    src = builtins.fetchGit {
      url = "https://github.com/benbusby/whoogle-search";
      ref = "main";
    };
  };    

in
{
environment.systemPackages = [
    whoogle-search
  ];
}

but it cannot be started because of the nix store being read-only:

Traceback (most recent call last):
  File "/nix/store/pgm69932d56f7hdj70g10ax5n6hyn3qh-python3.9-whoogle-search-0.7.1/bin/.whoogle-search-wrapped", line 6, in <module>
    from app.routes import run_app
  File "/nix/store/pgm69932d56f7hdj70g10ax5n6hyn3qh-python3.9-whoogle-search-0.7.1/lib/python3.9/site-packages/app/__init__.py", line 95, in <module>
    os.makedirs(app.config['CONFIG_PATH'])
  File "/nix/store/x24kxyqwqg2ln8kh9ky342kdcmhbng3h-python3-3.9.9/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/nix/store/pgm69932d56f7hdj70g10ax5n6hyn3qh-python3.9-whoogle-search-0.7.1/lib/python3.9/site-packages/app/static/config'

Can i work around this error somehow?

Thanks in advance.

Seems you can set CONFIG_VOLUME to change that path: https://github.com/benbusby/whoogle-search/blob/23402e27e185c67f446179543a73694dc37f58ad/app/init.py#L59

It’s not documented, perhaps ask about it upstream and mention that writing to the application directory is an anti-pattern even outside of nix land, it makes backups and asserting binary immutability much harder - maybe they can phase out this default.