peripherals/printing: revamp module, add itap printers

This commit is contained in:
Infinidoge 2024-01-31 17:24:39 -05:00
parent 0817ab96aa
commit 7a08cb310d
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, private, ... }:
with lib; with lib;
with lib.our; with lib.our;
let let
@ -7,13 +7,42 @@ in
{ {
options.modules.hardware.peripherals.printing = with types; { options.modules.hardware.peripherals.printing = with types; {
enable = mkBoolOpt false; enable = mkBoolOpt false;
drivers = mkOpt (functionTo listOf package) (pkgs: [ ]); drivers = mkOpt (listOf path) [ ];
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable (mkMerge [
services.printing = { {
enable = true; services.printing = {
drivers = cfg.drivers pkgs; enable = true;
}; inherit (cfg) drivers;
}; };
}
(mkIf config.info.loc.purdue {
hardware.printers = {
ensureDefaultPrinter = "printing";
ensurePrinters =
let
itap = name: {
inherit name;
deviceUri = "lpd://${private.variables.purdue-username}@wpvapppcprt02.itap.purdue.edu:515/itap-${name}";
model = "drv:///sample.drv/generic.ppd";
ppdOptions = {
Duplex = "DuplexNoTumble";
Option1 = "True"; # Duplexer
};
};
in
[
(itap "printing")
(itap "colorprinting")
];
};
services.printing.browsedConf = ''
BrowseRemoteProtocols none
'';
})
]);
} }