From 80837514caf0ee93b53d1a3e33bc57ed747179ea Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sat, 29 Apr 2023 12:36:57 +0100 Subject: [PATCH] Add hardware section to control bluetooth and audio setup for NixOS --- nixos/H0615.nix | 3 ++- nixos/J0162.nix | 4 +++- nixos/Vanguard.nix | 4 ++-- nixos/common.nix | 2 +- nixos/desktop/default.nix | 21 --------------------- nixos/desktop/hyprland.nix | 5 ++--- nixos/desktop/sddm.nix | 1 + nixos/desktop/xserver.nix | 2 ++ nixos/hardware/audio.nix | 19 +++++++++++++++++++ nixos/hardware/bluetooth.nix | 8 ++++++++ 10 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 nixos/hardware/audio.nix create mode 100644 nixos/hardware/bluetooth.nix diff --git a/nixos/H0615.nix b/nixos/H0615.nix index 49b6fb9e..c5acd036 100644 --- a/nixos/H0615.nix +++ b/nixos/H0615.nix @@ -6,8 +6,9 @@ in imports = [ (import "${home-manager}/nixos") ./common.nix + ./hardware/audio.nix + ./hardware/bluetooth.nix ./locales/en_GB.nix - ./desktop/plasma.nix ./desktop/hyprland.nix ]; diff --git a/nixos/J0162.nix b/nixos/J0162.nix index 9242612d..74942680 100644 --- a/nixos/J0162.nix +++ b/nixos/J0162.nix @@ -6,8 +6,10 @@ in imports = [ (import "${home-manager}/nixos") ./common.nix + ./hardware/audio.nix + ./hardware/bluetooth.nix ./locales/en_GB.nix - ./desktop/plasma.nix + ./desktop/hyprland.nix ]; networking.hostName = "J0162"; # Define your hostname. diff --git a/nixos/Vanguard.nix b/nixos/Vanguard.nix index d212d141..8f48458d 100644 --- a/nixos/Vanguard.nix +++ b/nixos/Vanguard.nix @@ -6,8 +6,9 @@ in imports = [ (import "${home-manager}/nixos") ./common.nix + ./hardware/audio.nix + ./hardware/bluetooth.nix ./locales/en_GB.nix - ./desktop/plasma.nix ./desktop/hyprland.nix ]; @@ -32,7 +33,6 @@ in # Extra hardware configuration # For Steam support hardware.opengl.driSupport32Bit = true; - hardware.bluetooth.enable = true; hardware.openrazer = { enable = true; users = [ "xenia" ]; diff --git a/nixos/common.nix b/nixos/common.nix index 42c6893d..8bda5f30 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -20,7 +20,7 @@ glxinfo ]; - + fonts.fontconfig.enable = true; programs.ssh.startAgent = true; programs.fish.enable = true; programs.zsh = { diff --git a/nixos/desktop/default.nix b/nixos/desktop/default.nix index b89ab6fd..c62047cd 100644 --- a/nixos/desktop/default.nix +++ b/nixos/desktop/default.nix @@ -1,25 +1,4 @@ { pkgs, ... }: { - # Enable CUPS to print documents. - services.printing.enable = true; - programs.dconf.enable = true; - - # environment.systemPackages = [ - # pkgs.pavucontrol - # pkgs.pamixer - # pkgs.pulseaudio - # ]; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - programs.noisetorch.enable = true; } diff --git a/nixos/desktop/hyprland.nix b/nixos/desktop/hyprland.nix index 886fccc7..5006d2b7 100644 --- a/nixos/desktop/hyprland.nix +++ b/nixos/desktop/hyprland.nix @@ -1,8 +1,6 @@ { ... }: { - imports = [ - ./default.nix - ]; + imports = [ ./sddm.nix ]; nixpkgs.overlays = [ (self: super: { waybar = super.waybar.overrideAttrs (oldAttrs: { @@ -10,6 +8,7 @@ }); }) ]; + programs.dconf.enable = true; security.pam.services.swaylock = { }; programs.hyprland = { enable = true; diff --git a/nixos/desktop/sddm.nix b/nixos/desktop/sddm.nix index c9212d44..e17f1ad9 100644 --- a/nixos/desktop/sddm.nix +++ b/nixos/desktop/sddm.nix @@ -3,6 +3,7 @@ let sddm-catppuccin-macchiato = pkgs.callPackage ./pkgs/sddm-catppuccin-macchiato.nix { }; in { + services.xserver.enable = true; services.xserver.displayManager.sddm = { enable = true; theme = "catppuccin-macchiato"; diff --git a/nixos/desktop/xserver.nix b/nixos/desktop/xserver.nix index 8708d7dc..413a6c40 100644 --- a/nixos/desktop/xserver.nix +++ b/nixos/desktop/xserver.nix @@ -10,4 +10,6 @@ }; console.keyMap = "uk"; + + programs.dconf.enable = true; } diff --git a/nixos/hardware/audio.nix b/nixos/hardware/audio.nix new file mode 100644 index 00000000..e6a9dc1b --- /dev/null +++ b/nixos/hardware/audio.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: +{ + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + programs.noisetorch.enable = true; + environment.systemPackages = [ + pkgs.pavucontrol + pkgs.pamixer + pkgs.pulseaudio + ]; +} diff --git a/nixos/hardware/bluetooth.nix b/nixos/hardware/bluetooth.nix new file mode 100644 index 00000000..4c6d85c5 --- /dev/null +++ b/nixos/hardware/bluetooth.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; + services.blueman.enable = true; +}