From a7024cb4b48560980e657f64242ae60c626e60e5 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Thu, 11 Dec 2014 13:27:29 +0100 Subject: Create a nixos module for cups-browsed --- nixos/modules/services/printing/cupsd.nix | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'nixos/modules/services/printing') diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index bb3bf2519d421..679aa81a13da6 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -4,7 +4,7 @@ with lib; let - inherit (pkgs) cups; + inherit (pkgs) cups cups_filters; cfg = config.services.printing; @@ -123,6 +123,19 @@ in ''; }; + browsedConf = mkOption { + type = types.lines; + default = ""; + example = + '' + BrowsePoll cups.example.com + ''; + description = '' + The contents of the configuration. file of the CUPS Browsed daemon + (cups-browsed.conf) + ''; + }; + drivers = mkOption { type = types.listOf types.path; example = literalExample "[ pkgs.splix ]"; @@ -161,6 +174,7 @@ in environment.etc."cups/client.conf".text = cfg.clientConf; environment.etc."cups/cups-files.conf".text = cfg.cupsFilesConf; environment.etc."cups/cupsd.conf".text = cfg.cupsdConf; + environment.etc."cups/cups-browsed.conf".text = cfg.browsedConf; services.dbus.packages = [ cups ]; @@ -195,6 +209,22 @@ in ]; }; + systemd.services.cups-browsed = + { description = "Make remote CUPS printers available locally"; + + wantedBy = [ "multi-user.target" ]; + wants = [ "cups.service" "avahi-daemon.service" ]; + after = [ "cups.service" "avahi-daemon.service" ]; + + path = [ cups ]; + + serviceConfig.ExecStart = "${cups_filters}/bin/cups-browsed"; + + restartTriggers = + [ config.environment.etc."cups/cups-browsed.conf".source + ]; + }; + services.printing.drivers = [ cups pkgs.ghostscript pkgs.cups_filters additionalBackends pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep -- cgit 1.4.1