2024-06-09 23:35:53 +03:00
|
|
|
# NOTE: Login to contaier, run passwd and use that root/pw combo for administration. `AllowFrom = all` doesn't seem to work.
|
|
|
|
|
|
|
|
# ipp://192.168.2.237
|
|
|
|
# Pantum M6500W-Series
|
2024-08-02 23:45:19 +03:00
|
|
|
{ container, pkgs, lib, config, __findFile, ... } @args: with lib; let
|
2024-06-25 04:04:39 +03:00
|
|
|
cfg = config.container.module.print;
|
2024-08-02 23:45:19 +03:00
|
|
|
package = pkgs.callPackage <package/print> args;
|
2024-06-09 23:35:53 +03:00
|
|
|
in {
|
2024-06-25 04:04:39 +03:00
|
|
|
options = {
|
|
|
|
container.module.print = {
|
|
|
|
enable = mkEnableOption "Printing server.";
|
|
|
|
address = mkOption {
|
|
|
|
default = "10.1.0.46";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
port = mkOption {
|
|
|
|
default = 631;
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
domain = mkOption {
|
|
|
|
default = "print.${config.container.domain}";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
storage = mkOption {
|
|
|
|
default = "${config.container.storage}/print";
|
|
|
|
type = types.str;
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
];
|
|
|
|
|
|
|
|
containers.print = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/cups" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-06-25 04:04:39 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
services.printing = {
|
|
|
|
enable = true;
|
|
|
|
allowFrom = [ "all" ];
|
|
|
|
browsing = true;
|
|
|
|
defaultShared = true;
|
|
|
|
drivers = [ package ];
|
|
|
|
listenAddresses = [ "${cfg.address}:${toString cfg.port}" ];
|
|
|
|
startWhenNeeded = true;
|
|
|
|
stateless = false;
|
|
|
|
webInterface = true;
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|