reorganize hardware
This commit is contained in:
parent
5bc6d6a996
commit
600654b33f
|
@ -24,7 +24,6 @@
|
|||
|
||||
outputs = inputs@{ self, nixpkgs, utils, nixos-hardware, impermanence, nix-gaming, nixos-mailserver, ... }:
|
||||
let
|
||||
hw = nixos-hardware.nixosModules;
|
||||
# IRL-related stuff I'd rather not put into git
|
||||
priv =
|
||||
if builtins.pathExists ./private.nix then (import ./private.nix)
|
||||
|
@ -32,18 +31,19 @@
|
|||
else { };
|
||||
getPriv = hostname: with builtins; if hasAttr hostname priv then getAttr hostname priv else { };
|
||||
common = hostname: [ (getPriv hostname) ];
|
||||
extraArgs = {
|
||||
inherit nixpkgs;
|
||||
};
|
||||
lib = nixpkgs.lib // {
|
||||
quoteListenAddr = addr:
|
||||
if nixpkgs.lib.hasInfix ":" addr then "[${addr}]" else addr;
|
||||
};
|
||||
mkHost = args @ { system ? "x86_64-linux", modules, ... }: {
|
||||
inherit system;
|
||||
extraArgs = {
|
||||
inherit nixpkgs;
|
||||
};
|
||||
specialArgs = {
|
||||
inherit lib;
|
||||
hardware = nixos-hardware.nixosModules;
|
||||
};
|
||||
mkHost = args @ { system ? "x86_64-linux", modules, ... }: {
|
||||
inherit system extraArgs specialArgs;
|
||||
} // args;
|
||||
in utils.lib.mkFlake {
|
||||
inherit self inputs;
|
||||
|
@ -54,24 +54,19 @@
|
|||
./modules/common.nix
|
||||
impermanence.nixosModule
|
||||
];
|
||||
hosts = {
|
||||
nixmsi = mkHost {
|
||||
hosts = builtins.mapAttrs (_: mkHost) {
|
||||
nixmsi = {
|
||||
modules = [
|
||||
./hosts/nixmsi.nix
|
||||
nix-gaming.nixosModules.pipewireLowLatency
|
||||
hw.common-pc-ssd # enables fstrim
|
||||
hw.common-cpu-amd # microcode
|
||||
hw.common-cpu-amd-pstate # amd-pstate
|
||||
hw.common-gpu-amd # configures drivers
|
||||
hw.common-pc-laptop # enables tlp
|
||||
./hardware/msi_delta_15.nix
|
||||
./hosts/nixmsi.nix
|
||||
] ++ common "nixmsi";
|
||||
};
|
||||
nixserver = mkHost {
|
||||
nixserver = {
|
||||
modules = [
|
||||
./hosts/nixserver
|
||||
nixos-mailserver.nixosModules.default
|
||||
hw.common-pc-hdd
|
||||
hw.common-cpu-intel
|
||||
./hardware/hp_probook_g0.nix
|
||||
./hosts/nixserver
|
||||
] ++ common "nixserver";
|
||||
};
|
||||
};
|
||||
|
|
17
system/hardware/hp_probook_g0.nix
Normal file
17
system/hardware/hp_probook_g0.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ hardware
|
||||
, ... }:
|
||||
|
||||
{
|
||||
imports = with hardware; [
|
||||
common-pc-hdd
|
||||
common-cpu-intel
|
||||
common-gpu-amd
|
||||
common-pc-laptop
|
||||
];
|
||||
common.resolution = "1366x768";
|
||||
boot = {
|
||||
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_pci_sdmmc" ];
|
||||
kernelModules = [ "kvm-intel" ];
|
||||
vfio.intelCpu = true;
|
||||
};
|
||||
}
|
24
system/hardware/msi_delta_15.nix
Normal file
24
system/hardware/msi_delta_15.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ hardware
|
||||
, ... }:
|
||||
|
||||
{
|
||||
imports = with hardware; [
|
||||
common-pc-ssd # enables fstrim
|
||||
common-cpu-amd # microcode
|
||||
common-cpu-amd-pstate # amd-pstate
|
||||
common-gpu-amd # configures drivers
|
||||
common-pc-laptop # enables tlp
|
||||
];
|
||||
common.resolution = "1920x1080";
|
||||
vfio.pciIDs = [ "1002:73df" "1002:ab28" ];
|
||||
boot = {
|
||||
initrd.availableKernelModules = [ "nvme" "xhci_pci" ];
|
||||
kernelParams = [
|
||||
# disable PSR to *hopefully* avoid random hangs
|
||||
# this one didnt help
|
||||
"amdgpu.dcdebugmask=0x10"
|
||||
# maybe this one will?
|
||||
"amdgpu.noretry=0"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
{ lib, pkgs, ... }:
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, ... }:
|
||||
|
||||
let
|
||||
efiPart = "/dev/disk/by-uuid/D77D-8CE0";
|
||||
|
||||
|
@ -37,7 +41,6 @@ in {
|
|||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [ "nvme" "xhci_pci" ];
|
||||
# insert crypto_keyfile into initrd so that grub can tell the kernel the
|
||||
# encryption key once I unlock the /boot partition
|
||||
secrets."/crypto_keyfile.bin" = "/boot/initrd/crypto_keyfile.bin";
|
||||
|
@ -64,12 +67,6 @@ in {
|
|||
"resume=/@swap/swapfile"
|
||||
# resume_offset = $(btrfs inspect-internal map-swapfile -r path/to/swapfile)
|
||||
"resume_offset=533760"
|
||||
"fbcon=font:TER16x32"
|
||||
# disable PSR to *hopefully* avoid random hangs
|
||||
# this one didnt help
|
||||
"amdgpu.dcdebugmask=0x10"
|
||||
# maybe this one will?
|
||||
"amdgpu.noretry=0"
|
||||
];
|
||||
loader = {
|
||||
grub = {
|
||||
|
@ -78,8 +75,6 @@ in {
|
|||
efiSupport = true;
|
||||
# nodev = disable bios support
|
||||
device = "nodev";
|
||||
gfxmodeEfi = "1920x1080";
|
||||
gfxmodeBios = "1920x1080";
|
||||
};
|
||||
efi.canTouchEfiVariables = true;
|
||||
efi.efiSysMountPoint = "/boot/efi";
|
||||
|
@ -114,8 +109,7 @@ in {
|
|||
|
||||
# see modules/vfio.nix
|
||||
vfio.enable = true;
|
||||
vfio.pciIDs = [ "1002:73df" "1002:ab28" ];
|
||||
vfio.libvirtdGroup = [ "user" ];
|
||||
vfio.libvirtdGroup = [ config.common.mainUsername ];
|
||||
|
||||
# because libvirtd's nat is broken for some reason...
|
||||
networking.nat = {
|
||||
|
@ -224,7 +218,7 @@ in {
|
|||
# programs.firejail.enable = true;
|
||||
# doesn't work:
|
||||
# programs.wireshark.enable = true;
|
||||
# users.groups.wireshark.members = [ "user "];
|
||||
# users.groups.wireshark.members = [ config.common.mainUsername"];
|
||||
services.printing.enable = true;
|
||||
# from nix-gaming
|
||||
services.pipewire.lowLatency = {
|
||||
|
|
|
@ -40,10 +40,6 @@ in {
|
|||
system.stateVersion = "22.11";
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod" "rtsx_pci_sdmmc" ];
|
||||
};
|
||||
kernelModules = [ "kvm-intel" ];
|
||||
loader = {
|
||||
grub = {
|
||||
enable = true;
|
||||
|
@ -51,8 +47,6 @@ in {
|
|||
version = 2;
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
gfxmodeEfi = "1920x1080";
|
||||
gfxmodeBios = "1920x1080";
|
||||
};
|
||||
efi.efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
|
@ -71,6 +65,7 @@ in {
|
|||
};
|
||||
zramSwap.enable = true;
|
||||
swapDevices = [ ];
|
||||
services.tlp.enable = false;
|
||||
impermanence = {
|
||||
enable = true;
|
||||
path = /persist;
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
default = false;
|
||||
description = "make getty autologin to the main user";
|
||||
};
|
||||
resolution = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = "resolution (none/1280x720/1920x1080)";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
|
@ -49,9 +54,15 @@
|
|||
linkInputs = true;
|
||||
};
|
||||
systemd.services.nix-daemon.serviceConfig.LimitSTACKSoft = "infinity";
|
||||
boot.kernelParams = [
|
||||
boot.kernelParams = lib.optionals (cfg.resolution != null) [
|
||||
"consoleblank=60"
|
||||
];
|
||||
] ++ (lib.optionals (cfg.resolution == "1920x1080") [
|
||||
"fbcon=font:TER16x32"
|
||||
]);
|
||||
boot.loader.grub = lib.mkIf (cfg.resolution != null) {
|
||||
gfxmodeEfi = cfg.resolution;
|
||||
gfxmodeBios = cfg.resolution;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [ (self: super: import ../pkgs { pkgs = super; inherit lib; }) ];
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
@ -92,7 +103,8 @@
|
|||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
};
|
||||
services.xserver.libinput.enable = lib.mkIf cfg.workstation true;
|
||||
# nixos-hardware uses mkDefault here, so we use slightly higher priority
|
||||
services.xserver.libinput.enable = lib.mkOverride 999 cfg.workstation;
|
||||
/*
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
};
|
||||
pciIDs = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = "PCI passthrough IDs";
|
||||
};
|
||||
lookingGlass = mkOption {
|
||||
|
|
Loading…
Reference in a new issue