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

Declarative cups configuration #52776

Closed
memberbetty opened this issue Dec 24, 2018 · 6 comments · Fixed by #55510
Closed

Declarative cups configuration #52776

memberbetty opened this issue Dec 24, 2018 · 6 comments · Fixed by #55510
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: user experience

Comments

@memberbetty
Copy link
Contributor

Issue description

Allow configuration of a cups printer by pointing at a ppd file and specifying a single URL in configuration.nix.

Currently, such configuration requires clicking through a web-interface.

Technical details

18.09

@veprbl veprbl added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: user experience labels Dec 24, 2018
@makefu
Copy link
Contributor

makefu commented Jan 20, 2019

I actually ran into problems with the imperative configuration. I configured my printer (samsung scx3200) and after a system upgrade i was unable to print anymore. An error was shown in the cups web interface for the printer: "unable to load PPD, /nix/store/.... no such file or directory". It looks like the driver i used was garbage-collected.
That would not happen with a declarative configuration. However i am certain that this module is no easy piece of work because it requires deep insight into how cups works.

@Mic92
Copy link
Member

Mic92 commented Jan 21, 2019

Interestingly for my driver it just copy them to /etc/cups/ppd. Does the files within this directory has references to the nix store?

@florianjacob
Copy link
Contributor

I created a half-stateful solution similar to mysql.ensureDatabases, which uses lpadmin etc. to create the configured printers and force them in the right configuration, without having to touch the deep parts of cups. Works quite well, still have to see how it works on printer driver updates, though. Will pose a PR when that succeeds.

@florianjacob
Copy link
Contributor

PR: #55510 please go and test it. :)

@avnik
Copy link
Contributor

avnik commented Feb 28, 2019

Upvote this! Will test 55510 on weekend. (looks better, than my own unconditional injection of ppd into /var/.../cups)

@Yarny0
Copy link
Contributor

Yarny0 commented Mar 31, 2019

Hi, I just stumbled over this issue by accident and realized I'm using something similar in my machines own printing config. So I'm thinking it might help you if I'd share this code with you.

printing.nix.txt

Sorry for just dumping this file here. I've been planning to clean it up and suggest my module via a pull-request on its own, but I haven't found the time to do so yet. Still, I hope my module contains some usable ideas towards declarative printer config (e.g. set options, and check that each declared printer has its backend and ppd file installed).

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 6.topic: user experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants