Files
nixos-dots/hardware-configuration.nix

141 lines
4.5 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
systemName,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules =
[ ]
++ (lib.optionals (systemName == "pc") [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
])
++ (lib.optionals (systemName == "laptop") [
"vmd"
"xhci_pci"
"nvme"
"usb_storage"
"sd_mod"
]);
boot.initrd.kernelModules = [ ];
boot.kernelModules =
[ ]
++ (lib.optionals (systemName == "pc") [ "kvm-amd" "btusb"])
++ (lib.optionals (systemName == "laptop") [ "kvm-intel" ]);
boot.extraModulePackages = [ ];
boot.kernelParams = [
# Most common working combination in 2024/2025
"btusb.enable_autosuspend=0"
"btusb.reset=1"
];
fileSystems."/" = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
device = "/dev/disk/by-uuid/fdcbb840-4b35-4023-a048-599b0c5161d6";
fsType = "btrfs";
})
(lib.mkIf (systemName == "laptop") {
device = "/dev/disk/by-uuid/6aa7c67d-a0a5-4928-b16b-9c7991fee7ab";
fsType = "ext4";
})
];
fileSystems."/boot" = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
device = "/dev/disk/by-uuid/E1B6-9089";
fsType = "vfat";
})
(lib.mkIf (systemName == "laptop") {
device = "/dev/disk/by-uuid/FF4B-819D";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
})
];
fileSystems."/home" = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
device = "/dev/disk/by-uuid/d226a8ed-10eb-452e-9284-1ff994a7f179";
fsType = "btrfs";
})
];
fileSystems."/home/game/Games" = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
device = "/dev/disk/by-uuid/54188f21-d525-4681-a9d4-b798363eef17";
fsType = "ext4";
})
];
#fileSystems."/server" = lib.mkIf (systemName == "pc") { # or remove the mkIf if you want it on both
# device = "//192.168.1.8/mrfluffy"; # adjust the share name if its not the home share
# fsType = "cifs";
# options = let
# # Separate credentials from the Nix store (very important for security)
# credFile = "/etc/nixos/smb-credentials-mrfluffy";
# in [
# # Basic recommended options
# "credentials=${credFile}"
# "gid=users" # make files belong to the "users" group (or your preferred group)
# "uid=1000" # replace with your users UID, or use "uid=${config.users.users.yourname.uid}"
# "file_mode=0664"
# "dir_mode=0775"
# "nofail" # ← this makes the mount OPTIONAL (boot continues if unreachable)
# "noauto" # dont mount automatically at boot (optional, combine with x-systemd.automount)
# "x-systemd.automount" # creates a systemd automount unit → mounts on first access
# "x-systemd.mount-timeout=15" # dont wait forever
# "vers=3.0" # force SMB3 if the server supports it (recommended)
# # "iocharset=utf8" # usually not needed with modern servers
# # "cache=loose" # improves performance for some workloads
# ];
#};
swapDevices =
[ ]
++ (lib.optionals (systemName == "pc") [
{
device = "/dev/disk/by-uuid/ccf41b96-c45f-47e0-8541-cd865f5d2ec6";
}
])
++ (lib.optionals (systemName == "laptop") [
{
device = "/dev/disk/by-uuid/b416c3bd-861b-4b0c-aa84-6962b2e6a47d";
}
]);
# 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.enp6s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0f0u8.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
})
(lib.mkIf (systemName == "laptop") {
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
})
];
}