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

View file

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

File diff suppressed because it is too large Load diff