From 05fb82732c97582ecf0a35ed81111ab5d1c088d4 Mon Sep 17 00:00:00 2001 From: Matt McHenry Date: Tue, 13 Dec 2016 21:23:16 -0500 Subject: [PATCH] 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. --- nixos/modules/services/printing/cupsd.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 368d7ac761ac..3041dccfd154 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -75,7 +75,7 @@ let '') cfg.listenAddresses} Listen /var/run/cups/cups.sock - SetEnv PATH ${bindir}/lib/cups/filter:${bindir}/bin + SetEnv PATH /var/lib/cups/path/lib/cups/filter:/var/lib/cups/path/bin DefaultShared ${if cfg.defaultShared then "Yes" else "No"} @@ -310,6 +310,13 @@ in for i in *; do [ ! -e "/var/lib/cups/$i" ] && ln -s "${rootdir}/etc/cups/$i" "/var/lib/cups/$i" done + + #update path reference + [ -L /var/lib/cups/path ] && \ + rm /var/lib/cups/path + [ ! -e /var/lib/cups/path ] && \ + ln -s ${bindir} /var/lib/cups/path + ${optionalString cfg.gutenprint '' if [ -d /var/lib/cups/ppd ]; then ${gutenprint}/bin/cups-genppdupdate -p /var/lib/cups/ppd