aboutsummaryrefslogtreecommitdiffstats
path: root/hosts/common/optional/printer.nix
blob: 32e4c7698bc7306ff6b43f207cb8417d5d1720a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ lib, ... }:
{
  hardware.printers = let
    brother = "Brother_HL-L2340D";
    ip = "192.168.1.20";
  in {
    ensureDefaultPrinter = brother;
    ensurePrinters = [{
      name = brother;
      deviceUri = "ipp://${ip}/ipp";
      model = "everywhere";
      description = lib.replaceStrings [ "_" ] [ " " ] brother;
      location = "home";
    }];
  };

  systemd.services."ensure-printers" = {
    after = [ "network-online.target" ];
    preStart = "sleep 5";
    wants = [ "network-online.target" ];
  };
}