From 18f89b41a8860d0bf2b9d84d408055027fca4596 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Wed, 7 Aug 2024 15:29:42 -0500 Subject: [PATCH] add scanner module --- hosts/othalan/default.nix | 5 +++-- hosts/othalan/system.nix | 14 ++++++-------- modules/oizys.nix | 1 + modules/services/scanner/hp-scanner.nix | 25 +++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 modules/services/scanner/hp-scanner.nix diff --git a/hosts/othalan/default.nix b/hosts/othalan/default.nix index 057512b..b8d15f0 100644 --- a/hosts/othalan/default.nix +++ b/hosts/othalan/default.nix @@ -1,4 +1,4 @@ -{ enabled, ... }: +{ enabled, config, ... }: { oizys = { vpn = enabled; @@ -11,6 +11,7 @@ }; vbox = enabled; backups = enabled; + hp-scanner = enabled; languages = [ "misc" "nim" @@ -33,5 +34,5 @@ ]; }; - users.users.daylin.extraGroups = [ "audio" ]; + users.users.${config.oizys.user}.extraGroups = [ "audio" ]; } diff --git a/hosts/othalan/system.nix b/hosts/othalan/system.nix index 66ceebd..b2b577c 100644 --- a/hosts/othalan/system.nix +++ b/hosts/othalan/system.nix @@ -1,4 +1,9 @@ -{ pkgs, enabled, ... }: +{ + pkgs, + enabled, + config, + ... +}: { networking.networkmanager = enabled; services.fwupd = enabled; @@ -7,13 +12,6 @@ }; services.printing = enabled; - hardware.sane = enabled // { - extraBackends = [ pkgs.hplipWithPlugin ]; - }; - users.users.daylin.extraGroups = [ - "scanner" - "lp" - ]; # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/lenovo/thinkpad/x1/9th-gen/default.nix # https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/common/pc/ssd/default.nix diff --git a/modules/oizys.nix b/modules/oizys.nix index 46f1516..516d5a2 100644 --- a/modules/oizys.nix +++ b/modules/oizys.nix @@ -28,6 +28,7 @@ in gui fonts + hp-scanner languages diff --git a/modules/services/scanner/hp-scanner.nix b/modules/services/scanner/hp-scanner.nix new file mode 100644 index 0000000..0f5d9c7 --- /dev/null +++ b/modules/services/scanner/hp-scanner.nix @@ -0,0 +1,25 @@ +{ + enabled, + config, + pkgs, + mkOizysModule, + ... +}: +mkOizysModule config "hp-scanner" { + + environment.systemPackages = [ pkgs.skanpage ]; + + hardware.sane = enabled // { + extraBackends = [ pkgs.hplipWithPlugin ]; + }; + + services.avahi = enabled // { + nssmdns4 = true; + }; + + users.users.${config.oizys.user}.extraGroups = [ + "scanner" + "lp" + ]; + +}