Alright this ain't finished cause of the home stuff but I don't wanna lose what I've done. Impermanence, disko, lots of changes. TODO: add modularity to home.

This commit is contained in:
Jimbo 2024-11-02 17:19:40 -04:00
parent 7a3f60038b
commit 15ab10152b
109 changed files with 766 additions and 749 deletions

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
# Programs and apps
../../../modules/home
../../../modules/home/users
../../../modules/home/programs/misc/headless
../../../modules/home/programs/terminal/fastfetch
@ -10,10 +8,7 @@
../../../modules/home/programs/terminal/neovim
../../../modules/home/programs/terminal/ranger
../../../modules/home/programs/terminal/tmux
../../../modules/home/utils/zsh
# Misc
../../../modules/home/programs/terminal/zsh
../../../variables/domains
../../../variables/look/colors/purple
];
}

View file

@ -31,7 +31,7 @@
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/.snapshots" = {
"/snapshots" = {
device = "/dev/disk/by-uuid/e50e186d-e5bc-40b0-9cd7-43b609cde3ea";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];

View file

@ -1,19 +1,15 @@
{ ... }:
{
imports = [
# Programs and apps
../../../modules/home
../../../modules/home/users
../../../modules/home/settings/nix
../../../modules/home/programs/misc/headless
../../../modules/home/programs/terminal/fastfetch
../../../modules/home/programs/terminal/git
../../../modules/home/programs/terminal/neovim
../../../modules/home/programs/terminal/ranger
../../../modules/home/programs/terminal/tmux
../../../modules/home/utils/zsh
# Misc
../../../modules/home/programs/terminal/zsh
../../../variables/domains
../../../variables/look/colors/purple
];
}

View file

@ -27,97 +27,71 @@
# Main root
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/b8b7ed47-c98c-4a49-af01-b2832dde1287";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@" ];
};
"/home" = {
device = "/dev/disk/by-uuid/b8b7ed47-c98c-4a49-af01-b2832dde1287";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/b8b7ed47-c98c-4a49-af01-b2832dde1287";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
"/var" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/srv/minecraft" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@minecraft" "compress=zstd" ];
};
"/.snapshots" = {
device = "/dev/disk/by-uuid/b8b7ed47-c98c-4a49-af01-b2832dde1287";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/CD94-1D3F";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
# Atrocity of subvols
# Files
"/export/JimboNFS/Downloads" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@downloads" "compress=zstd" ];
};
"/export/JimboNFS/Documents" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@docs" "compress=zstd" ];
};
# Media
"/export/JimboNFS/Photos" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@photos" "compress=zstd" ];
};
"/export/JimboNFS/Videos/Random" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
"/export/JimboNFS/Videos" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@videos-random" "compress=zstd" ];
options = [ "subvol=@videos" "compress=zstd" ];
};
"/export/JimboNFS/Videos/Media" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
# Music
"/export/JimboNFS/Music" = {
device = "/dev/server/root";
fsType = "btrfs";
options = [ "subvol=@videos-media" "compress=zstd" ];
};
"/export/JimboNFS/Music/Synced" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
fsType = "btrfs";
options = [ "subvol=@music-synced" "compress=zstd" ];
};
"/export/JimboNFS/Music/Unsynced" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
fsType = "btrfs";
options = [ "subvol=@music-unsynced" "compress=zstd" ];
};
"/export/JimboNFS/Projects" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
fsType = "btrfs";
options = [ "subvol=@projects" "compress=zstd" ];
};
"/export/JimboNFS/School" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
fsType = "btrfs";
options = [ "subvol=@school" "compress=zstd" ];
};
"/export/JimboNFS/.snapshots" = {
device = "/dev/disk/by-uuid/acf95700-8669-45c7-9a72-bf3215b3c325";
fsType = "btrfs";
options = [ "subvol=@snapshots" "compress=zstd" ];
options = [ "subvol=@music" "compress=zstd" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/57178cfc-3e71-4d35-8c7f-e355f9dc84df"; }
{ device = "/dev/server/root/swap"; }
];
networking.useDHCP = lib.mkDefault true;

View file

@ -1,23 +1,7 @@
{ config, nur, ... }:
{ ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/remote-desktop
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/green
# Imports
nur.nixosModules.nur
];
}

View file

@ -19,17 +19,12 @@
fsType = "btrfs";
options = [ "subvol=@home" ];
};
"/var" = {
device = "/dev/disk/by-uuid/dc6e2cd9-040b-4104-8138-5dfa9cb5558c";
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/dc6e2cd9-040b-4104-8138-5dfa9cb5558c";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
"/.snapshots" = {
"/snapshots" = {
device = "/dev/disk/by-uuid/dc6e2cd9-040b-4104-8138-5dfa9cb5558c";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];

View file

@ -0,0 +1,68 @@
{ pkgs, lib, ... }:
let
commonKernelParams = [
# Nvidia settings
"nvidia_drm.fbdev=1"
"nouveau.config=NvGspRm=1"
# VM/GPU passthrough
"amd_iommu=on"
"iommu=pt"
"nested=1"
# Virtualization nonsense
"transparent_hugepage=never"
# Isolate devices into IOMMU groups
"pcie_acs_override=downstream,multifunction"
"pci=routeirq"
];
in {
boot = {
# HAS to be unstable to get the newest NVIDIA drivers
kernelPackages = pkgs.unstable.linuxPackages_latest;
blacklistedKernelModules = [ "pcspkr" ];
kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:1f82,10de:10fa" ];
initrd = {
systemd = {
enable = true;
services.root-reset = {
description = "Reset BTRFS root and snapshot last boot";
wantedBy = [ "initrd.target" ];
after = [ "dev-nixos-root.device" ];
before = [ "sysroot.mount" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir -p /mnt
mount /dev/nixos/root /mnt
if [[ -e /mnt/@prev ]]; then
btrfs subvolume delete /mnt/@prev
fi
btrfs subvolume snapshot /mnt/@ /mnt/@prev
btrfs subvolume list -o /mnt/@ | cut -f9 -d' ' | while read subvolume; do
btrfs subvolume delete "/mnt/$subvolume"
done
btrfs subvolume delete /mnt/@
btrfs subvolume create /mnt/@
umount /mnt
'';
};
};
};
};
# Additional entry to boot from the second GPU
specialisation = {
gputwo.configuration = {
boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ];
};
};
}

37
hosts/firefly/default.nix Normal file
View file

@ -0,0 +1,37 @@
{ chaotic, pkgs, ... }:
{
imports = [
./boot
./disko
./hardware
# Apps and programs
../../modules/system
../../modules/system/accounts
../../modules/system/desktop
../../modules/system/programs
../../modules/system/services
../../modules/system/services/pc/sunshine
../../modules/system/services/pc/virtualization/qemu
# Devices and hardware
../../modules/system/devices
../../modules/system/devices/boot/lanzaboote
../../modules/system/devices/video/nvidia
../../modules/system/devices/networking/firewall/pc
# Misc
../../overlays
../../variables
# Imports
chaotic.homeManagerModules.default
];
programs.sway.package = pkgs.sway_git;
networking.hostName = "firefly";
# Force Electron to use Wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}

View file

@ -0,0 +1,95 @@
{ disko, ... }:
{
imports = [
disko.nixosModules.disko
];
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypt-nvme";
settings.allowDiscards = true;
#passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "nixos";
};
};
};
};
};
};
};
lvm_vg = {
nixos = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/@" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Impermanence
"/@root" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
swap = {
size = "8G";
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems = {
"/persist".neededForBoot = true;
"/persist/home/jimbo".neededForBoot = true;
};
}

View file

@ -21,45 +21,20 @@
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@" "noatime" "nodiratime" "discard" ];
# Useful system mounts
"/etc/libvirt" = {
device = "/dev/disk/by-uuid/f18a0302-9914-471d-828c-85ab1a67a8be";
options = [ "nosuid" "nodev" "nofail" ];
};
"/home" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@home" "noatime" "nodiratime" "discard" ];
"/etc/libvirt/VMs/Bulk" = {
depends = [ "/etc/libvirt" ];
device = "/dev/disk/by-uuid/3eb36c3e-81ac-4281-89f0-c89242d88dd6";
options = [ "nosuid" "nodev" "nofail" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@nix" "noatime" "nodiratime" "discard" ];
};
"/etc/nixos" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@nixconf" "noatime" "nodiratime" "discard" ];
};
"/etc/secureboot" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@secureboot" "noatime" "nodiratime" "discard" ];
};
"/var" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@var" "noatime" "nodiratime" "discard" ];
};
"/.snapshots" = {
device = "/dev/disk/by-uuid/bbfed7d1-62f2-4d8e-b63f-7f6ec932105b";
fsType = "btrfs";
options = [ "subvol=@snapshots" "noatime" "nodiratime" "discard" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/3B4A-76C9";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
"/var/lib/libvirt" = {
depends = [ "/etc/libvirt" ];
device = "/etc/libvirt/varlibvirt";
options = [ "bind" "rw" ];
};
# Games and such
@ -80,22 +55,6 @@
options = [ "nosuid" "nodev" "noauto" ];
};
# Miscellaneous mounts
"/etc/libvirt" = {
device = "/dev/disk/by-uuid/f18a0302-9914-471d-828c-85ab1a67a8be";
options = [ "nosuid" "nodev" "nofail" ];
};
"/etc/libvirt/VMs/Bulk" = {
depends = [ "/etc/libvirt" ];
device = "/dev/disk/by-uuid/3eb36c3e-81ac-4281-89f0-c89242d88dd6";
options = [ "nosuid" "nodev" "nofail" ];
};
"/var/lib/libvirt" = {
depends = [ "/etc/libvirt" ];
device = "/etc/libvirt/varlibvirt";
options = [ "bind" "rw" ];
};
# Network mounts
"/home/jimbo/JimboNFS" = {
device = "${config.ips.server}:/export/JimboNFS";
@ -105,7 +64,7 @@
};
swapDevices = [
{ device = "/dev/disk/by-uuid/1a6a68d0-8ae7-4836-a585-b708597937a1"; }
{ device = "/dev/nixos/swap"; }
];
networking.useDHCP = lib.mkDefault true;

View file

@ -1,27 +0,0 @@
{ nur, config, ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/production
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/gaming/xash3d
../../../modules/home/programs/misc/school
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/red
# Imports
nur.nixosModules.nur
];
wayland.windowManager.sway.config.output.${config.displays.d1}.allow_tearing = "yes";
}

View file

@ -1,46 +0,0 @@
{ pkgs, ... }:
let
commonKernelParams = [
# Nvidia settings
"nvidia_drm.fbdev=1"
"nouveau.config=NvGspRm=1"
# VM/GPU passthrough
"amd_iommu=on"
"iommu=pt"
"nested=1"
# Virtualization nonsense
"transparent_hugepage=never"
# Isolate devices into IOMMU groups
"pcie_acs_override=downstream,multifunction"
"pci=routeirq"
];
in {
boot = {
kernelPackages = pkgs.unstable.linuxPackages_zen;
blacklistedKernelModules = [ "pcspkr" ];
kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:1f82,10de:10fa" ];
# Encryption and TPM
initrd = {
systemd.enable = true;
luks.devices = {
"crypt-nvme" = {
device = "/dev/disk/by-uuid/52110c74-19b6-40ef-9710-e6c9b157005f";
preLVM = true;
allowDiscards = true;
};
};
};
};
# Additional entry to boot from the second GPU
specialisation = {
gputwo.configuration = {
boot.kernelParams = commonKernelParams ++ [ "vfio-pci.ids=10de:2504,10de:228e" ];
};
};
}

View file

@ -1,37 +0,0 @@
{ chaotic, pkgs, ... }:
{
imports = [
./hardware
./boot
# Apps and programs
../../../modules/system
../../../modules/system/accounts
../../../modules/system/desktop
../../../modules/system/programs
../../../modules/system/services
../../../modules/system/services/pc/sunshine
../../../modules/system/services/pc/school
../../../modules/system/services/pc/virtualization/qemu
# Devices and hardware
../../../modules/system/devices
../../../modules/system/devices/boot/lanzaboote
../../../modules/system/devices/video/nvidia
../../../modules/system/devices/networking/firewall/pc
# Misc
../../../overlays
../../../variables
# Imports
chaotic.homeManagerModules.default
];
programs.sway.package = pkgs.sway_git;
networking.hostName = "firefly";
# Force Electron to use Wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}

View file

@ -1,22 +1,7 @@
{ config, nur, ... }:
{ ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/remote-desktop
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/orange
# Imports
nur.nixosModules.nur
];
}

View file

@ -25,7 +25,7 @@
fsType = "btrfs";
options = [ "subvol=@var" "noatime" "nodiratime" "discard" ];
};
"/.snapshots" = {
"/snapshots" = {
device = "/dev/disk/by-uuid/e8c9c5a8-4df0-4100-8de6-f08a1a774fad";
fsType = "btrfs";
options = [ "subvol=@snapshots" "noatime" "nodiratime" "discard" ];

View file

@ -1,24 +1,8 @@
{ config, nur, ... }:
{ ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/production
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/remote-desktop
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/green
# Imports
nur.nixosModules.nur
];
}

View file

@ -1,27 +1,8 @@
{ config, pkgs, nur, ... }:
{ config, pkgs, ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/remote-desktop
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/purple
# Imports
nur.nixosModules.nur
];
home.packages = with pkgs; [
alsa-utils
];
wayland.windowManager.sway.config.output.${config.displays.dI}.scale = "1.3";

View file

@ -27,7 +27,7 @@
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";
options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
};
};

View file

@ -1,25 +1,9 @@
{ config, nur, ... }:
{ config, ... }:
{
imports = [
# Apps and programs
../../../modules/home
../../../modules/home/users
../../../modules/home/files
../../../modules/home/settings
../../../modules/home/programs
../../../modules/home/programs/misc/production
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/gaming/xash3d
../../../modules/home/programs/misc/remote-desktop
../../../modules/home/sway
../../../modules/home/utils
# Misc
../../../overlays
../../../variables
../../../variables/look/colors/green
# Imports
nur.nixosModules.nur
];
}

View file

@ -4,7 +4,13 @@
boot = {
kernelModules = [ "kvm-intel" ];
initrd = {
availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
availableKernelModules = [
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
kernelModules = [ "dm-snapshot" ];
};
};
@ -30,7 +36,7 @@
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/.snapshots" = {
"/snapshots" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];