Add bluetooth and audio stuff

This commit is contained in:
askiiart 2024-01-03 18:59:25 -05:00
parent ccabbaafce
commit d1e4f5bb6d
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
4 changed files with 87 additions and 23 deletions

View file

@ -36,7 +36,7 @@ in
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "America/Chicago";
time.timeZone = "America/New_York";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
@ -90,7 +90,7 @@ in
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you

View file

@ -15,7 +15,7 @@ in
# packages and other environment stuff
nixpkgs.config.allowUnfree = true;
environment.systemPackages = [
pkgs.mate.mate-polkit
pkgs.polkit_gnome
pkgs.sway
pkgs.swaybg
pkgs.swaylock
@ -80,26 +80,10 @@ in
# Define a user account. Don't forget to set a password with passwd.
users.users.askiiart = {
isNormalUser = true;
extraGroups = [ "wheel" "libvirtd" ]; # Enable sudo for the user.
extraGroups = [ "wheel" "libvirtd" "audio" ]; # Enable sudo for the user.
shell = pkgs.fish;
};
systemd = {
user.services.polkit-mate-authentication-agent-1 = {
description = "polkit-mate-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
# for qemu
boot.extraModprobeConfig = "options kvm_amd nested=1";
@ -127,4 +111,65 @@ in
services.devmon.enable = true;
services.gvfs.enable = true;
services.udisks2.enable = true;
# polkit config
# allow unprivileged users to reboot and poweroff
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (
subject.isInGroup("users")
&& (
action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions"
)
)
{
return polkit.Result.YES;
}
})
'';
# polkit authentication agent (gnome_polkit)
systemd = {
user.services.polkit-gnome-authentication-agent-1 = {
description = "polkit-gnome-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
# enable bluetooth and fix various audio issues
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
# enable more codecs
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
};
# use bluetooth headset buttons
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
nixpkgs.config.pulseaudio = true;
hardware.pulseaudio.extraConfig = "load-module module-combine-sink module-dbus-protocol";
}