Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoriguchi committed Sep 18, 2024
1 parent e2b3e9d commit 7add848
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
{ pkgs, ... }: {
hardware.printers.ensurePrinters = [{
name = "Default";

# lpinfo -v
deviceUri = "hp:/usb/ENVY_4500_series?serial=CN4CS2325205X4";

# lpinfo -m
model = "HP/hp-envy_4500_series.ppd.gz";

# lpoptions -p Default -l
ppdOptions = {
ColorModel = "KGray";
Duplex = "None";
InputSlot = "Auto";
MediaType = "Plain";
OptionDuplex = "False";
OutputMode = "Normal";
PageSize = "A4";
{ pkgs, config, ... }: {
# Required for sane
boot.kernelModules = [ "sg" "usblp" ];

hardware = {
printers.ensurePrinters = [{
name = "Default";

# lpinfo -v
deviceUri = "hp:/usb/ENVY_4500_series?serial=CN4CS2325205X4";

# lpinfo -m
model = "HP/hp-envy_4500_series.ppd.gz";

# lpoptions -p Default -l
ppdOptions = {
ColorModel = "KGray";
Duplex = "None";
InputSlot = "Auto";
MediaType = "Plain";
OptionDuplex = "False";
OutputMode = "Normal";
PageSize = "A4";
};
}];

sane = {
enable = true;

extraBackends = [ pkgs.hplipWithPlugin ];
};
}];
};

services = {
# lsusb
Expand Down Expand Up @@ -48,6 +59,15 @@
'';
};

saned.enable = true;

scanservjs = {
enable = true;

# TODO remove
settings.host = "0.0.0.0";
};

avahi = {
enable = true;

Expand All @@ -62,4 +82,7 @@
};
};
};

# TODO remove use nginx
networking.firewall.allowedTCPPorts = [ config.services.scanservjs.settings.port ];
}
18 changes: 18 additions & 0 deletions modules/default/scanservjs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# TODO remove when merged https://nixpk.gs/pr-tracker.html?pr=249806

let
src = let
owner = "NixOS";
repo = "nixpkgs";
rev = "c861052eab51de685f2286ce75d6e67395f6eae5";
sha256 = "sha256:1j3drcp4mizf90dcpvnfajx1b49m8ijfq7w6a53kyfgx22r1x51i";
in builtins.fetchTarball {
name = "nixpkgs";
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
inherit sha256;
};
in {
imports = [ "${src}/nixos/modules/services/hardware/scanservjs.nix" ];

nixpkgs.overlays = [ (_: super: { scanservjs = super.callPackage "${src}/pkgs/applications/graphics/scanservjs/default.nix" { }; }) ];
}
2 changes: 0 additions & 2 deletions modules/profiles/printing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@
nssmdns6 = true;
};
};

environment.systemPackages = [ pkgs.simple-scan ];
}

0 comments on commit 7add848

Please sign in to comment.