Skip to content

Commit

Permalink
feat(hardware): add printer module
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuciael committed Oct 13, 2024
1 parent 30d872d commit 6d3fc7e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hosts/laptop/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ in {
}
];
};
printer.enable = true;
bluetooth.enable = true;
sound.enable = true;
# docker.enable = true;
docker.enable = true;
yubikey = {
enable = true;
interactive = true;
Expand Down
1 change: 1 addition & 0 deletions hosts/pc/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ in {
];
};
bluetooth.enable = true;
printer.enable = true;
sound.enable = true;
amdgpu.enable = true;
docker.enable = true;
Expand Down
40 changes: 40 additions & 0 deletions modules/hardware/printer.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
username,
...
}:
with lib;
with lib.my; let
cfg = config.modules.hardware.printer;
in {
options.modules.hardware.printer = {
enable = mkEnableOption "printer drivers";
};

config = mkIf (cfg.enable) {
home-manager.users.${username}.home.packages = with pkgs; [system-config-printer];

services.printing = {
enable = true;
drivers = with pkgs; [hplip];
};

hardware.printers = {
ensurePrinters = [
{
name = "HP-LaserJet-Pro-M304-M305";
location = "Home";
deviceUri = "hp:/usb/HP_LaserJet_Pro_M304-M305?serial=PHCY505550";
model = "HP/hp-laserjet_pro_m304-m305-ps.ppd.gz";
ppdOptions = {
PageSize = "A4";
pdftops-renderer = "gs";
};
}
];
ensureDefaultPrinter = "HP-LaserJet-Pro-M304-M305";
};
};
}

0 comments on commit 6d3fc7e

Please sign in to comment.