Skip to content

Conversation

RatCornu
Copy link
Contributor

Updated szurubooru to latest bugfix and fixed a build issue caused by a breaking change introduced in python3.13.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jul 23, 2025
@nixpkgs-ci nixpkgs-ci bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 23, 2025
@kuflierl
Copy link
Member

kuflierl commented Aug 2, 2025

What the hell is up with szurubooru's dependency on pyheif? That has been broken for a while? How does this even work?

@danwdart
Copy link

danwdart commented Aug 5, 2025

Still getting the following here, just as before:

Aug 05 02:03:24 scorpii szurubooru-start[72812]: Traceback (most recent call last):
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/bin/.alembic-wrapped", line 9, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     sys.exit(main())
Aug 05 02:03:24 scorpii szurubooru-start[72812]:              ^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 636, in main
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     CommandLine(prog=prog).main(argv=argv)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 626, in main
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     self.run_cmd(cfg, options)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 603, in run_cmd
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     fn(
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/command.py", line 408, in upgrade
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     script.run_env()
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/script/base.py", line 586, in run_env
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     util.load_python_file(self.dir, "env.py")
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     module = load_module_py(module_id, path)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     spec.loader.exec_module(module)  # type: ignore
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "<frozen importlib._bootstrap_external>", line 999, in exec_module
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/h5fp4igl72mbgw7fqwzh29pgyf11ipsn-source/server/szurubooru/migrations/env.py", line 22, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     import szurubooru.config  # noqa: E402
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     ^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/h5fp4igl72mbgw7fqwzh29pgyf11ipsn-source/server/szurubooru/migrations/../../szurubooru/config.py", line 5, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     import yaml
Aug 05 02:03:24 scorpii szurubooru-start[72812]: ModuleNotFoundError: No module named 'yaml'

Do you know anything about that and/or is this supposed to cover it?
Thanks

@RatCornu
Copy link
Contributor Author

Still getting the following here, just as before:

Aug 05 02:03:24 scorpii szurubooru-start[72812]: Traceback (most recent call last):
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/bin/.alembic-wrapped", line 9, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     sys.exit(main())
Aug 05 02:03:24 scorpii szurubooru-start[72812]:              ^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 636, in main
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     CommandLine(prog=prog).main(argv=argv)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 626, in main
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     self.run_cmd(cfg, options)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/config.py", line 603, in run_cmd
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     fn(
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/command.py", line 408, in upgrade
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     script.run_env()
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/script/base.py", line 586, in run_env
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     util.load_python_file(self.dir, "env.py")
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     module = load_module_py(module_id, path)
Aug 05 02:03:24 scorpii szurubooru-start[72812]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/44f3l0ylsqzlvb1inbq07wv2ynm99x2l-python3.12-alembic-1.15.2/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     spec.loader.exec_module(module)  # type: ignore
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "<frozen importlib._bootstrap_external>", line 999, in exec_module
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/h5fp4igl72mbgw7fqwzh29pgyf11ipsn-source/server/szurubooru/migrations/env.py", line 22, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     import szurubooru.config  # noqa: E402
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     ^^^^^^^^^^^^^^^^^^^^^^^^
Aug 05 02:03:24 scorpii szurubooru-start[72812]:   File "/nix/store/h5fp4igl72mbgw7fqwzh29pgyf11ipsn-source/server/szurubooru/migrations/../../szurubooru/config.py", line 5, in <module>
Aug 05 02:03:24 scorpii szurubooru-start[72812]:     import yaml
Aug 05 02:03:24 scorpii szurubooru-start[72812]: ModuleNotFoundError: No module named 'yaml'

Do you know anything about that and/or is this supposed to cover it? Thanks

Hello, sorry for the late reply, I've checked and the tests succeed but it doesn't work when I'm starting it in a VM. I'll try to figure it out

@RatCornu
Copy link
Contributor Author

Ok I don't think I've changed anything in the last push, but it seems to work for me in a tests, VM and on production

@danwdart
Copy link

Strangely I'm still getting the above message when using plain "python3"...

@RatCornu
Copy link
Contributor Author

Could you share your config? In particular your flake with the commit it's pointed to (if you're using one) and the szurubooru config

@danwdart
Copy link

"Perhaps not having many python apps on my setup, means I don't automatically have the dependencies it might think it has" is what I would've said if this wasn't nixos...

@danwdart
Copy link

So I have this at the top of my configuration.nix:

pkgsSzuru = import (builtins.fetchTarball {
    url = "https://github.com/RatCornu/nixpkgs/archive/f07a87c1e56a3b83f65fb5f1a70d038130ee270c.tar.gz";
  }) {};

and then this in services:

szurubooru = {
    enable = true;
    server = {
      package = pkgsSzuru.szurubooru.server;
      settings = {
        name = "My Image Board";
        domain = "my-domain.example";
        secretFile = "${privateDir}/szuru/secret";
      };
      port = 9200;
    };
    database = {
      user = "szurubooru";
      port = 5432;
      name = "szuru";
      host = "localhost";
      passwordFile = "${privateDir}/szuru/dbpass";
    };
    client = {
      package = pkgsSzuru.szurubooru.client;
    };
  };

then in services.nginx:

"my-domain.example" = {
        # http3 = true;
        forceSSL = true;
        # # enableACME = true;
        useACMEHost = "theacmehost"
        serverAliases = [];
        extraConfig = ''
        '';
        listenAddresses = [
          "[::1]"
          "[${localIPv6}]"
          "[${globalIPv6}]"
          "[::]"
        ];
        locations = {
          "/api/" = {
            proxyPass = "http://localhost:9200/";
          };
          "/data/" = {
            root = "/var/lib/szurubooru";
          };
          "/" = {
            root = pkgs.szurubooru.client;
            tryFiles = "$uri /index.htm";
          };
        };
      };

and finally in security I added the domain into extraDomainNames in security.acme.certs.theacmehost
Have I done anything wrong?

@RatCornu
Copy link
Contributor Author

So I have this at the top of my configuration.nix:

pkgsSzuru = import (builtins.fetchTarball {
    url = "https://github.com/RatCornu/nixpkgs/archive/f07a87c1e56a3b83f65fb5f1a70d038130ee270c.tar.gz";
  }) {};

and then this in services:

szurubooru = {
    enable = true;
    server = {
      package = pkgsSzuru.szurubooru.server;
      settings = {
        name = "My Image Board";
        domain = "my-domain.example";
        secretFile = "${privateDir}/szuru/secret";
      };
      port = 9200;
    };
    database = {
      user = "szurubooru";
      port = 5432;
      name = "szuru";
      host = "localhost";
      passwordFile = "${privateDir}/szuru/dbpass";
    };
    client = {
      package = pkgsSzuru.szurubooru.client;
    };
  };

then in services.nginx:

"my-domain.example" = {
        # http3 = true;
        forceSSL = true;
        # # enableACME = true;
        useACMEHost = "theacmehost"
        serverAliases = [];
        extraConfig = ''
        '';
        listenAddresses = [
          "[::1]"
          "[${localIPv6}]"
          "[${globalIPv6}]"
          "[::]"
        ];
        locations = {
          "/api/" = {
            proxyPass = "http://localhost:9200/";
          };
          "/data/" = {
            root = "/var/lib/szurubooru";
          };
          "/" = {
            root = pkgs.szurubooru.client;
            tryFiles = "$uri /index.htm";
          };
        };
      };

and finally in security I added the domain into extraDomainNames in security.acme.certs.theacmehost Have I done anything wrong?

Oh okay it's normal you have the problem: you're only changing the version of the package, but the NixOS module I wrote some monthes ago uses a different version of python (the package uses 3.13 and the module 3.12), which causes the error. The easiest fix (if you do not pin your own nixpkgs) is to override the systemd service to use the patched version of it (the one of this PR)

@danwdart
Copy link

override the systemd service to use the patched version of it

That's what I think I'm doing by using .package = pkgsSzuru.szurubooru.server instead of .package = pkgs.szurubooru.server, by referring to the package imported by git rather than the global nixpkgs.

Is there anything additional I should be doing?

@RatCornu
Copy link
Contributor Author

RatCornu commented Aug 16, 2025

override the systemd service to use the patched version of it

That's what I think I'm doing by using .package = pkgsSzuru.szurubooru.server instead of .package = pkgs.szurubooru.server, by referring to the package imported by git rather than the global nixpkgs.

Is there anything additional I should be doing?

Yes: with this line, you only changed the version of the package szurubooru, but not the version of python used in the module services.szurubooru. To do so, here's a small patch you could add to your configuration:

let
  python = pkgs.python3;
  pyenv = python.buildEnv.override {
    extraLibs = [ (python.pkgs.toPythonModule cfg.server.package) ];
  };
in

{
  systemd.services.szurubooru = {
    environment = {
      PYTHONPATH =  lib.mkForce "${pyenv}/${pyenv.sitePackages}/";
    };
    
    path = lib.mkForce (
      with pkgs;
        [
          envsubst
          ffmpeg_4-full
        ]
       ++ (with python.pkgs; [
          alembic
          waitress
       ]));
  };
}

I didn't test it but I think it should work

@danwdart
Copy link

ooh I see thanks. Didn't expect that the package would need this too. I'll try that too thanks

@danwdart
Copy link

I ended up having to add some obvious packages like the following:

path = lib.mkForce (
        with pkgs;
          [
            coreutils-full
            envsubst
            ffmpeg_4-full
            gnused
          ]
        ++ (with python.pkgs; [
            alembic
            waitress
        ]));

but then it worked.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants