Add support for custom CUPS drivers

Use buildEnv for cups-prog.

svn path=/nixos/trunk/; revision=21102
This commit is contained in:
Yury G. Kudryashov 2010-04-15 15:47:07 +00:00
parent dcd0be3351
commit a26d31d04c

View File

@ -17,28 +17,20 @@ let
# we can't update ${cups}/lib/cups itself, we create a symlink tree # we can't update ${cups}/lib/cups itself, we create a symlink tree
# here and add the additional programs. The ServerBin directive in # here and add the additional programs. The ServerBin directive in
# cupsd.conf tells cupsd to use this tree. # cupsd.conf tells cupsd to use this tree.
bindir = pkgs.runCommand "cups-progs" {} bindir = pkgs.buildEnv {
'' name = "cups-progs";
ensureDir $out/lib/cups paths = cfg.drivers;
ln -s ${cups}/lib/cups/* $out/lib/cups/ pathsToLink = [ "/lib/cups" "/share/cups" ];
postBuild = ''
# Provide support for printing via SMB. ${pkgs.coreutils}/bin/mkdir -p $out/lib/cups/backend
rm $out/lib/cups/backend ${pkgs.coreutils}/bin/ln -s ${pkgs.samba}/bin/smbspool $out/lib/cups/backend/smb
ensureDir $out/lib/cups/backend
ln -s ${cups}/lib/cups/backend/* $out/lib/cups/backend/
ln -s ${pkgs.samba}/bin/smbspool $out/lib/cups/backend/smb
# Provide support for printing via HTTPS. # Provide support for printing via HTTPS.
ln -s ipp $out/lib/cups/backend/https ${pkgs.coreutils}/bin/ln -s ipp $out/lib/cups/backend/https
# Provide Ghostscript rasterisation, necessary for non-Postscript
# printers.
rm $out/lib/cups/filter
ensureDir $out/lib/cups/filter
ln -s ${cups}/lib/cups/filter/* $out/lib/cups/filter/
ln -s ${pkgs.ghostscript}/lib/cups/filter/* $out/lib/cups/filter/
${cfg.bindirCmds} ${cfg.bindirCmds}
''; # */ '';
};
in in
@ -78,6 +70,13 @@ in
''; '';
}; };
drivers = mkOption {
example = [ pkgs.splix ];
description = ''
CUPS drivers (CUPS, gs and samba are added unconditionally).
'';
};
}; };
}; };
@ -120,6 +119,7 @@ in
exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F"; exec = "${cups}/sbin/cupsd -c ${pkgs.writeText "cupsd.conf" cfg.cupsdConf} -F";
}; };
services.printing.drivers = [ pkgs.cups pkgs.ghostscript ];
services.printing.cupsdConf = services.printing.cupsdConf =
'' ''
LogLevel info LogLevel info
@ -135,6 +135,7 @@ in
ServerRoot /etc/cups ServerRoot /etc/cups
ServerBin ${bindir}/lib/cups ServerBin ${bindir}/lib/cups
DataDir ${bindir}/share/cups
AccessLog ${logDir}/access_log AccessLog ${logDir}/access_log
ErrorLog ${logDir}/error_log ErrorLog ${logDir}/error_log