Format with Alejandra. Prepare for flakes.

This commit is contained in:
Jimbo 2024-08-22 23:27:34 -04:00
parent e402113111
commit 85f4107c82
3 changed files with 1461 additions and 1204 deletions

View file

@ -1,10 +1,14 @@
{ config, pkgs, options, lib, ... }: {
let config,
pkgs,
options,
lib,
...
}: let
# Set common boot paramaters # Set common boot paramaters
commonKernelParams = [ commonKernelParams = [
# Nvidia settings # Nvidia settings
"nvidia_drm.fbdev=1" "nvidia_drm.fbdev=1"
"nouveau.config=NvGspRm=1"
# VM/GPU passthrough # VM/GPU passthrough
"amd_iommu=on" "amd_iommu=on"
@ -18,12 +22,11 @@ let
"pcie_acs_override=downstream,multifunction" "pcie_acs_override=downstream,multifunction"
"pci=routeirq" "pci=routeirq"
]; ];
in in {
{
# Import other nix files and firmware # Import other nix files and firmware
imports = let imports = let
homeManager = fetchTarball homeManager =
fetchTarball
"https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz"; "https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz";
in [ in [
./hardware-configuration.nix ./hardware-configuration.nix
@ -36,12 +39,18 @@ in
config = { config = {
allowUnfree = true; allowUnfree = true;
packageOverrides = pkgs: { packageOverrides = pkgs: {
unstable = import (fetchTarball unstable =
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz" import (
){ inherit pkgs; config.allowUnfree = true; }; fetchTarball
nur = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
"https://github.com/nix-community/NUR/archive/master.tar.gz" ) {
){ inherit pkgs; }; inherit pkgs;
config.allowUnfree = true;
};
nur = import (
fetchTarball
"https://github.com/nix-community/NUR/archive/master.tar.gz"
) {inherit pkgs;};
}; };
}; };
@ -50,8 +59,7 @@ in
# MPV scripts # MPV scripts
(self: super: { (self: super: {
mpv = super.mpv.override { mpv = super.mpv.override {
scripts = with self.mpvScripts; scripts = with self.mpvScripts; [mpris sponsorblock thumbnail];
[ mpris sponsorblock thumbnail ];
}; };
}) })
]; ];
@ -59,7 +67,7 @@ in
# Allow flakes and enable garbage collection # Allow flakes and enable garbage collection
nix = { nix = {
settings.experimental-features = [ "nix-command" "flakes" ]; settings.experimental-features = ["nix-command" "flakes"];
gc = { gc = {
automatic = true; automatic = true;
dates = "weekly"; dates = "weekly";
@ -71,9 +79,9 @@ in
boot = { boot = {
# Set a kernel version and load/blacklist drivers # Set a kernel version and load/blacklist drivers
kernelPackages = pkgs.unstable.linuxPackages_zen; kernelPackages = pkgs.unstable.linuxPackages_zen;
blacklistedKernelModules = [ "pcspkr" ]; blacklistedKernelModules = ["pcspkr"];
kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:1f82,10de:10fa" ]; kernelParams = commonKernelParams ++ ["vfio-pci.ids=10de:1f82,10de:10fa"];
initrd.kernelModules = [ "vfio" "vfio_pci" "vfio_iommu_type1" ]; initrd.kernelModules = ["vfio" "vfio_pci" "vfio_iommu_type1"];
kernel.sysctl."vm.max_map_count" = 2147483642; kernel.sysctl."vm.max_map_count" = 2147483642;
# Manage supported filesystems # Manage supported filesystems
@ -97,7 +105,7 @@ in
# Additional entry to boot from the second GPU # Additional entry to boot from the second GPU
specialisation = { specialisation = {
gputwo.configuration = { gputwo.configuration = {
boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ]; boot.kernelParams = commonKernelParams ++ ["vfio-pci.ids=10de:2504,10de:228e"];
}; };
}; };
@ -105,7 +113,7 @@ in
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
# Enable video drivers # Enable video drivers
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; modesetting.enable = true;
nvidiaSettings = false; nvidiaSettings = false;
@ -120,7 +128,11 @@ in
enable = true; enable = true;
extraRules = [ extraRules = [
# Give wheel root access, allow persistant session # Give wheel root access, allow persistant session
{ groups = [ "wheel" ]; keepEnv = true; persist = true; } {
groups = ["wheel"];
keepEnv = true;
persist = true;
}
]; ];
}; };
}; };
@ -138,17 +150,24 @@ in
users.users.jimbo = { users.users.jimbo = {
description = "Jimbo Awesome"; description = "Jimbo Awesome";
isNormalUser = true; isNormalUser = true;
hashedPassword = hashedPassword = "$6$gYpE.pG/zPXgin06$2kydjDfd0K62Dhf9P0PFvJhRNz6xIC/bHYaf/XYqyKcLyZNzPQpy8uy9tCRcSYlj1wwBhzVtTRyItwajOHCEj0";
"$6$gYpE.pG/zPXgin06$2kydjDfd0K62Dhf9P0PFvJhRNz6xIC/bHYaf/XYqyKcLyZNzPQpy8uy9tCRcSYlj1wwBhzVtTRyItwajOHCEj0";
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIKC8Uqxb09V3msBgDv6lD/nETMYr/X0OgtpDo8ldcMK jimbo@JimDebianServer" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIKC8Uqxb09V3msBgDv6lD/nETMYr/X0OgtpDo8ldcMK jimbo@JimDebianServer"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDLe/HioxCOkszFQdm1vb3ZwuzLzsOThqHNvEI4IXeXZ JimPhone" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDLe/HioxCOkszFQdm1vb3ZwuzLzsOThqHNvEI4IXeXZ JimPhone"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPeqiMCRXtpoP+BvKBmzvkL7oLKKCmbfdaQIF3yk/S8I jimbo@DV-JHAMPTON-NIXOS" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPeqiMCRXtpoP+BvKBmzvkL7oLKKCmbfdaQIF3yk/S8I jimbo@DV-JHAMPTON-NIXOS"
]; ];
extraGroups = [ extraGroups = [
"wheel" "audio" "video" "input" "disk" "wheel"
"dialout" "networkmanager" "rtkit" "audio"
"kvm" "libvirtd" "qemu-libvirtd" "video"
"input"
"disk"
"dialout"
"networkmanager"
"rtkit"
"kvm"
"libvirtd"
"qemu-libvirtd"
]; ];
uid = 1000; uid = 1000;
shell = pkgs.zsh; shell = pkgs.zsh;
@ -157,14 +176,19 @@ in
# Install programs system-wide # Install programs system-wide
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# Essential system tools # Essential system tools
cifs-utils parted git cifs-utils
parted
git
# Printer control # Printer control
system-config-printer system-config-printer
# Virtual machines # Virtual machines
virt-manager virtiofsd dnsmasq virt-manager
spice-vdagent looking-glass-client virtiofsd
dnsmasq
spice-vdagent
looking-glass-client
]; ];
# Disable the HTML documentation link # Disable the HTML documentation link
@ -206,14 +230,14 @@ in
ip saddr 10.0.0.2 accept comment "Accept Server Connections" ip saddr 10.0.0.2 accept comment "Accept Server Connections"
''; '';
}; };
# Enable nftables over iptables # Enable nftables over iptables
nftables.enable = true; nftables.enable = true;
# Set hostnames # Set hostnames
hosts = { hosts = {
"10.0.0.2" = [ "server" ]; "10.0.0.2" = ["server"];
"10.0.0.3" = [ "pc" ]; "10.0.0.3" = ["pc"];
}; };
}; };
@ -227,7 +251,7 @@ in
}; };
# Enable lingering for Bluetooth and allow Looking-Glass permissions # Enable lingering for Bluetooth and allow Looking-Glass permissions
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"f /var/lib/systemd/linger/jimbo" "f /var/lib/systemd/linger/jimbo"
"f /dev/shm/looking-glass 0660 jimbo libvirtd -" "f /dev/shm/looking-glass 0660 jimbo libvirtd -"
]; ];
@ -249,7 +273,7 @@ in
destination = "/etc/udev/rules.d/10-pdp.rules"; destination = "/etc/udev/rules.d/10-pdp.rules";
}; };
in { in {
packages = [ oculusRules pdpRules ]; packages = [oculusRules pdpRules];
}; };
# Enable audio # Enable audio
@ -271,10 +295,15 @@ in
# Fonts # Fonts
fonts = { fonts = {
packages = with pkgs; [ packages = with pkgs; [
liberation_ttf twitter-color-emoji ubuntu_font_family noto-fonts sarasa-gothic liberation_ttf
orbitron (nerdfonts.override { fonts = [ "UbuntuMono" ]; }) twitter-color-emoji
ubuntu_font_family
noto-fonts
sarasa-gothic
orbitron
(nerdfonts.override {fonts = ["UbuntuMono"];})
]; ];
fontconfig.defaultFonts.emoji = [ "Twitter Color Emoji" ]; fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"];
}; };
# Enable Dconf and some portals # Enable Dconf and some portals
@ -295,7 +324,7 @@ in
}; };
}; };
}; };
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; extraPortals = with pkgs; [xdg-desktop-portal-gtk];
}; };
# Configure greetd for remote login # Configure greetd for remote login
@ -311,11 +340,11 @@ in
else else
: :
fi fi
# Sway/Wayland # Sway/Wayland
export XDG_CURRENT_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway
export QT_QPA_PLATFORM="wayland;xcb" export QT_QPA_PLATFORM="wayland;xcb"
# Start Sway # Start Sway
sway --unsupported-gpu sway --unsupported-gpu
''; '';
@ -345,7 +374,7 @@ in
services = { services = {
printing = { printing = {
enable = true; enable = true;
drivers = with pkgs; [ hplip ]; drivers = with pkgs; [hplip];
webInterface = false; webInterface = false;
}; };
avahi = { avahi = {
@ -364,7 +393,7 @@ in
qemu = { qemu = {
ovmf = { ovmf = {
enable = true; enable = true;
packages = [ pkgs.OVMFFull.fd ]; packages = [pkgs.OVMFFull.fd];
}; };
swtpm.enable = true; swtpm.enable = true;
}; };
@ -392,8 +421,8 @@ in
# Enable AppImages # Enable AppImages
programs.appimage = { programs.appimage = {
enable = true; enable = true;
binfmt = true; binfmt = true;
}; };
# Enable Sunshine as a service # Enable Sunshine as a service

View file

@ -1,8 +1,11 @@
# This file was generated by 'nixos-generate-config' # This file was generated by 'nixos-generate-config', try not to modify too much
# and may be overwritten by future invocations.
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
@ -10,11 +13,11 @@
# Load kernel modules on boot # Load kernel modules on boot
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
kernelModules = [ ]; kernelModules = [];
}; };
kernelModules = [ "kvm-amd" ]; kernelModules = ["kvm-amd"];
extraModulePackages = [ ]; extraModulePackages = [];
}; };
# Mount everything as necessary # Mount everything as necessary
@ -29,42 +32,42 @@
}; };
"/etc/libvirt" = { "/etc/libvirt" = {
device = "/dev/disk/by-label/Qemu"; device = "/dev/disk/by-label/Qemu";
options = [ "nosuid" "nodev" "nofail" ] ; options = ["nosuid" "nodev" "nofail"];
}; };
"/var/lib/libvirt" = { "/var/lib/libvirt" = {
depends = [ "/etc/libvirt" ]; depends = ["/etc/libvirt"];
device = "/etc/libvirt/varlibvirt"; device = "/etc/libvirt/varlibvirt";
options = [ "bind" "rw" ]; options = ["bind" "rw"];
}; };
"/mnt/Linux1" = { "/mnt/Linux1" = {
device = "/dev/disk/by-label/Linux1"; device = "/dev/disk/by-label/Linux1";
options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ]; options = ["nosuid" "nodev" "nofail" "x-gvfs-show"];
}; };
"/mnt/Linux2" = { "/mnt/Linux2" = {
device = "/dev/disk/by-label/Linux2"; device = "/dev/disk/by-label/Linux2";
options = [ "nosuid" "nodev" "nofail" "x-gvfs-show" ]; options = ["nosuid" "nodev" "nofail" "x-gvfs-show"];
}; };
"/mnt/Windows1" = { "/mnt/Windows1" = {
device = "/dev/disk/by-label/Windows1"; device = "/dev/disk/by-label/Windows1";
options = [ "nosuid" "nodev" "noauto" ]; options = ["nosuid" "nodev" "noauto"];
}; };
"/mnt/Windows2" = { "/mnt/Windows2" = {
device = "/dev/disk/by-label/Windows2"; device = "/dev/disk/by-label/Windows2";
options = [ "nosuid" "nodev" "noauto" ]; options = ["nosuid" "nodev" "noauto"];
}; };
"/home/jimbo/JimboNFS" = { "/home/jimbo/JimboNFS" = {
device = "server:/export/JimboNFS"; device = "server:/export/JimboNFS";
fsType = "nfs4"; fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ]; options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
}; };
}; };
# Set the swap partition # Set the swap partition
swapDevices = [ swapDevices = [
{ device = "/dev/disk/by-uuid/2e4c5120-716d-4cdc-84a0-c9e6391760db"; } {device = "/dev/disk/by-uuid/2e4c5120-716d-4cdc-84a0-c9e6391760db";}
]; ];
# Enables DHCP on each ethernet and wireless interface. # Enables DHCP on each ethernet and wireless interface.
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp42s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp42s0.useDHCP = lib.mkDefault true;

File diff suppressed because it is too large Load diff