Add back steam deck, again?

This commit is contained in:
Jimbo 2024-11-22 20:28:52 -05:00
parent 87c2558155
commit c0ff4c64e5
24 changed files with 296 additions and 143 deletions

View file

@ -33,7 +33,7 @@
umount /mnt
'';
};
};
};
};
};

View file

@ -3,10 +3,6 @@
boot = {
kernelPackages = pkgs.linuxPackages_5_10;
kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = [
"nvidia_drm.fbdev=1"
"nouveau.config=NvGspRm=1"
];
initrd.systemd = {
enable = true;

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC2lMkUd+BbXITE5LTg94hEzmA6UKsIIbaf5YOjGoLzl

View file

@ -0,0 +1,44 @@
{ config, pkgs, ... }:
{
boot = {
kernelPackages = pkgs.unstable.linuxPackages_latest;
kernel.sysctl."vm.max_map_count" = 2147483642;
kernelParams = [
"amd_iommu=on"
"iommu=pt"
"nested=1"
"transparent_hugepage=never"
];
initrd.systemd = {
enable = true;
services.root-reset = {
description = "Reset root and snapshot last boot";
wantedBy = [ "initrd.target" ];
before = [ "sysroot.mount" ];
after = [ "dev-${config.networking.hostName}-root.device" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir -p /mnt
mount /dev/${config.networking.hostName}/root /mnt
if [[ -e /mnt/prev ]]; then
btrfs subvolume delete /mnt/prev
fi
btrfs subvolume snapshot /mnt/root /mnt/prev
btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do
btrfs subvolume delete "/mnt/$subvolume"
done
btrfs subvolume delete /mnt/root
btrfs subvolume create /mnt/root
umount /mnt
'';
};
};
};
}

17
hosts/jupiter/default.nix Normal file
View file

@ -0,0 +1,17 @@
{ jovian, ... }:
{
imports = [
./boot
./disko
./hardware
./wireguard
../../modules/system
];
system.lanzaboote.enable = true;
system.libvirtd.enable = true;
jovian.steamos.useSteamOSConfig = true;
networking.hostName = "jupiter";
}

View file

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

View file

@ -0,0 +1,35 @@
{ config, lib, modulesPath, ... }:
{
boot = {
initrd = {
availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
kernelModules = [
"dm-snapshot"
"vfio"
"vfio_pci"
"vfio_iommu_type1"
"kvm-amd"
];
};
};
fileSystems = {
# Remote
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
};
};
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1,23 @@
{ lib, config, ... }:
{
networking = {
firewall = {
allowedUDPPorts = [ 51820 ];
trustedInterfaces = [ "wgc" ];
};
wireguard.interfaces.wgc = {
ips = [ "10.100.0.21/24" ];
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # Cyberspark Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
};
}

View file

@ -1,9 +0,0 @@
{ config, ... }:
{
imports = [
../../../modules/home
../../../modules/home/programs/misc/production
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/remote-desktop
];
}

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAzAyY6bLK/pOlijVOZjw3ikdIaOuCC1yQjxL922bON7

View file

@ -1,17 +0,0 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."vm.max_map_count" = 2147483642;
initrd = {
systemd.enable = true;
luks.devices = {
crypt-mmc = {
device = "/dev/disk/by-uuid/5bc11b61-e4dc-465c-b87a-533955cf6177";
preLVM = true;
allowDiscards = true;
};
};
};
};
}

View file

@ -1,31 +0,0 @@
{ config, lib, hardware, ... }:
{
imports = [
./hardware
./boot
# Apps and programs
../../../modules/system
../../../modules/system/accounts
../../../modules/system/desktop
../../../modules/system/programs
../../../modules/system/services
# Devices and hardware
../../../modules/system/devices
../../../modules/system/devices/boot/systemd
../../../modules/system/devices/networking/wireless
../../../modules/system/devices/networking/firewall/pc
../../../modules/system/devices/networking/wireguard/pc
# Extras
../../../overlays
../../../variables
# Imports
hardware.nixosModules.apple-macbook-pro-14-1
];
networking.hostName = "treefruit";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.21/24" ];
}

View file

@ -1,65 +0,0 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot = {
kernelModules = [ "kvm-intel" ];
initrd = {
availableKernelModules = [
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
kernelModules = [ "dm-snapshot" ];
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@" ];
};
"/home" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
"/nix" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@nix" ];
};
"/var" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@var" ];
};
"/snapshots" = {
device = "/dev/disk/by-uuid/db67d9e8-2ead-4fe6-8a63-5c9e5071e06e";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/7B59-F17A";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
# Remote
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/25b5e281-f1be-49ca-991e-b340fed3e5da"; }
];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -51,27 +51,27 @@
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
};
"/prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
};
# Impermanence
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
};
"/persist/.snapshots" = { };
"/jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [ "compress=zstd" "noatime" "ssd" ];
};
"/jimbo/.snapshots" = { };
};