- printing role: Add configurable printerName, printerUri, and printerModel options to replace hardcoded Brother printer values - nfs-mounts role: Add configurable server, remotePath, and mountPoint options to replace hardcoded NFS server IP (10.0.0.43) - virtualisation role: Add configurable dockerUsers option as list type to replace hardcoded 'johno' docker group membership All options have sensible defaults matching the original hardcoded values, ensuring backward compatibility while allowing per-host customization. Implements bead: nixos-configs-fkt
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.roles.printing;
|
|
in
|
|
{
|
|
options.roles.printing = {
|
|
enable = mkEnableOption "Enable default printing setup";
|
|
printerName = mkOption {
|
|
type = types.str;
|
|
default = "MFC-L8900CDW_series";
|
|
description = "Name for the default printer";
|
|
};
|
|
printerUri = mkOption {
|
|
type = types.str;
|
|
default = "ipp://brother.oglehome/ipp/print";
|
|
description = "Device URI for the default printer (e.g., ipp://hostname/ipp/print)";
|
|
};
|
|
printerModel = mkOption {
|
|
type = types.str;
|
|
default = "everywhere";
|
|
description = "PPD model for the printer (use 'everywhere' for driverless IPP)";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable
|
|
{
|
|
services.printing.enable = true;
|
|
|
|
services.avahi = {
|
|
enable = true;
|
|
nssmdns4 = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
hardware.printers.ensurePrinters = [{
|
|
name = cfg.printerName;
|
|
deviceUri = cfg.printerUri;
|
|
model = cfg.printerModel;
|
|
}];
|
|
hardware.printers.ensureDefaultPrinter = cfg.printerName;
|
|
|
|
# Fix ensure-printers service to wait for network availability
|
|
systemd.services.ensure-printers = {
|
|
after = [ "cups.service" "network-online.target" ];
|
|
wants = [ "cups.service" "network-online.target" ];
|
|
};
|
|
};
|
|
}
|