diff --git a/hardware/printer/discover.nix b/hardware/printer/discover.nix new file mode 100644 index 0000000..2ffddf0 --- /dev/null +++ b/hardware/printer/discover.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, ... }: +{ + + # airprint + # https://wiki.nixos.org/wiki/Printing#Printer_sharing + + services.avahi = { + enable = lib.mkDefault true; + nssmdns = true; + openFirewall = true; # opens UDP port 5353 + }; + services.printing = { + enable = lib.mkDefault true; + drivers = [ + pkgs.cups-filters + pkgs.cups-browsed + ]; + }; + +} diff --git a/hardware/printer/hp-laserjet-p1005.nix b/hardware/printer/hp-laserjet-p1005.nix index eee31ee..8cac8c1 100644 --- a/hardware/printer/hp-laserjet-p1005.nix +++ b/hardware/printer/hp-laserjet-p1005.nix @@ -1,25 +1,25 @@ { lib, pkgs, ... }: { - imports = [ - ./common-share.nix - ]; + # imports = [ ./share.nix ]; # up to the host to opt-in to # https://wiki.nixos.org/wiki/Printing - services.printing.enable = true; + services.printing.enable = lib.mkDefault true; #services.printing.drivers = with pkgs; [ foo2zjs foomatic-filters cups-filters ]; #services.printing.drivers = with pkgs; [ foo2zjs hplip foomatic-filters cups-filters ]; services.printing.drivers = with pkgs; [ foo2zjs hplipWithPlugin foomatic-filters cups-filters ]; #services.printing.drivers = with pkgs; [ hplipWithPlugin cups-filters ]; - #hardware.printers.ensureDefaultPrinter = lib.mkDefault "HP_LaserJet_P1005"; - hardware.printers.ensurePrinters = lib.singleton { - name = "HP_LaserJet_P1005"; - deviceUri = "hp:/usb/HP_LaserJet_P1005?serial=BC0CAEQ"; # `lpstat -s` # hplip - #deviceUri = "usb://HP/LaserJet%20P1005?serial=BC0CAEQ"; # `lpstat -s` # foo2zjs - model = "HP-LaserJet_P1005.ppd.gz"; # `lpinfo -m` # foo2zjs - #location = ""; - description = "Laser printer"; - ppdOptions.PageSize = "A4"; + hardware.printers = { + ensureDefaultPrinter = lib.mkDefault "HP_LaserJet_P1005"; + ensurePrinters = lib.singleton { + name = "HP_LaserJet_P1005"; + deviceUri = "hp:/usb/HP_LaserJet_P1005?serial=BC0CAEQ"; # `lpstat -s` # hplip + # deviceUri = "usb://HP/LaserJet%20P1005?serial=BC0CAEQ"; # `lpstat -s` # foo2zjs + model = "HP-LaserJet_P1005.ppd.gz"; # `lpinfo -m` # foo2zjs + #location = ""; + description = "Laser printer"; + ppdOptions.PageSize = "A4"; + }; }; services.printing.logLevel = "debug"; diff --git a/hardware/printer/common-share.nix b/hardware/printer/share.nix similarity index 95% rename from hardware/printer/common-share.nix rename to hardware/printer/share.nix index fd569c6..0c16b11 100644 --- a/hardware/printer/common-share.nix +++ b/hardware/printer/share.nix @@ -1,13 +1,15 @@ { lib, pkgs, ... }: { - # airprint + # https://wiki.archlinux.org/title/CUPS/Printer_sharing + # https://wiki.nixos.org/wiki/Printing#Printer_sharing services.avahi = { enable = lib.mkDefault true; nssmdns = true; openFirewall = true; # opens port 5353 + publish.enable = true; publish.userServices = true; }; diff --git a/hosts/nixos/nord/configuration.nix b/hosts/nixos/nord/configuration.nix index d7005a9..539e13f 100644 --- a/hosts/nixos/nord/configuration.nix +++ b/hosts/nixos/nord/configuration.nix @@ -27,6 +27,7 @@ inputs.nixos-hardware.nixosModules.common-gpu-intel-sandy-bridge ../../../hardware/gpu/rocm.nix ../../../hardware/gpu/zluda.nix + ../../../hardware/printer/discover.nix ../../../profiles/hidpi.nix ../../../profiles/nix-ld.nix diff --git a/hosts/nixos/sopp/configuration.nix b/hosts/nixos/sopp/configuration.nix index fe6d9f1..fa18b9f 100644 --- a/hosts/nixos/sopp/configuration.nix +++ b/hosts/nixos/sopp/configuration.nix @@ -51,7 +51,7 @@ ../../../hardware/gpu/intel.nix ../../../hardware/gpu/cuda.nix ../../../hardware/printer/hp-laserjet-p1005.nix - + ../../../hardware/printer/share.nix ../../../profiles/nix-ld.nix ../../../profiles/sshd diff --git a/profiles/base/default.nix b/profiles/base/default.nix index 49c9b13..d37206a 100644 --- a/profiles/base/default.nix +++ b/profiles/base/default.nix @@ -13,7 +13,7 @@ ./vm-variant.nix ./ccache ./../mounts/common-nfs.nix - /* ./profiles/mounts/common-zfs.nix */ + # ./profiles/mounts/common-zfs.nix ]; nixpkgs.overlays = [ diff --git a/profiles/desktop/sound/pipewire.nix b/profiles/desktop/sound/pipewire.nix index b73508c..9ff8411 100644 --- a/profiles/desktop/sound/pipewire.nix +++ b/profiles/desktop/sound/pipewire.nix @@ -1,26 +1,29 @@ -{ pkgs, ... }: +{ config, pkgs, ... }: + +# https://wiki.nixos.org/wiki/PipeWire + { services.pulseaudio.enable = false; # gnome defaults it to true - #sound.enable = true # alsa? likely conflicts with pipewire - #sound.mediaKeys.enable = true # alsa? only enable if headless - services.pipewire.enable = true; - services.pipewire.alsa.enable = true; - services.pipewire.alsa.support32Bit = true; - #services.pipewire.jack.enable = true; - services.pipewire.pulse.enable = true; + services.pipewire = { + enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + + pulse.enable = true; + + jack.enable = true; + }; - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #services.pipewire.media-session.enable = true; environment.systemPackages = with pkgs; [ pavucontrol # volume and defaults easyeffects # eq helvum # patchbay - # carla # VST (TODO: move into a DAW profile?) # TODO: build broken + # carla # VST patchbay (TODO: move into a DAW profile? Can be used for midi) # TODO: build broken ]; # optional, allows Pipewire to use the realtime scheduler for increased performance. - security.rtkit.enable = true; + security.rtkit.enable = config.services.pipewire.jack.enable; } diff --git a/profiles/hidpi.nix b/profiles/hidpi.nix index 8d51552..47e2669 100644 --- a/profiles/hidpi.nix +++ b/profiles/hidpi.nix @@ -1,6 +1,7 @@ { inputs, ... }: { imports = [ + # https://github.com/NixOS/nixos-hardware/blob/master/common/hidpi.nix inputs.nixos-hardware.nixosModules.common-hidpi ]; @@ -10,5 +11,14 @@ # via # https://github.com/samemrecebi FREETYPE_PROPERTIES = "cff:no-stem-darkening=0 autofitter:no-stem-darkening=0"; + + # TODO: enable these? + + # # https://wiki.archlinux.org/title/HiDPI#Qt_5 + # QT_AUTO_SCREEN_SCALE_FACTOR = 1; + # QT_ENABLE_HIGHDPI_SCALING = 1; + + # # https://wiki.archlinux.org/title/HiDPI#GDK_3_(GTK_3) + # GDK_SCALE = 2; }; }