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