Skip to content

Add package epson-workforce-840-series #428670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

heichro
Copy link

@heichro heichro commented Jul 26, 2025

Proprietary CUPS drivers for Epson inkjet printers. This printer driver is supporting the following printers:

  • Epson Stylus Office BX925
  • Epson WorkForce 840

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 12.first-time contribution This PR is the author's first one; please be gentle! 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Jul 26, 2025
@heichro heichro force-pushed the add-epson-workforce-840-series branch from 5c181c1 to 075a1da Compare July 27, 2025 06:24
@nixpkgs-ci nixpkgs-ci bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 27, 2025
@heichro heichro force-pushed the add-epson-workforce-840-series branch from ca8014b to 075a1da Compare July 28, 2025 17:32
Copy link
Contributor

@SigmaSquadron SigmaSquadron left a comment

Choose a reason for hiding this comment

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

Welcome to Nixpkgs! Thanks for packaging this software.

Please review our Commit Conventions and reword your commits appropriately; their titles must follow very specific patterns as defined in our documentation. Don't forget to squash your intermediate/fixup commits.

I've left some additional review comments below.

# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
"https://web.archive.org/web/https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are fetching from the web archive? The Epson link is versioned and seems fine?

Copy link
Author

Choose a reason for hiding this comment

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

It's been a while since I started developing this derivation and had been using it locally for quite some time without any problems.
But sometime in 2024, the Epson link returned a 403 error when accessed without a browser.
In September 2024, I then asked for help in the chat (just for the sake of completeness, here is the link: https://matrix.to/#/!RRerllqmbATpmbJgCn:nixos.org/$UlvZEGmFxF4bEMX2x68dl_0NKQcYNeNMkrLEacxbe88?via=lossy.network&via=matrix.org&via=tchncs.de) and was given the advice to add and use the archive.org link.
Currently, the Epson link does not seem to generate a 403 error, but I will check again.

Can I just leave both links there? The hash is the same, if I'm not mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see. Please add a comment saying the EPSON link may be unreliable, but you can leave both links.

driver = "epson-inkjet-printer-workforce-840-series-1.0.0";
};
in
stdenv.mkDerivation rec {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {

Nit: stdenv.mkDerivation supports a new pattern for recursively accessing its own values. Switching to that pattern will avoid some common pitfalls regarding recursive attribute sets. You'll then be able to access this derivation's values by prefixing them with finalAttrs, like this:

{
  tag = "v${finalAttrs.version}"
}

Don't forget the closing parenthesis at the end of the file.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. It's been a while since I started developing this derivation and had been using it locally for quite some time.
I've changed it as suggested and am now using the new pattern.

Epson Stylus Office BX925
Epson WorkForce 840

License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT

This information can be found in meta.license already.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I've changed it as suggested.

Comment on lines +100 to +109
Epson Stylus Office BX925
Epson WorkForce 840

License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT

To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.${pname} ];
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Epson Stylus Office BX925
Epson WorkForce 840
License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.${pname} ];
};
- Epson Stylus Office BX925
- Epson WorkForce 840
To use the driver adjust your `configuration.nix` file:
```nix
{
services.printing = {
enable = true;
drivers = [ pkgs.${pname} ];
};
}
```

Markdown is supported!

Copy link
Author

Choose a reason for hiding this comment

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

Good to know. I've changed it as suggested.

src = fetchurl {
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-workforce-840-series-${finalAttrs.version}-1lsb3.2.src.rpm"

Avoid interpolating the pname attribute. Ideally, a downstream user can change the pname attribute using overrideAttrs without altering the output of the derivation in any way.

Please also remove other uses of pname in the rest of the derivation.

Copy link
Author

Choose a reason for hiding this comment

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

Good to know and thank you for pointing that out. I have removed all other uses of pname as suggested.
That surely also applies to the use of pname at the end of meta.longDescription, where it says drivers = [...];. Is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the pname is epson-inkjet-printer-workforce-840-series, could this be moved to pkgs/by-name/ep/epson-inkjet-printer-workforce-840-series/package.nix?

Copy link
Author

Choose a reason for hiding this comment

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

Oh yes, that's right.

Somehow I got a little confused: All other Epson drivers in pkgs/by-name/ep/ seem to have removed the inkjet-printer part from the pname and used pkgs/by-name/ep/epson-foobar/ and not pkgs/by-name/ep/epson-inkjet-printer-foobar/, so I also used pkgs/by-name/epson-workforce-840-series/, but did not shorten the pname.

So, what is better? Leave the inkjet-printer part in the package name as in the rpm package or in the AUR package, or follow the other Epson nixpkgs derivations and choose epson-workforce-840-series as the pname?

Is there a guideline? A preferred naming scheme?

Thanks in advance.

Copy link
Contributor

Choose a reason for hiding this comment

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

The package naming guidelines state that pname should always follow upstream's naming scheme, and the attribute name should be identical to pname, unless pname is an invalid identifier in Nix.

The other packages are in the wrong. Keep inkjet-printer.

Comment on lines +53 to +54
./eps_raster_print-cast.patch
./include-raster-helper.patch
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add comments (either here or in the .patch files themselves) about what these patches are supposed to do, and what do they fix?

Copy link
Author

Choose a reason for hiding this comment

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

Both patches fix errors that occur when building with GCC 14.

  • eps_raster_print-cast.patch fixes error: passing argument 5 of ‘eps_raster_print’ from incompatible pointer type in file raster_to_epson.c

  • include-raster-helper.patch fixes error: implicit declaration of function in files pagemanager.c and raster_to_epson.c

Are there any guidelines for naming patches? A preferred naming scheme?

Is a comment with the above explanations about the patches in the derivation above the section patches = [...] okay? Or is a comment in the respective .patch file better? I guess it's a matter of taste.

I am currently unaware of whether and where the patches can be fetched from. Therefore, they are added to the Nixpkgs repository (the same patches are used by the epson-workforce-635-nx625-series package, which is where they come from).

Copy link
Contributor

Choose a reason for hiding this comment

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

Is a comment with the above explanations about the patches in the derivation above the section patches = [...] okay? Or is a comment in the respective .patch file better? I guess it's a matter of taste.

Either is fine; I'd prefer the former since you don't need to leave the .nix file to get all of the information needed.

I am currently unaware of whether and where the patches can be fetched from. Therefore, they are added to the Nixpkgs repository (the same patches are used by the epson-workforce-635-nx625-series package, which is where they come from).

Thankfully git is really good with deduplicating text, so it's fine to copy the patches. (and the comments in that package's package.nix file if there are any)

];

preConfigure = ''
chmod u+x configure
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be an issue caused by unpacking the tar files without preserving the permissions of the files contained within?

Copy link
Author

Choose a reason for hiding this comment

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

I don't know. All I can say is: When I started developing this derivation, I based it on the .spec file of the rpm package, the PKGBUILD of the AUR package, and, to a large extent, the nixpkgs derivation pkgs/by-name/ep/epson-workforce-635-nx625-series. I adopted the preConfigure part from the latter and never questioned it.

But it seems that it's not necessary at all. If I leave it out, the derivation still builds.

So that part will be removed.

Comment on lines +67 to +69
if stdenv.system == "x86_64-linux" then
"lib64"
else if stdenv.system == "i686_linux" then
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if stdenv.system == "x86_64-linux" then
"lib64"
else if stdenv.system == "i686_linux" then
if stdenv.hostPlatform == "x86_64-linux" then
"lib64"
else if stdenv.hostPlatform == "i686_linux" then

For cross-compilation reasons, use hostPlatform to figure out the platform we're trying to build this package for.

Copy link
Author

Choose a reason for hiding this comment

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

Good to know, and thanks for the tip.

When I look at stdenv.hostPlatform using nix repl, there are several possibilities: In addition to stdenv.hostPlatfom.system with a string as its value, i.e. “x86_64-linux” or “i868_linux”, which is checked for equality, there is also stdenv.hostPlatform.{isx86_64,isi686} with a boolean value of true/false.

Is it a matter of preference which one you use, or is one usually preferred over the other?

Copy link
Contributor

Choose a reason for hiding this comment

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

It depends on the situation. Some situations are better served with a string, others with a boolean. Up to you, but since this is an if statement, the isArch booleans should be more compact.

installPhase =
let
filterdir = "$out/cups/lib/filter";
docdir = "$out/share/doc";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
docdir = "$out/share/doc";
docdir = "$out/share/doc/epson-inkjet-printer-workforce-840-series";

Shoving generically-named files into $out/share/doc might cause conflicts with other packages when an Nix environment is built.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I will adjust the docdir accordingly.

Just so I understand: When I look at the PKGBUILD from the AUR package, the package name is part of the path to the documentation, since ${pkgname} is part of the path. When I look at the .spec file of the rpm package, the package name is part of the path to the documentation, although it is more difficult to recognize with %{buildroot}%{_docdir}, but %{buildroot} should in turn contain %{pkgtarname}-%{version}-%{release} as part of it. Is that correct?

And one more question for me to understand: With NixOS, by using $out, which already includes epson-inkjet-printer-workforce-840-series as part of the path in the store, is it still possible to have a conflict with documentation files of the same name from other packages? I'm just curious and eager to learn.

Thanks in advance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just so I understand: When I look at the PKGBUILD from the AUR package, the package name is part of the path to the documentation, since ${pkgname} is part of the path. When I look at the .spec file of the rpm package, the package name is part of the path to the documentation, although it is more difficult to recognize with %{buildroot}%{_docdir}, but %{buildroot} should in turn contain %{pkgtarname}-%{version}-%{release} as part of it. Is that correct?

I don't actually know; I'm not familiar with the specifics of RPM and PKGBUILD packaging.

With NixOS, by using $out, which already includes epson-inkjet-printer-workforce-840-series as part of the path in the store, is it still possible to have a conflict with documentation files of the same name from other packages? I'm just curious and eager to learn.

Not inside the store, thankfully; the hashed store paths prevent any conflicts. The issue happens when merging paths into a NixOS environment. The store paths are then stripped, and everything is combined inside a given directory so it can be used in the actual system. (usually /run/current-system)

@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Aug 9, 2025
@heichro
Copy link
Author

heichro commented Aug 13, 2025

Welcome to Nixpkgs! Thanks for packaging this software.

Please review our Commit Conventions and reword your commits appropriately; their titles must follow very specific patterns as defined in our documentation. Don't forget to squash your intermediate/fixup commits.

I've left some additional review comments below.

Thanks for reviewing and the kind reminder about the Commit Conventions.

Just to be sure: According to the conventions, the correct commit message should be as follows depending on the naming scheme chosen (see below, more specifically here #428670 (comment))

  • epson-inkjet-printer-workforce-840-series: init at 1.0.0 or
  • epson-workforce-840-series: init at 1.0.0

@SigmaSquadron
Copy link
Contributor

epson-inkjet-printer-workforce-840-series: init at 1.0.0

The former. We're keeping the inkjet-printer since that's what EPSON is calling them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 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. 12.first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants