Bruno BELANYI
2c1a7d16c7
Some checks failed
ci/woodpecker/push/check Pipeline failed
TODO: * Do home-manager * Look at for more inspiration github.com:nix-community/impermanence/pull/108 * Common files github.com:nix-community/impermanence/issues/10 * Useful config: github.com:chayleaf/dotfiles/blob/f77271b249e0c08368573c22a5c34f0737d3a766/system/modules/impermanence.nix
72 lines
1.4 KiB
Nix
72 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
cfg = config.my.system.printing;
|
|
in
|
|
{
|
|
options.my.system.printing = with lib; {
|
|
enable = mkEnableOption "printing configuration";
|
|
|
|
papersize = mkOption {
|
|
type = with types; either str (enum [
|
|
"a3"
|
|
"a4"
|
|
"a5"
|
|
"b5"
|
|
"letter"
|
|
"legal"
|
|
"executive"
|
|
"note"
|
|
"11x17"
|
|
]);
|
|
default = "a4";
|
|
example = "paper";
|
|
description = "preferred paper size";
|
|
};
|
|
|
|
usb = {
|
|
enable = my.mkDisableOption "USB printers";
|
|
};
|
|
|
|
network = {
|
|
enable = my.mkDisableOption "network printers";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Setup CUPS
|
|
services.printing = {
|
|
enable = true;
|
|
|
|
# Drivers are deprecated, but just in case
|
|
drivers = with pkgs; [
|
|
gutenprint # Base set of drivers
|
|
brlaser # Brother drivers
|
|
|
|
# Brother MFC-L3770CDW
|
|
mfcl3770cdwlpr
|
|
mfcl3770cdwcupswrapper
|
|
];
|
|
};
|
|
|
|
# Setup paper size
|
|
systemd.services.cups.serviceConfig.Environment = [
|
|
"PAPERSIZE=${cfg.papersize}"
|
|
];
|
|
|
|
# Allow using USB printers
|
|
services.ipp-usb = lib.mkIf cfg.usb.enable {
|
|
enable = true;
|
|
};
|
|
|
|
# Allow using WiFi printers
|
|
services.avahi = lib.mkIf cfg.network.enable {
|
|
enable = true;
|
|
openFirewall = true;
|
|
# Allow resolution of '.local' addresses
|
|
nssmdns4 = true;
|
|
};
|
|
|
|
# FIXME: persistence?
|
|
};
|
|
}
|