Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions hardware/ridge-pc-zfs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Hardware configuration for 2024 PC upgrade with:
# - ASRock A620I Lightning Wifi
# - Ryzen 5 8600G
# Requires specifying `disko.devices.disk.main.device` in the host's config.

{
config,
lib,
pkgs,
modulesPath,
...
}:

{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];

boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

disko.devices = {
disk.main = {
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
zpool.zroot = {
type = "zpool";
options = {
ashift = "12";
};
rootFsOptions = {
mountpoint = "none";
compression = "zstd";
acltype = "posixacl";
xattr = "sa";
normalization = "none";
atime = "off";
};
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
postCreateHook = ''
zfs list -t snapshot -H -o name | grep -E '^zroot/root@blank$' || zfs snapshot zroot/root@blank
'';
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
};
persist = {
type = "zfs_fs";
mountpoint = "/persist";
};
};
};
};

swapDevices = [ ];

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp9s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp8s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
4 changes: 3 additions & 1 deletion hosts/desktop/lexy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

{
imports = [
../../hardware/ridge-pc.nix
../../hardware/ridge-pc-zfs.nix
];

disko.devices.disk.main.device = "/dev/disk/by-id/nvme-CT500P3SSD8_241147963423";

ocf.network = {
enable = true;
lastOctet = 153;
Expand Down
94 changes: 2 additions & 92 deletions hosts/desktop/smokey.nix
Original file line number Diff line number Diff line change
@@ -1,99 +1,9 @@
{
config,
lib,
modulesPath,
...
}:

{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
../../hardware/ridge-pc-zfs.nix
];

boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

disko.devices = {
disk.main = {
device = "/dev/disk/by-id/nvme-HP_SSD_FX900_Pro_512GB_HBSE33220300412";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
zpool.zroot = {
type = "zpool";
options = {
ashift = "12";
};
rootFsOptions = {
mountpoint = "none";
compression = "zstd";
acltype = "posixacl";
xattr = "sa";
normalization = "none";
atime = "off";
};
datasets = {
root = {
type = "zfs_fs";
mountpoint = "/";
postCreateHook = ''
zfs list -t snapshot -H -o name | grep -E '^zroot/root@blank$' || zfs snapshot zroot/root@blank
'';
};
nix = {
type = "zfs_fs";
mountpoint = "/nix";
};
persist = {
type = "zfs_fs";
mountpoint = "/persist";
};
};
};
};

swapDevices = [ ];

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp9s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp8s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

ocf.impermanence.enable = true;
disko.devices.disk.main.device = "/dev/disk/by-id/nvme-HP_SSD_FX900_Pro_512GB_HBSE33220300412";

ocf.nvidia.enable = true;
ocf.network = {
Expand Down
2 changes: 2 additions & 0 deletions profiles/desktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# desktops heavily use /remote and bind mount to ~/remote on login
# keep the mount cached and ready to use at all times
nfs.idleTimeout = 0;

impermanence.enable = lib.mkIf (config.disko.devices.zpool ? "zroot") true;
};

boot = {
Expand Down
Loading