Skip to content
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

pkgs/misc/cups/drivers: add brother mfcl3770cdw #55531

Merged
merged 1 commit into from Jan 25, 2020

Conversation

steveej
Copy link
Contributor

@steveej steveej commented Feb 10, 2019

This adds the printer driver for the Brother MFCL3770CDW.
It combines the cups-wrapper and the driver in one file which allows
sharing common variables and making it less error-prone than the other
Brother drivers in repository.

I volunteer for maintaining this one as long as I've got the model
around.

Motivation for this change

New driver for new hardware.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@samueldr
Copy link
Member

samueldr commented Feb 10, 2019

Hi!

Quick question / heads-up, depending: does your printer driver hard-code some settings, e.g. page size to A4? See #53027 and a discourse post.

My Brother printer's driver, and a couple other user's is seemingly disregarding the settings set in the print. As far as I was concerned, this was hard to spot until I realized what was going on.

Thanks.

(Additionally, looks like there's a merge conflict.)

@steveej steveej force-pushed the pr/cups-driver-mfcl3770cdw branch 3 times, most recently from 65e9569 to b077355 Compare February 10, 2019 19:04
@steveej
Copy link
Contributor Author

steveej commented Feb 13, 2019

@samueldr It seems to be the case here too. I have tried to print on portrait A5 (A4 split in half) and the result was as if the paper was A4. Are you suggesting to block this PR on that issue?

@samueldr
Copy link
Member

@steveej since a bunch of the drivers in Nixpkgs already share the flaw I wouldn't block.

Though it would be nice to get a taskforce (1) looking at and fixing the issue (2) making a brother driver helper/builder that handles the common formats; after all it seems that they are generally similar when close in age.

@steveej
Copy link
Contributor Author

steveej commented Feb 13, 2019

@samueldr Alright, I will take a stab at it eventually. Can't be that bad to debug a CUPS issue 🙃

WRT this PR, CI should turn green now.

Copy link
Member

@samueldr samueldr left a 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 if the "callPackage an expression returning an attrset" is frowned upon in that kind of situation, but I don't personally see anything wrong with it.

Other than the nits and changes asked, seems good.

pkgs/misc/cups/drivers/brother/mfcl3770cdw/default.nix Outdated Show resolved Hide resolved
pkgs/misc/cups/drivers/brother/mfcl3770cdw/default.nix Outdated Show resolved Hide resolved
pkgs/misc/cups/drivers/brother/mfcl3770cdw/default.nix Outdated Show resolved Hide resolved
@steveej steveej force-pushed the pr/cups-driver-mfcl3770cdw branch 4 times, most recently from 46a7074 to 9e70c26 Compare May 4, 2019 17:27
@veprbl
Copy link
Member

veprbl commented Sep 20, 2019

I believe this driver needs to follow the same form as mfcl2740dwlpr/mfcl2740dwcupswrapper and mfcl8690cdwlpr/mfcl8690cdwcupswrapper. If we later need to do the refactoring, we do it to all drivers at once.

Having said that, I see that the mentioned drivers set interpreter path in this way:

interpreter=${pkgs.pkgsi686Linux.glibc}/lib/ld-linux.so.2

interpreter=${pkgs.pkgsi686Linux.glibc}/lib/ld-linux.so.2

So I believe that solving issue raised in #55531 (comment) is not required to merge this PR.

I propose we do the simple refactoring and merge this.

This adds the printer driver for the Brother MFCL3770CDW.
It combines the cups-wrapper and the driver in one file which allows
sharing common variables and making it less error-prone than the other
Brother drivers in repository.

I volunteer for maintaining this one as long as I've got the model
around.
@steveej
Copy link
Contributor Author

steveej commented Jan 6, 2020

I believe this driver needs to follow the same form as mfcl2740dwlpr/mfcl2740dwcupswrapper and mfcl8690cdwlpr/mfcl8690cdwcupswrapper. If we later need to do the refactoring, we do it to all drivers at once.

While I'm aware that this PR takes a different approach I don't agree that it needs to follow the existing one. A further refactor could take this one as an example, or unify all of them to an even different one.

@veprbl
Copy link
Member

veprbl commented Jan 6, 2020

@steveej In your approach you bind driver attribute into your implementation of cupswrapper (see line 66), so one will not be able override the cupswrapper with a different driver. I don't know why you disagree with the current approach, but at least it provides a way override things using the .override provided by the callPackage.

@steveej
Copy link
Contributor Author

steveej commented Jan 7, 2020

@veprbl Making driver overrideable is a good suggestion, thanks! I think it's not a difficult change to add here. The approach is motivated by trying to minimize redundancy between the driver and the wrapper.

@steveej
Copy link
Contributor Author

steveej commented Jan 19, 2020

@samueldr please take a look at the changes I made recently, and see if your comments are addressed appropriately.

Copy link
Member

@samueldr samueldr left a comment

Choose a reason for hiding this comment

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

As far as what I assked, it looks fine.

I assume this was tested at every step by yourself, as obviously not many users will have that particular printer :).

@steveej
Copy link
Contributor Author

steveej commented Jan 19, 2020

@samueldr

I assume this was tested at every step by yourself, as obviously not many users will have that particular printer :).

I've been using the printer on my system and it works OK, besides the side-effects you've mentioned in #55531 (comment) already. It's not bad enough to really debug the issue though.

@steveej
Copy link
Contributor Author

steveej commented Jan 25, 2020

@samueldr I don't have merge access, would you mind merging this as you've approved it? Or are you waiting for another maintainer to double-check?

unpackPhase = "dpkg-deb -x $src $out";

installPhase = ''
basedir=${driver}/${reldir}
Copy link
Member

Choose a reason for hiding this comment

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

Here is a way to improve overridability:

inherit driver;
installPhase = ''
  basedir="$driver/${reldir}"

@samueldr samueldr merged commit 300ee28 into NixOS:master Jan 25, 2020
@steveej steveej deleted the pr/cups-driver-mfcl3770cdw branch January 30, 2020 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants