From 087e6895c91feefd18203161b79f3c86dc154000 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 16 Dec 2014 18:22:22 +0100 Subject: [PATCH] cups: Build with SERVERROOT set to /etc/cups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit be0e73b938ff4fd857c326952beedf41a007da69) Signed-off-by: Domen Kožar --- nixos/modules/services/printing/cupsd.nix | 31 ++++++++--------------- pkgs/misc/cups/default.nix | 3 ++- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 190be6b9830f..bb3bf2519d42 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -11,20 +11,16 @@ let additionalBackends = pkgs.runCommand "additional-cups-backends" { } '' mkdir -p $out - if [ ! -e ${pkgs.cups}/lib/cups/backend/smb ]; then + if [ ! -e ${cups}/lib/cups/backend/smb ]; then mkdir -p $out/lib/cups/backend ln -sv ${pkgs.samba}/bin/smbspool $out/lib/cups/backend/smb fi # Provide support for printing via HTTPS. - if [ ! -e ${pkgs.cups}/lib/cups/backend/https ]; then + if [ ! -e ${cups}/lib/cups/backend/https ]; then mkdir -p $out/lib/cups/backend - ln -sv ${pkgs.cups}/lib/cups/backend/ipp $out/lib/cups/backend/https + ln -sv ${cups}/lib/cups/backend/ipp $out/lib/cups/backend/https fi - - # Import filter configuration from Ghostscript. - mkdir -p $out/share/cups/mime/ - ln -v -s "${pkgs.ghostscript}/etc/cups/"* $out/share/cups/mime/ ''; # Here we can enable additional backends, filters, etc. that are not @@ -162,8 +158,6 @@ in environment.systemPackages = [ cups ]; - environment.variables.CUPS_SERVERROOT = "/etc/cups"; - 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; @@ -184,10 +178,6 @@ in path = [ cups ]; - environment = { - CUPS_SERVERROOT = "/etc/cups"; - }; - preStart = '' mkdir -m 0755 -p /etc/cups @@ -197,11 +187,16 @@ in ''; serviceConfig.Type = "forking"; - serviceConfig.ExecStart = "@${cups}/sbin/cupsd cupsd -c /etc/cups/cupsd.conf"; + serviceConfig.ExecStart = "@${cups}/sbin/cupsd cupsd"; + + restartTriggers = + [ config.environment.etc."cups/cups-files.conf".source + config.environment.etc."cups/cupsd.conf".source + ]; }; services.printing.drivers = - [ pkgs.cups pkgs.ghostscript pkgs.cups_filters additionalBackends + [ cups pkgs.ghostscript pkgs.cups_filters additionalBackends pkgs.perl pkgs.coreutils pkgs.gnused pkgs.bc pkgs.gawk pkgs.gnugrep ]; @@ -209,11 +204,6 @@ in '' SystemGroup root wheel - # Note: we can't use ${cups}/etc/cups as the ServerRoot, since - # CUPS will write in the ServerRoot when e.g. adding new printers - # through the web interface. - #ServerRoot /etc/cups - ServerBin ${bindir}/lib/cups DataDir ${bindir}/share/cups @@ -286,6 +276,7 @@ in Order deny,allow + ${cfg.extraConf} ''; diff --git a/pkgs/misc/cups/default.nix b/pkgs/misc/cups/default.nix index 8e34f4d5ae8e..883de8d2b9db 100644 --- a/pkgs/misc/cups/default.nix +++ b/pkgs/misc/cups/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation { propagatedBuildInputs = [ openssl ]; - configureFlags = "--localstatedir=/var --enable-dbus"; # --with-dbusdir + configureFlags = "--localstatedir=/var --sysconfdir=/etc --enable-dbus"; # --with-dbusdir installFlags = [ # Don't try to write in /var at build time. @@ -31,6 +31,7 @@ stdenv.mkDerivation { "DBUSDIR=$(out)/etc/dbus-1" "INITDIR=$(out)/etc/rc.d" "XINETD=$(out)/etc/xinetd.d" + "SERVERROOT=$(out)/etc/cups" # Idem for /usr. "MENUDIR=$(out)/share/applications" "ICONDIR=$(out)/share/icons"