Commit Graph

95 Commits

Author SHA1 Message Date
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
Daniel Barter
18d65382d6 nixos/cupsd: allow cups package override 2023-12-28 08:58:01 -08:00
Jonas Heinrich
31f01ff179 nixos/printing: Fix openFirewall option 2023-11-07 10:21:48 +01:00
Jonas Heinrich
35128eb6f8
nixos/printing: Add openFirewall option (#176539) 2023-11-05 16:01:20 +01:00
Sebastian Sellmeier
57071b60fe
cups: add xdg-open as dependency package as substitution does not work
for all desktop-envs
2023-07-13 15:37:00 +02:00
Artturi
496c532a03
Merge pull request #105694 from laikq/master 2023-04-19 23:38:05 +03:00
laikq
376e02c721 nixos/cupsd: add udev rules of driver packages 2023-04-19 03:38:02 +03:00
Sergei Trofimovich
092d57c076 Merge remote-tracking branch 'origin/staging-next' into staging
Conflicts:
    pkgs/development/tools/language-servers/ansible-language-server/default.nix
2022-12-28 09:35:37 +00:00
Ryan Lahfa
861c7b189c
Merge pull request #182360 from Yarny0/cups-pdf
cups-pdf(-to-pdf): init
2022-12-28 09:08:49 +01:00
Michele Guerini Rocco
5dff7733aa
Merge pull request #203454 from rnhmjoj/pr-cups-socket
nixos/hardware/printers: stop cupsd when unneeded
2022-12-21 23:06:00 +01:00
figsoda
6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Yarny0
49a129ab40 nixos/cups-pdf: init
Some implementation notes:

* cups-pdf, and cups-pdf-to-pdf,
  support multiple instances with differing configurations.
  This can be accomplished by creating multiple configuration
  files with names `cups-pdf-{instance-name}.conf`.
  The Nixos module supports this feature by providing
  the option `instances` which is an attrset
  mapping instance names to instance configurations.
  To simplify module usage,
  an instance `pdf` is created by default.

* To use a cups-pdf instance, one also needs
  a cups queue that connects to the backend.
  The module does this automatically by default,
  using the `hardware.printers.ensurePrinters`.
  It uses one of the ppd files which is
  included in the cups-pdf package.
  If this isn't desired (e.g. because printer queues
  should be created by hand, or configured differently),
  the `installPrinter` option can be turned off
  (for each instance separately).

* In our configuration, cups calls external programs
  using the `cups` account and the `lp` group.
  cups-pdf refuses to operate without root privileges,
  likely because it needs to change the
  ownership of it output pdf files so that
  (only) the print job's owner can access them.

  The module installs a suid root wrapper for the backend
  program that can only be called by the `lp` group.
  The cups-pdf package is replaced by a wrapper
  package which calls the suid root wrapper.
  So cups can call its backend programs as usual.
2022-12-09 22:20:09 +01:00
rnhmjoj
28034190de
nixos/cupsd: fix /var/run/ warning in cups.socket
Silence the systemd warning

    ListenStream= references a path below legacy directory /var/run/, updating /var/run/cups/cups.sock → /run/cups/cups.sock; please update the unit file accordingly

by resetting the value coming from the upstream unit.
2022-12-07 15:57:44 +01:00
rnhmjoj
43cb1eb2f9
nixos/cupsd: stop managing /run/cups directory
The directory is already set up by cups.socket: managing it with
RuntimeDirectory in cups.service is unnecesary and has the unwanted
effect that upon stopping cupsd systemd will remove it. This includes
the /run/cups/cups.sock socket, so it breaks socket activation.
2022-12-07 15:57:44 +01:00
Guillaume Girol
8e7a32d061 nixos/ipp-usb: add module 2022-12-06 21:06:54 +01:00
matthewcroughan
a99ab1fbc1 nixos/printing: add services.printing.stateless option
This will remove all state directories related to CUPS on startup, which
is particularly useful for guaranteeing that printer discovery works
more reliably on some networks, since CUPS will no longer be able to
store state that effects the next run of the service, such as old
printer names and mDNS information.

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-10-17 22:59:24 +01:00
pennae
9547123258 nixos/*: convert internal option descriptions to MD
we'll have to do it eventually, may as well be now.
2022-08-31 16:32:54 +02:00
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Naïm Favier
2ddc335e6f
nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Samuel Gräfenstein
87f4d7a07a
nixos/printing: simplify filterGutenprint function 2021-03-14 11:59:00 +01:00
Sandro Jäckel
754a8db42d
nixos/printing: remove google cloud print 2021-02-18 02:21:38 +01:00
Maximilian Bosch
4062592f3a
nixos/printing: make access to web-interface configurable
Otherwise you'd always get a 403 when hosting the web-interface of cups
at a different location than `localhost`.
2020-04-25 19:48:34 +02:00
rnhmjoj
1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
Silvan Mosberger
4ee3e8b21d
nixos/treewide: Move rename.nix imports to their respective modules
A centralized list for these renames is not good because:
- It breaks disabledModules for modules that have a rename defined
- Adding/removing renames for a module means having to find them in the
central file
- Merge conflicts due to multiple people editing the central file
2019-12-10 02:51:19 +01:00
caadar
028dacdcfb cups: fix misleading comment 2019-10-28 16:48:34 +01:00
worldofpeace
787eabd7c1
Merge pull request #68218 from worldofpeace/cups-pk/no-auth-wheel
nixos/cupsd: passwordless admin for wheel with polkit
2019-09-09 04:42:19 -04:00
worldofpeace
b9d9045d57 nixos/cupsd: passwordless admin for wheel with polkit 2019-09-06 13:51:38 -04:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Matthew Bauer
e9b7085ff8 cups: add myself as maintainer 2019-08-14 11:47:48 -04:00
Matthew Bauer
c068488817 nixos/cupsd: use socket-based activation by default
Make socket-based activation the
default (services.printing.startWhenNeeded)
2019-08-14 11:47:12 -04:00
Matthew Bauer
28040465be nixos/cupsd: include /run/cups/cups.sock in ListenStreams
This socket should always be created by systemd.
2019-08-14 11:47:12 -04:00
Matthew Bauer
35e633bde5 nixos/cupsd: only enable cups when startWhenNeeded = false
cups-browsed was pulling in cups.service even when we were using the
socket-based initialization.
2019-08-14 11:47:12 -04:00
Matthew Bauer
04ea093eb6 nixos/cupsd: Set CUPS_DATADIR globally
This is used by some programs that need CUPS data files. For instance,
print-manager looks here for printing test pages.
2019-08-14 11:47:12 -04:00
Matthew Bauer
38fdc9f8f8
Merge pull request #59076 from Yarny0/cups-path-fix
nixos/printing: fix CUPS `SetEnv` directive placement
2019-05-30 10:52:28 -04:00
Yarny0
631c71da83 nixos/printing: fix CUPS SetEnv directive placement
With CUPS v2.3b5, the configuration directive `SetEnv`
moved from `cupsd.conf` to `cups-files.conf`.  See also
d47f6aec43 .

We have to follow up as `SetEnv` is now ignored in `cupsd.conf`.
Without this, executables called by cups
can't find other executables they depend on,
like `gs` or `perl`.
2019-04-05 14:23:59 +02:00
Bob van der Linden
0cf1944c36
nixos/cups: /var/run -> /run 2019-03-24 21:15:30 +01:00
Symphorien Gibol
a915b33315 nixos: add preferLocalBuild=true; on derivations for config files 2019-02-22 20:11:27 +01:00
Florian Jacob
33b3272692 nixos/cups: Fix Unable to encrypt connection:
Unable to create server credentials
by creating /var/lib/cups/ssl directory.
2019-02-14 20:43:26 +01:00
obadz
6fca3c5700 cups-googlecloudprint: init at 20160502 2018-10-11 09:19:58 +01:00
Johannes Frankenau
d81f819db3 nixos/cupsd: add option to start when needed 2018-07-14 23:39:43 +02:00
Florian Klink
fff5923686 nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
Ben Gamari
192352ff2f nixos/cupsd: Introduce services.printing.logLevel option
Previously we indirectly suggested that the user use
services.printing.extraConf to set this, but this doesn't work with the
default merge ordering. Fix this by making it an independent option.
Fixes #39611.
2018-04-27 16:41:49 +00:00
Nikolay Amiantov
9c1c424e52 cups service: fix client sockets
Use systemd to create the directory for UNIX socket. Also use localhost instead
of 127.0.0.1 as is done in default cupsd.conf so that IPv6 is enabled when
available.
2018-02-23 18:51:39 +03:00
Michael Weiss
ea23f8bb07 cups service: Automatically detect Gutenprint in drivers
Additional CUPS drivers can be added via "services.printing.drivers" but
Gutenprint was an exception. It was possible to add a Gutenprint
derivation to that list and it would work at first but unlike the other
drivers Gutenprint requires a script to be run after each update or any
attempt to print something would simply fail and an error would show up
in the jobs queue (http://localhost:631/jobs/):
"The PPD version (5.2.11) is not compatible with Gutenprint 5.2.13.
Please run
`/nix/store/7762kpyhfkcgmr3q81v1bbyy0bjhym80-gutenprint-5.2.13/sbin/cups-genppdupdate'
as administrator."
This is due to state in "/var/lib/cups/ppd" and one would need to run
"/nix/store/.../bin/cups-genppdupdate -p /var/lib/cups/ppd" manually.
The alternative was to enable the following option:
"services.printing.gutenprint" but this had two disadvantages:
1) It is an exception that one could be unaware of or that could
potentially cause some confusion.
2) One couldn't use a customized Gutenprint derivation in
"services.printing.drivers" but would instead have to overwrite
"pkgs.gutenprint".

This new approach simply detects a Gutenprint derivation in
"services.printing.gutenprint" by checking if the meta set of a
derivation contains "isGutenprint = true". Therefore no special
exception for Gutenprint would be required and it could easily be
applied to other drivers if they would require such a script to be run.
2017-08-29 05:25:12 +04:00
Benno Fünfstück
99fbd867ef Merge pull request #27031 from jerith666/cnijfilter-2-80
cnijfilter: init at 2.80
2017-07-18 14:37:32 +02:00
Matt McHenry
67d02cd60a cnijfilter: init at 2.80
this driver reads support files from lib/bjlib as well as lib/cups,
which is why the path in cupsd.nix is tweaked
2017-07-17 07:32:23 -04:00
Jörg Thalheim
731917a800
cups: mount private /tmp
printer driver and wrapper are often not written with security in mind.

While reviewing https://github.com/NixOS/nixpkgs/pull/25654 I found
a symlink-race vulnerability within the wrapper code, when writing
unique files in /tmp.
I expect this script to be reused in other models as well
as similar vulnerabilities in the code of other vendors. Therefore
I propose to make /tmp of cups.service private so that only processes
with the same privileges are able to access these files.
2017-05-10 18:03:42 +01:00
Vladimír Čunát
50fadc8b18
cups: split the $lib output
This saves > 10 MB from most closures.
Printing test succeeds on x86_64-linux.
2017-03-12 18:36:30 +01:00
Matt McHenry
05fb82732c use symlink to ensure cupsd.conf PATH always points to a valid store path
even if cups rewrites its config file due to config changes made through
its web-based management UI, we need to keep the PATH pointing to
currently-live nix store directories.  fixes #20806.
2016-12-13 21:35:56 -05:00
Bjørn Forsman
fbf9162cbb treewide: cups_filters -> cups-filters 2016-08-25 17:48:35 +02:00