nixfiles/modules/workstation.nix
2021-05-23 23:08:15 -07:00

120 lines
3.0 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.workstation;
in
{
options.workstation = {
enable = mkEnableOption "make my computer work";
user = mkOption {
type = types.str;
description = "The main user of this PC";
};
};
config = mkIf cfg.enable {
# support gay men (and video)
hardware.opengl = {
enable = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
hardware.steam-hardware.enable = true;
hardware.uinput.enable = true;
fonts.fontconfig.cache32Bit = true;
# proton esync
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
security.pam.loginLimits = [
{
domain = "*";
type = "hard";
item = "nofile";
value = "1048576";
}
];
# the user should have some basic permissions lol
users.users."${cfg.user}" = {
extraGroups = [ "adbusers" "audio" "video" "libvirtd" "sway" "wheel" "networkmanager" "docker" "input" "uinput" ];
subUidRanges = [
{
startUid = 100000;
count = 65536;
}
];
subGidRanges = [
{
startGid = 100000;
count = 65536;
}
];
};
# fuck alsa
nixpkgs.config.pulseaudio = true;
# brightness
programs.light.enable = true;
# make fonts not fucked up
fonts.fontconfig.enable = true;
fonts.fontconfig.dpi = lib.mkDefault 96;
fonts.enableDefaultFonts = true;
services.xserver.dpi = lib.mkDefault 96;
# this helps with some compatibility
hardware.pulseaudio.daemon.config = {
"default-sample-rate" = "48000";
};
# networking.networkmanager.ethernet.macAddress = "random";
networking.networkmanager.wifi.macAddress = lib.mkDefault "random";
networking.networkmanager.wifi.scanRandMacAddress = lib.mkDefault true;
# Used for chromecast bullshit
networking.firewall.allowedUDPPortRanges = [
{
from = 32768;
to = 60999;
}
];
# Shit breaks without this lol
services.dbus.packages = [ pkgs.gnome3.dconf ];
# better default swap
boot.kernel.sysctl = { "vm.swappiness" = lib.mkDefault 45; };
# you probably want this system wide?
environment.systemPackages = with pkgs; [
exfat
];
# self explanatory
fuckingprint.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = lib.mkOverride 1100 true;
hardware.pulseaudio.support32Bit = lib.mkDefault true;
hardware.pulseaudio.zeroconf.discovery.enable = lib.mkDefault true;
hardware.pulseaudio.package = pkgs.pulseaudioFull;
hardware.pulseaudio.extraConfig = ''
load-module module-dbus-protocol
'';
# bluetooth
services.blueman.enable = true;
hardware.bluetooth.enable = true;
hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ];
hardware.bluetooth.config.General.Enable = "Source,Sink,Media,Socket";
};
}