diff --git a/default.nix b/default.nix index feec78f..929be2f 100644 --- a/default.nix +++ b/default.nix @@ -6,13 +6,21 @@ in { options.grimmShared = { enable = mkEnableOption "grimm-shared-modules"; - enableLocale = mkOption { + locale = mkOption { type = types.bool; default = true; description = "Sets german units but english language"; }; + + printing = mkOption { + type = types.bool; + default = true; + description = "Enables print and scan related options"; + }; }; - imports = [./modules/localisation.nix] - ; + imports = [ + ./modules/localisation.nix + ./modules/printing.nix + ]; } diff --git a/modules/localisation.nix b/modules/localisation.nix index 43593d8..f82be35 100644 --- a/modules/localisation.nix +++ b/modules/localisation.nix @@ -1,7 +1,7 @@ { config, lib, ... }: let cfg = config.grimmShared; in { - config = with cfg; lib.mkIf (enable && enableLocale) { + config = with cfg; lib.mkIf (enable && locale) { time.timeZone = "Europe/Berlin"; # Select internationalisation properties. diff --git a/modules/printing.nix b/modules/printing.nix new file mode 100644 index 0000000..a05221d --- /dev/null +++ b/modules/printing.nix @@ -0,0 +1,16 @@ +{ pkgs, config, lib, ... }: let + cfg = config.grimmShared; +in { + config = with cfg; lib.mkIf (enable && printing) { + # Enable CUPS to print documents. + services.printing.enable = true; + services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ]; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + services.printing.cups-pdf.enable = true; + hardware.sane.brscan4.enable = true; # enables support for SANE scanners + }; +}