-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
base: master
Are you sure you want to change the base?
Conversation
5c181c1
to
075a1da
Compare
ca8014b
to
075a1da
Compare
There was a problem hiding this 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" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT |
This information can be found in meta.license
already.
There was a problem hiding this comment.
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.
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} ]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
./eps_raster_print-cast.patch | ||
./include-raster-helper.patch |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
fixeserror: passing argument 5 of ‘eps_raster_print’ from incompatible pointer type
in fileraster_to_epson.c
-
include-raster-helper.patch
fixeserror: implicit declaration of function
in filespagemanager.c
andraster_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).
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
if stdenv.system == "x86_64-linux" then | ||
"lib64" | ||
else if stdenv.system == "i686_linux" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
)
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))
|
The former. We're keeping the |
Proprietary CUPS drivers for Epson inkjet printers. This printer driver is supporting the following printers:
Things done
passthru.tests
.nixpkgs-review
on this PR. See nixpkgs-review usage../result/bin/
.Add a 👍 reaction to pull requests you find important.