dotfiles/nixos/common-hardware.nix

121 lines
2.9 KiB
Nix
Raw Normal View History

2023-08-13 17:00:41 +01:00
{
config,
pkgs,
nixpkgs-nixos-unstable-and-unfree,
lib,
...
}: {
boot.kernelModules = ["fuse"];
2020-03-20 13:09:39 +00:00
services.smartd.enable = true;
2019-07-18 22:17:36 +01:00
sound.enable = true;
2020-03-20 13:09:39 +00:00
2021-11-04 20:32:40 +00:00
networking.networkmanager = {
enable = true;
2023-08-13 17:00:41 +01:00
dispatcherScripts = [
{
source = pkgs.writeText "upHook" ''
enable_disable_wifi ()
{
result=$(nmcli dev | grep "ethernet" | grep -w "connected")
if [ -n "$result" ]; then
nmcli radio wifi off
else
nmcli radio wifi on
fi
}
2022-03-08 12:50:16 +00:00
2023-08-13 17:00:41 +01:00
if [ "$2" = "up" ]; then
enable_disable_wifi
fi
2023-08-13 17:00:41 +01:00
if [ "$2" = "down" ]; then
enable_disable_wifi
fi
'';
type = "basic";
}
];
2021-11-04 20:32:40 +00:00
};
2020-03-20 13:09:39 +00:00
2019-07-18 22:17:36 +01:00
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
2020-04-26 14:08:40 +01:00
2019-07-18 22:17:36 +01:00
hardware.bluetooth = {
enable = true;
package = pkgs.bluezFull;
2023-08-13 17:00:41 +01:00
settings = {General = {Enable = "Source,Sink,Media,Socket";};};
2019-07-18 22:17:36 +01:00
};
2020-06-13 08:57:23 +01:00
services.blueman.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#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)
#media-session.enable = true;
};
2023-08-13 17:00:41 +01:00
environment.systemPackages = with pkgs; [ghostscript poppler];
2020-04-26 13:23:27 +01:00
services.printing = {
enable = true;
2022-03-08 12:50:16 +00:00
drivers = with pkgs; [
epson-escpr
nixpkgs-nixos-unstable-and-unfree.samsung-unified-linux-driver
gutenprint
];
extraConf = ''
Option pdftops-renderer hybrid
'';
2020-04-26 13:23:27 +01:00
};
2021-09-22 22:23:45 +01:00
hardware.printers.ensurePrinters = [
{
2021-10-01 10:22:46 +01:00
description = "Epson XP-540 via bolty";
name = "epson_xp540_via_bolty";
deviceUri = "ipp://bolty:631/printers/epson_xp540";
2023-08-13 17:00:41 +01:00
model = "epson-inkjet-printer-escpr/Epson-XP-540_Series-epson-escpr-en.ppd";
2022-03-08 12:50:16 +00:00
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
};
2021-09-22 22:23:45 +01:00
}
{
description = "Samsung SCX-4623 Series";
name = "samsung-SCX-4623";
2023-08-13 17:00:41 +01:00
deviceUri = "usb://Samsung/SCX-4623%20Series?serial=Z2TYBFFZC01007W&interface=1";
2021-09-22 22:23:45 +01:00
model = "samsung/SCX-4623FW.ppd";
2022-03-08 12:50:16 +00:00
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
};
2021-09-22 22:23:45 +01:00
}
];
2020-04-26 13:23:27 +01:00
2023-08-13 17:00:41 +01:00
services.udev.packages = [];
2020-04-26 14:08:40 +01:00
hardware.sane = {
enable = true;
2022-08-04 09:55:44 +01:00
snapshot = true;
extraBackends = with pkgs; [
nixpkgs-nixos-unstable-and-unfree.samsung-unified-linux-driver
sane-airscan
gawk
];
2020-04-26 14:08:40 +01:00
};
2021-11-12 22:36:04 +00:00
powerManagement = {
2022-05-02 09:59:47 +01:00
enable = lib.mkForce true;
2021-11-12 22:36:04 +00:00
resumeCommands = ''
${pkgs.autorandr}/bin/autorandr -c
'';
powertop.enable = true;
};
2019-07-18 22:17:36 +01:00
}