flake: pull printing out into global modules
This commit is contained in:
parent
28c5624eb8
commit
e941f94e3c
6 changed files with 58 additions and 89 deletions
|
@ -30,9 +30,6 @@
|
|||
gpu.nvidia = true;
|
||||
wireless.enable = true;
|
||||
form.desktop = true;
|
||||
peripherals = {
|
||||
printing.enable = true;
|
||||
};
|
||||
};
|
||||
services = {
|
||||
apcupsd = {
|
||||
|
@ -54,17 +51,7 @@
|
|||
];
|
||||
};
|
||||
|
||||
services.printing.drivers = with pkgs; [
|
||||
tmx-cups-ppd
|
||||
];
|
||||
|
||||
hardware.printers.ensurePrinters = [
|
||||
{
|
||||
name = "EPSON-TM-m30";
|
||||
deviceUri = "usb://EPSON/TM-m30II-NT?serial=5839394D0032780000";
|
||||
model = "tm-m30-rastertotmt.ppd.gz";
|
||||
}
|
||||
];
|
||||
services.printing.enable = true;
|
||||
|
||||
virtualisation.enable = true;
|
||||
|
||||
|
|
|
@ -39,16 +39,10 @@
|
|||
|
||||
environment.enableDebugInfo = true;
|
||||
|
||||
services.printing.drivers = [ pkgs.tmx-cups-ppd ];
|
||||
|
||||
modules = {
|
||||
hardware = {
|
||||
gpu.intel = true;
|
||||
form.laptop = true;
|
||||
|
||||
peripherals = {
|
||||
printing.enable = true;
|
||||
};
|
||||
};
|
||||
desktop = {
|
||||
wm.enable = true;
|
||||
|
@ -71,12 +65,9 @@
|
|||
|
||||
programs.kdeconnect.enable = true;
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
hardware.printers.ensurePrinters = [
|
||||
{
|
||||
name = "EPSON-TM-m30";
|
||||
deviceUri = "usb://EPSON/TM-m30II-NT?serial=5839394D0032780000";
|
||||
model = "tm-m30-rastertotmt.ppd.gz";
|
||||
}
|
||||
{
|
||||
name = "EPSON-TM-m30-remote";
|
||||
deviceUri = "ipp://100.101.102.18/printers/EPSON-TM-m30";
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
modules = {
|
||||
hardware.form.desktop = true;
|
||||
hardware.gpu.intel = true;
|
||||
hardware.peripherals.printing.enable = true;
|
||||
desktop.wm.enable = true;
|
||||
};
|
||||
|
||||
services.printing = {
|
||||
enable = true;
|
||||
listenAddresses = [
|
||||
"localhost:631"
|
||||
"100.101.102.18:631"
|
||||
|
@ -29,17 +29,8 @@
|
|||
allowFrom = [ "all" ];
|
||||
defaultShared = true;
|
||||
openFirewall = true;
|
||||
drivers = [ pkgs.tmx-cups-ppd ];
|
||||
};
|
||||
|
||||
hardware.printers.ensurePrinters = [
|
||||
{
|
||||
name = "EPSON-TM-m30";
|
||||
deviceUri = "usb://EPSON/TM-m30II-NT?serial=5839394D0032780000";
|
||||
model = "tm-m30-rastertotmt.ppd.gz";
|
||||
}
|
||||
];
|
||||
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "infini-dl360";
|
||||
|
|
20
modules/global/printing.nix
Normal file
20
modules/global/printing.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf config.services.printing.enable {
|
||||
services.printing.drivers = with pkgs; [
|
||||
tmx-cups-ppd
|
||||
];
|
||||
|
||||
hardware.printers.ensurePrinters = [
|
||||
{
|
||||
name = "EPSON-TM-m30";
|
||||
deviceUri = "usb://EPSON/TM-m30II-NT?serial=5839394D0032780000";
|
||||
model = "tm-m30-rastertotmt.ppd.gz";
|
||||
}
|
||||
];
|
||||
}
|
34
modules/global/purdue.nix
Normal file
34
modules/global/purdue.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
private,
|
||||
...
|
||||
}:
|
||||
|
||||
lib.mkIf config.info.loc.purdue {
|
||||
hardware.printers = {
|
||||
ensureDefaultPrinter = "printing";
|
||||
|
||||
ensurePrinters =
|
||||
let
|
||||
itap = name: {
|
||||
inherit name;
|
||||
#deviceUri = "lpd://${private.variables.purdue-username}@wpvapppcprt02.itap.purdue.edu:515/itap-${name}";
|
||||
deviceUri = "lpd://${private.variables.purdue-username}@128.210.210.41:515/itap-${name}";
|
||||
model = "drv:///sample.drv/generic.ppd";
|
||||
ppdOptions = {
|
||||
Duplex = "DuplexNoTumble";
|
||||
Option1 = "True"; # Duplexer
|
||||
};
|
||||
};
|
||||
in
|
||||
[
|
||||
(itap "printing")
|
||||
(itap "colorprinting")
|
||||
];
|
||||
};
|
||||
|
||||
services.printing.browsedConf = ''
|
||||
BrowseRemoteProtocols none
|
||||
'';
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
private,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.our;
|
||||
let
|
||||
cfg = config.modules.hardware.peripherals.printing;
|
||||
in
|
||||
{
|
||||
options.modules.hardware.peripherals.printing = with types; {
|
||||
enable = mkBoolOpt false;
|
||||
drivers = mkOpt (listOf path) [ ];
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
services.printing = {
|
||||
enable = true;
|
||||
inherit (cfg) drivers;
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf config.info.loc.purdue {
|
||||
hardware.printers = {
|
||||
ensureDefaultPrinter = "printing";
|
||||
|
||||
ensurePrinters =
|
||||
let
|
||||
itap = name: {
|
||||
inherit name;
|
||||
#deviceUri = "lpd://${private.variables.purdue-username}@wpvapppcprt02.itap.purdue.edu:515/itap-${name}";
|
||||
deviceUri = "lpd://${private.variables.purdue-username}@128.210.210.41:515/itap-${name}";
|
||||
model = "drv:///sample.drv/generic.ppd";
|
||||
ppdOptions = {
|
||||
Duplex = "DuplexNoTumble";
|
||||
Option1 = "True"; # Duplexer
|
||||
};
|
||||
};
|
||||
in
|
||||
[
|
||||
(itap "printing")
|
||||
(itap "colorprinting")
|
||||
];
|
||||
};
|
||||
|
||||
services.printing.browsedConf = ''
|
||||
BrowseRemoteProtocols none
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue