128 lines
4.8 KiB
Nix
128 lines
4.8 KiB
Nix
# Edit this configuration file to define what should be installed on
|
||
# your system. Help is available in the configuration.nix(5) man page
|
||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||
|
||
{ config, pkgs, lib, inputs, ... }:
|
||
|
||
{
|
||
imports =
|
||
[ # Include the results of the hardware scan.
|
||
./hardware-configuration.nix
|
||
./../../modules/nixos/cspark-single-gpu-passthru/module.nix
|
||
./../../modules/nixos/cspark-desktop-plasma/module.nix
|
||
./../../modules/nixos/cspark-desktop-gnome/module.nix
|
||
./../../modules/nixos/cspark-desktop-sway/module.nix
|
||
./../../modules/nixos/cspark-desktop-niri/module.nix
|
||
./../../modules/nixos/cspark-desktop-exwm/module.nix
|
||
inputs.home-manager.nixosModules.default
|
||
];
|
||
|
||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||
|
||
# Bootloader.
|
||
boot.loader.systemd-boot.enable = true;
|
||
boot.loader.efi.canTouchEfiVariables = true;
|
||
|
||
networking.hostName = "cspark-nixos-desktop"; # Define your hostname.
|
||
|
||
# Enable networking
|
||
networking.networkmanager.enable = true;
|
||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||
|
||
# Enable musnix, a module for real-time audio.
|
||
#musnix.enable = false;
|
||
#musnix.kernel.realtime = true; # Realtime kernel
|
||
#musnix.kernel.packages = pkgs.linuxPackages_latest_rt; # Latest kernel
|
||
|
||
# Custom desktop environments
|
||
# cspark-desktop-plasma.enable = true;
|
||
# cspark-desktop-gnome.enable = true;
|
||
# cspark-desktop-sway.enable = true;
|
||
cspark-desktop-niri.enable = true;
|
||
# cspark-desktop-exwm.enable = true;
|
||
|
||
# This user handles building packages remotely for my laptop
|
||
users.users.nixremotebuilder = {
|
||
isNormalUser = true;
|
||
description = "Nix Remote Builder";
|
||
openssh.authorizedKeys.keyFiles = [ ./resources/nixos/.ssh/cspark-desktop-nixremotebuilder.pub ];
|
||
};
|
||
nix.settings.trusted-users = [ "root" "nixremotebuilder" "@wheel" ];
|
||
|
||
# My audio interface has issues after coming out from suspend/hibernate, this will reset it to fix it when necessary.
|
||
systemd.services.audiointerface-reset-unbind = {
|
||
description = "Resets audio interface to clear up any issues - de-initialises audio interface before sleeping/hibernating/shutting down";
|
||
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "shutdown.target" ];
|
||
before = [ "systemd-suspend.service" "systemd-hibernate.service" "systemd-hybrid-sleep.service" "shutdown.target" ];
|
||
path = with pkgs; [ bash coreutils kmod ];
|
||
enable = true;
|
||
serviceConfig = {
|
||
User = "root";
|
||
Group = "root";
|
||
};
|
||
script = "
|
||
# Unbind audio interface
|
||
echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/unbind
|
||
# Remove snd_usb_audio once no longer in use
|
||
while ! modprobe -r snd_usb_audio; do
|
||
sleep 1
|
||
done
|
||
";
|
||
};
|
||
systemd.services.audiointerface-reset-bind = {
|
||
description = "Resets audio interface to clear up any issues - re-initialises audio interface after sleeping/hibernating";
|
||
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
|
||
after = [ "systemd-suspend.service" "systemd-hibernate.service" "systemd-hybrid-sleep.service" ];
|
||
path = with pkgs; [ bash coreutils kmod systemd ];
|
||
enable = true;
|
||
serviceConfig = {
|
||
User = "root";
|
||
Group = "root";
|
||
};
|
||
script = "
|
||
systemctl stop audiointerface-reset-unbind.service
|
||
modprobe snd_usb_audio
|
||
# Rebind audio interface
|
||
echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/bind
|
||
";
|
||
};
|
||
|
||
# Home Manager Configuration
|
||
home-manager = {
|
||
extraSpecialArgs = { inherit inputs; };
|
||
users = {
|
||
"cspark" = import ./home.nix;
|
||
};
|
||
};
|
||
|
||
# Single GPU Passthru Configuration
|
||
#cspark-single-gpu-passthru.enable = true;
|
||
#cspark-single-gpu-passthru.vmName = "win11";
|
||
#cspark-single-gpu-passthru.gpuPCI = "0000:08:00.0";
|
||
#cspark-single-gpu-passthru.gpuAudioPCI = "0000:08:00.1";
|
||
|
||
# Waydroid Android Emulation
|
||
#virtualisation.waydroid.enable = true;
|
||
|
||
# Docker for development
|
||
virtualisation.docker.enable = true;
|
||
|
||
# List packages installed in system profile. To search, run:
|
||
# $ nix search wget
|
||
environment.systemPackages = with pkgs; [
|
||
nvtopPackages.amd
|
||
|
||
# Use the android-studio-full attribute for a very complete Android SDK, including system images
|
||
#android-studio
|
||
];
|
||
|
||
#environment.variables = {
|
||
# VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/radeon_icd.i686.json";
|
||
#};
|
||
|
||
#environment.sessionVariables = {
|
||
# VK_ICD_FILENAMES = "/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/radeon_icd.i686.json";
|
||
#};
|
||
|
||
}
|