summaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
authorEthel Morgan <eth@ethulhu.co.uk>2020-07-16 12:15:25 +0100
committerEthel Morgan <eth@ethulhu.co.uk>2020-07-16 12:15:25 +0100
commitb6e49129d2a3a01dd1ad436e4144bacbe89d1c30 (patch)
treeb2ea63636334451916da2318d1ff78008b7a10d2 /nixos
parent8a0e28879f88d405e90fec6e80a3fd2539c068a5 (diff)
add eth.hardware.printer NixOS module
Diffstat (limited to '')
-rw-r--r--nixos/modules/hardware/printer.nix34
-rw-r--r--nixos/modules/module-list.nix1
2 files changed, 35 insertions, 0 deletions
diff --git a/nixos/modules/hardware/printer.nix b/nixos/modules/hardware/printer.nix
new file mode 100644
index 0000000..23aa554
--- /dev/null
+++ b/nixos/modules/hardware/printer.nix
@@ -0,0 +1,34 @@
+{ config, lib, pkgs, ... }:
+with lib;
+
+let
+ cfg = config.eth.hardware.printer;
+
+in {
+
+ options.eth.hardware.printer = {
+ enable = mkEnableOption "Whether to enable Eth's home printer";
+ };
+
+ config = mkIf cfg.enable {
+ # Avahi is needed for dnssd (mDNS / Bonjour) printers.
+ services.avahi = {
+ enable = true;
+ nssmdns = true;
+ };
+
+ services.printing = {
+ enable = true;
+ drivers = with pkgs; [ brlaser ];
+ };
+
+ hardware.printers.ensurePrinters = [
+ {
+ name = "Brother_HL-1210W";
+ description = "Brother HL-1210W";
+ deviceUri = "dnssd://Brother%20HL-1210W%20series._pdl-datastream._tcp.local/?uuid=e3248000-80ce-11db-8000-d89c67c1755c";
+ model = "drv:///brlaser.drv/br1200.ppd";
+ }
+ ];
+ };
+}
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index a734519..247d9a6 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -1,6 +1,7 @@
[
./hardware/keyboard.nix
./hardware/linode.nix
+ ./hardware/printer.nix
./hardware/touchpad.nix
./hardware/yubikey.nix
./location.nix