feat: the stuff of nightmares

This commit is contained in:
Kat Inskip 2023-02-15 15:53:38 -08:00
parent b589fdda9f
commit 3a29446c96
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
51 changed files with 679 additions and 1094 deletions

0
nixos/hardware/.keep Normal file
View file

View file

@ -0,0 +1,55 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ bluez5-experimental ];
environment.etc = {
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
hardware.bluetooth = {
enable = true;
package = pkgs.bluez5-experimental;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
services = {
blueman.enable = true;
pipewire.media-session.config.bluez-monitor = {
properties = { };
rules = [
{
actions = {
update-props = {
"bluez5.a2dp-source-role" = "input";
"bluez5.auto-connect" = [ "hfp_hf" "hsp_hs" "a2dp_sink" "a2dp_source" "hsp_ag" "hfp_ag" ];
};
};
matches = [ { "device.name" = "~bluez_card.*"; } ];
}
{
actions = {
update-props = { "node.pause-on-idle" = false; };
};
matches = [ { "node.name" = "~bluez_input.*"; } { "node.name" = "~bluez_output.*"; } ];
}
];
};
};
home-manager.sharedModules = [
{
xsession.preferStatusNotifierItems = true;
services.blueman-applet.enable = true;
}
];
}

View file

@ -0,0 +1,26 @@
{ lib, tree, ... }: with lib; let
profiles = tree.prev;
appendedProfiles = {
common-wifi-bt = {
imports = with profiles; [
wifi
bluetooth
];
};
laptop = {
imports = with profiles; [
laptop
sound
];
};
lenovo-thinkpad-x260 = {
imports = with profiles; [
lenovo-thinkpad-x260
lenovo-thinkpad-x260-local
appendedProfiles.laptop
appendedProfiles.common-wifi-bt
];
};
};
in
profiles // appendedProfiles

33
nixos/hardware/laptop.nix Normal file
View file

@ -0,0 +1,33 @@
{lib, pkgs, ...}: let
inherit (lib.modules) mkDefault mkOrder;
in {
powerManagement.cpuFreqGovernor = mkDefault "powersave";
programs.light.enable = true;
home-manager.sharedModules = [
{
programs.waybar.settings.main = {
modules-right = [
"backlight"
"battery"
];
backlight = {
format = " {percent}%";
on-scroll-up = "${pkgs.light}/bin/light -A 1";
on-scroll-down = "${pkgs.light}/bin/light -U 1";
};
battery = {
states = {
good = 90;
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [ "" "" "" "" "" ];
};
};
}
];
}

View file

@ -0,0 +1,19 @@
{lib, ...}: let
in {
boot = {
initrd.availableKernelModules =
[ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ];
kernelModules = [ "kvm-intel" ];
};
home-manager.sharedModules = [
{
wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
click_method = "clickfinger";
};
}
];
}

67
nixos/hardware/sound.nix Normal file
View file

@ -0,0 +1,67 @@
{lib, pkgs, ...}: let
inherit (lib.modules) mkDefault mkOrder;
in {
environment.systemPackages = with pkgs; [ pulsemixer ];
sound = {
enable = true;
extraConfig = ''
defaults.pcm.rate_converter "speexrate_best"
'';
};
security.rtkit.enable = true;
services.pipewire = {
enable = true;
config = {
pipewire = {
"context.properties" = {
"log.level" = 2;
"default.clock.min-quantum" =
32; # default; going lower may cause crackles and distorted audio
};
pipewire-pulse = {
"context.modules" = [{
name = "libpipewire-module-protocol-pulse";
args = {
"pulse.min.quantum" = 32; # controls minimum playback quant
"pulse.min.req" = 32; # controls minimum recording quant
"pulse.min.frag" = 32; # controls minimum fragment size
"server.address" =
[ "unix:native" ]; # the default address of the server
};
}];
};
};
};
pulse.enable = true;
alsa.support32Bit = true;
jack.enable = true;
alsa.enable = true;
};
home-manager.sharedModules = [
{
programs.waybar.settings.main = {
modules-right = [
"pulseaudio"
];
pulseaudio = {
format = "{icon} {volume}%";
format-muted = "";
on-click = "${pkgs.wezterm}/bin/wezterm start ${pkgs.pulsemixer}/bin/pulsemixer";
format-icons = {
headphone = "";
headset = "";
default = [
""
""
""
];
};
};
};
}
];
}

26
nixos/hardware/wifi.nix Normal file
View file

@ -0,0 +1,26 @@
{ lib, pkgs, ... }: let
inherit (lib.modules) mkForce;
in {
systemd.services.NetworkManager-wait-online = {
serviceConfig.ExecStart = [ "" "${pkgs.networkmanager}/bin/nm-online -q" ];
};
networking = {
firewall = {
allowedUDPPorts = [ 5353 ]; # MDNS
allowedUDPPortRanges = [ { from = 32768; to=60999; } ]; # Ephemeral / Chromecast
};
networkmanager = {
enable = true;
connectionConfig = {
"ipv6.ip6-privacy" = mkForce 0;
};
};
};
home-manager.sharedModules = [
{
xsession.preferStatusNotifierItems = true;
services.network-manager-applet.enable = true;
}
];
}