From 649c48ce09681c61de96981cbb9ab873b35367eb Mon Sep 17 00:00:00 2001 From: chn Date: Tue, 18 Jul 2023 18:19:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=20printer=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 2 +- modules/hardware/default.nix | 16 ++++++++++++++-- modules/hardware/printer.nix | 8 -------- 3 files changed, 15 insertions(+), 11 deletions(-) delete mode 100644 modules/hardware/printer.nix diff --git a/flake.nix b/flake.nix index 5db7a6b2..0603b76c 100644 --- a/flake.nix +++ b/flake.nix @@ -177,6 +177,7 @@ { bluetooth.enable = true; joystick.enable = true; + printer.enable = true; }; packages = { @@ -192,7 +193,6 @@ ./modules/sops.nix ./modules/boot/chn-PC.nix [ ./modules/hardware/nvidia-prime.nix { intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; } ] - ./modules/hardware/printer.nix ./modules/hardware/sound.nix ./modules/hardware/chn-PC.nix ./modules/networking/basic.nix diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix index 0bb394dd..991d1a9a 100644 --- a/modules/hardware/default.nix +++ b/modules/hardware/default.nix @@ -4,7 +4,19 @@ inputs: { bluetooth.enable = mkOption { type = types.bool; default = false; }; joystick.enable = mkOption { type = types.bool; default = false; }; + printer.enable = mkOption { type = types.bool; default = false; }; + }; + config = + { + hardware = {} + // (if inputs.config.nixos.hardware.bluetooth.enable then { bluetooth.enable = true; } else {}) + // (if inputs.config.nixos.hardware.joystick.enable then { xone.enable = true; xpadneo.enable = true; } else {}); + services = {} + // (if inputs.config.nixos.hardware.printer.enable then + { + printing = { enable = true; drivers = [ inputs.pkgs.cnijfilter2 ]; }; + avahi = { enable = true; nssmdns = true; openFirewall = true; }; + } + else {}); }; - config.hardware = { bluetooth.enable = inputs.config.nixos.hardware.bluetooth.enable; } - // (if inputs.config.nixos.hardware.joystick.enable then { xone.enable = true; xpadneo.enable = true; } else {}); } diff --git a/modules/hardware/printer.nix b/modules/hardware/printer.nix deleted file mode 100644 index 7b05580f..00000000 --- a/modules/hardware/printer.nix +++ /dev/null @@ -1,8 +0,0 @@ -inputs: -{ - config.services = - { - printing = { enable = true; drivers = [ inputs.pkgs.cnijfilter2 ]; }; - avahi = { enable = true; nssmdns = true; openFirewall = true; }; - }; -}