Skip to content

Conversation

MatthewCroughan
Copy link
Contributor

Things done

It's an attempt, and I'd like to figure out a better way to package this, and avoid what I'm doing in the preBuild phase.

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@MatthewCroughan MatthewCroughan force-pushed the mc/piper1-gpl branch 2 times, most recently from 3155029 to a5946e7 Compare July 15, 2025 16:18
@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. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jul 15, 2025

patches = [ ./patch ];

preBuild = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runHook prebuild/postbuild missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does that work when this is already preBuild?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does that work when this is already preBuild?

Oh, my bad, that makes no sense here 😅. Disregard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always feel weird about using preBuild anyway. Doesn't that mean that if someone overrideAttrs this derivation, they can't set their own preBuild?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw @bloxx12, I just wanted to say thank you for your fantastic reviews and stamina! I've been very happy implementing your suggestions, etc and it's really fast. Thanks so much.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always feel weird about using preBuild anyway. Doesn't that mean that if someone overrideAttrs this derivation, they can't set their own preBuild?

No, that should still work.

patches = [ ./patch ];

preBuild = ''
cd /build/source
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume /build/src is the same as $src? If so, why not $src?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/build/source is not the same as $src, I don't know why, something to do with hooks and python, IDK.

Comment on lines +49 to +52
pythonImportsCheck = [
"piper"
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure if mkPythonApplication doesen't run this anyways, but it could definitely be. mkPythonDerivation does have it, but for mkPythonApplication the wiki is not quite clear.

@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 15, 2025
wheel
];

patches = [ ./patch ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a better name: how about ./prevent-download.patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed thanks

description = "Fast and local neural text-to-speech engine";
homepage = "https://github.com/OHF-Voice/piper1-gpl";
changelog = "https://github.com/OHF-Voice/piper1-gpl/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.gpl3Only;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing required meta.platforms field

@normalcea
Copy link
Contributor

This package does not build successfully

nixpkgs-review result for #425484

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 425484

Logs: https://github.com/normalcea/nixpkgs-review-gha/actions/runs/16300960385


x86_64-linux

✅ 2 packages built:
  • piper1-gpl
  • piper1-gpl.dist

aarch64-linux

❌ 2 packages failed to build:
  • piper1-gpl
  • piper1-gpl.dist

Error logs: `aarch64-linux`
piper1-gpl
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2jwwbi4n4yn3ajwx9nzh514i7wf5kdr4-python3.13-scikit-build-0.18.1/lib/python3.13/site-packages/skbuild/cmaker.py", line 696, in make
    self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/2jwwbi4n4yn3ajwx9nzh514i7wf5kdr4-python3.13-scikit-build-0.18.1/lib/python3.13/site-packages/skbuild/cmaker.py", line 741, in make_impl
    raise SKBuildError(msg)

An error occurred while building with CMake.
Command:
/nix/store/8w75y8pjpwx0lyp1jswscsarp5qzyylj-cmake-3.31.7/bin/cmake --build . --target install --config Release --
Install target:
install
Source directory:
/build/source
Working directory:
/build/source/_skbuild/linux-aarch64-3.13/cmake-build
Please check the install target is valid and see CMake's output for more information.

ERROR Backend subprocess exited when trying to invoke build_wheel


x86_64-darwin (sandbox = true)

❌ 2 packages failed to build:
  • piper1-gpl
  • piper1-gpl.dist

Error logs: `x86_64-darwin`
piper1-gpl
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DOCDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_INFODIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_LOCALEDIR
    CMAKE_INSTALL_MANDIR
    CMAKE_INSTALL_SBINDIR
    CMAKE_POLICY_DEFAULT_CMP0025

-- Build files have been written to: /nix/build/nix-build-piper1-gpl-1.3.0.drv-0/source/build
cmake: enabled parallel building
cmake: enabled parallel installing
configurePhase completed in 31 seconds
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
Executing pypaBuildPhase
/nix/store/k4r2ipc55qrgdf3mc60v4i4qa86rlayh-stdenv-darwin/setup: line 277: cd: /build/source: No such file or directory


aarch64-darwin (sandbox = true)

❌ 2 packages failed to build:
  • piper1-gpl
  • piper1-gpl.dist

Error logs: `aarch64-darwin`
piper1-gpl
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_INSTALL_BINDIR
    CMAKE_INSTALL_DOCDIR
    CMAKE_INSTALL_INCLUDEDIR
    CMAKE_INSTALL_INFODIR
    CMAKE_INSTALL_LIBDIR
    CMAKE_INSTALL_LIBEXECDIR
    CMAKE_INSTALL_LOCALEDIR
    CMAKE_INSTALL_MANDIR
    CMAKE_INSTALL_SBINDIR
    CMAKE_POLICY_DEFAULT_CMP0025

-- Build files have been written to: /nix/build/nix-build-piper1-gpl-1.3.0.drv-0/source/build
cmake: enabled parallel building
cmake: enabled parallel installing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
Executing pypaBuildPhase
/nix/store/8ncahfy2083zkv8rgmzzndpdqj3yxq2a-stdenv-darwin/setup: line 277: cd: /build/source: No such file or directory

sonic,
}:
let
espeak-ng-src = fetchFromGitHub {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any news on when they'll make a new release with CMake as the build system? The best case scenario is that we can wait for a new release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, but I don't mind waiting.

@faukah
Copy link
Contributor

faukah commented Jul 15, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 425484
Commit: a5946e772fabb27868f92e450a373b0dcf32e907


x86_64-linux

✅ 2 packages built:
  • piper1-gpl
  • piper1-gpl.dist

@normalcea
Copy link
Contributor

normalcea commented Jul 15, 2025

 preBuild = ''
    cd /build/source
    mkdir -p /build/source/_skbuild/linux-x86_64-3.13/cmake-build/espeak_ng/src
    cp -r ${espeak-ng-src} /build/source/_skbuild/linux-x86_64-3.13/cmake-build/espeak_ng/src/espeak_ng_external
  '';

The issue is that this is very hardcoded, this package should just support all the platforms that espeak supports but it doesn't due to needing a currently unstable source of espeak that unfortunately isn't trivially overridable with the derivation we have in nixpkgs.

Additionally, this can go in the postConfigure phase rather than preBuild

I think we'll just need to create a full espeak-ng unstable derivation and not just the src fetcher output.

@MatthewCroughan
Copy link
Contributor Author

@normalcea The main issue is actually the ExternalProject_Add function in the CMakeLists.txt, which forces me to need to hardcode these values, unlike FetchContent, which would allow me to override it nicely. Even if this espeak was stable, I would still need to do this hardcoding for as long as ExternalProject_Add is being used.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. labels Jul 15, 2025
@normalcea
Copy link
Contributor

normalcea commented Jul 15, 2025

This sounds like something upstream should be informed of to make it easier for downstream distributors.

Otherwise we'd have to maintain a patch then for that.

@MatthewCroughan
Copy link
Contributor Author

@normalcea If you have the energy for that, then go ahead, I do not. The patch is relatively small.

@MatthewCroughan
Copy link
Contributor Author

@normalcea seems like they won't cut a new release of espeak-ng for a long time, so is this blocking this PR or not?

@normalcea
Copy link
Contributor

normalcea commented Aug 21, 2025

The issue is in how the espeak-ng workaround requires hardcoding both the architecture platform and the python version.

  postConfigure = ''
    cd /build/source
    mkdir -p /build/source/_skbuild/linux-x86_64-3.13/cmake-build/espeak_ng/src
    cp -r ${espeak-ng-src} /build/source/_skbuild/linux-x86_64-3.13/cmake-build/espeak_ng/src/espeak_ng_external
  '';

This should be done in a way that doesn't hardcode both of these values within a package phase since this will cease to work once in future versions of Python in nixpkgs and ARM support is absent.

I haven't looked at this PR in a while, but I imagine the solution would be to create a espeak-ng override using one of the latest commits to get around the old release in nixpkgs.

Also, the meta.maintainers attribute needs to have at least one maintainer attribute from maintainers/maintainer-list.nix this is a hard blocker. Make sure to add yourself there if you haven't already and add yourself here or find another maintainer willing to put their name here; I am not that maintainer.

# ...
    maintainers = with lib.maintainers; [ ];
# ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants