This is the configuration for my home desktop. It is after the racing ship Razorback from the Expanse Novels[1].
nixosModules.razorback = {
networking.hostName = "razorback";
imports = [
<<razorback-modules>>
];
};
nixosConfigurations.razorback = self.lib.mkNixOS {
modules = [ self.nixosModules.razorback ];
};Hardware configuration generated using nixos-generate-config:
(let ((out (shell-command-to-string
(concat "2>/dev/null "
"nixos-generate-config --no-filesystems --show-hardware-config"
"| nixfmt"))))
(concat "#+caption: hosts/razorback/hardware-configuration.nix\n"
"#+begin_src nix :mkdirp yes :tangle out/hosts/razorback/hardware-configuration.nix\n"
out
"#+end_src"))./hosts/razorback/hardware-configuration.nixDisko configuration
{
disko.devices = {
disk = {
nvme = {
type = "disk";
device = "/dev/nvmn0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypt-root";
extraOpenArgs = [ "--allow-discards" ];
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
swap = {
size = "32G";
content = {
type = "swap";
};
};
rpool = {
size = "100%FREE";
content = {
type = "zfs";
pool = "rpool";
};
};
};
};
};
zpool = {
rpool = {
type = "zpool";
postCreateHook = "zfs snapshot rpool/razorback/root@blank && zfs snapshot -r rpool/razorback/home@blank";
options = {
ashift = "12";
autotrim = "on";
};
rootFsOptions = {
acltype = "posixacl";
canmount = "off";
normalization = "formD";
mountpoint = "none";
relatime = "on";
xattr = "sa";
};
datasets = {
"razorback" = {
type = "zfs_fs";
mountpoint = "/persist";
options.mountpoint = "legacy";
options.compression = "zstd";
};
"razorback/root" = {
type = "zfs_fs";
mountpoint = "/";
options.mountpoint = "legacy";
options.compression = "zstd";
};
"razorback/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
options.mountpoint = "legacy";
options.compression = "zstd";
};
"razorback/home" = {
type = "zfs_fs";
options.canmount = "off";
options.mountpoint = "legacy";
};
"razorback/home/vlaci" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist/home/vlaci";
};
"razorback/var" = {
type = "zfs_fs";
options.canmount = "off";
options.mountpoint = "legacy";
};
"razorback/var/lib" = {
type = "zfs_fs";
options.canmount = "off";
options.mountpoint = "legacy";
};
"razorback/var/lib/libvirt" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist/var/lib/libvirt";
};
};
};
};
};
}./hosts/razorback/disko-config.nix{
lib,
pkgs,
config,
...
}:
{
boot.initrd.systemd = {
enable = true;
emergencyAccess = true;
services.revert-root = {
after = [
"zfs-import-rpool.service"
];
wantedBy = [ "initrd.target" ];
before = [
"sysroot.mount"
];
path = with pkgs; [
zfs
];
unitConfig = {
DefaultDependencies = "no";
ConditionKernelCommandLine = [ "!zfs_no_rollback" ];
};
serviceConfig.Type = "oneshot";
script = ''
zfs rollback -r rpool/${config.networking.hostName}/root@blank
'';
};
# HACK: do not try to import pool before LUKS is opened. Otherwise
# if passphrase is not entered in time, importing will time out.
services.zfs-import-rpool.after = [ "cryptsetup.target" ];
services.create-needed-for-boot-dirs = {
after = lib.mkForce [ "revert-root.service" ];
};
};
}{
networking.hostId = "8425e349";
boot.supportedFilesystems = [ "zfs" ];
boot.zfs = {
allowHibernation = true;
devNodes = "/dev/mapper";
forceImportRoot = false;
};
services.zfs.autoScrub.enable = true;
virtualisation.docker.storageDriver = "zfs";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}{
networking.networkmanager.enable = true;
_.persist.directories = [ "/etc/NetworkManager/system-connections" ];
}{ pkgs, ... }:
{
boot.tmp = {
useTmpfs = true;
tmpfsSize = "100%";
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
boot.kernelPackages = pkgs.linuxPackages_6_12;
services.hardware.openrgb = {
enable = true;
motherboard = "amd";
};
hardware.graphics = {
## radv: an open-source Vulkan driver from freedesktop
enable32Bit = true;
};
system.stateVersion = "24.11";
}{ pkgs, ... }:
{
programs.steam = {
enable = true;
};
_.persist.allUsers.directories = [
".local/share/Steam"
".steam"
];
_.persist.users.vlaci.directories = [
".local/share/Baldur's Gate - Enhanced Edition"
];
environment.systemPackages = with pkgs; [
protonup-qt
gamemode
cifs-utils
pcmanfm
jmtpfs
];
services.gvfs.enable = true;
}