refactor: Fully modularize the working system components to be more
reuasable
This commit is contained in:
24
hosts/types/nix-desktop.nix
Normal file
24
hosts/types/nix-desktop.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ inputs, ... }: [
|
||||
({ config, lib, modulesPath, ... }: {
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
|
||||
host.filesystem.swapSize = lib.mkDefault "16G";
|
||||
host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
})
|
||||
{ modules.sw.enable = true; modules.sw.type = "desktop"; }
|
||||
]
|
||||
37
hosts/types/nix-laptop.nix
Normal file
37
hosts/types/nix-laptop.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ inputs, ... }: [
|
||||
({ config, lib, modulesPath, ... }: {
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"i915.enable_psr=0"
|
||||
"i915.enable_dc=0"
|
||||
"i915.enable_fbc=0"
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
host.filesystem.device = lib.mkDefault "/dev/nvme0n1";
|
||||
host.filesystem.swapSize = lib.mkDefault "34G";
|
||||
|
||||
# Suspend / logind behavior
|
||||
services.upower.enable = true;
|
||||
services.logind.settings = {
|
||||
Login = {
|
||||
HandleLidSwitch = "suspend";
|
||||
HandleLidSwitchExternalPower = "suspend";
|
||||
HandleLidSwitchDocked = "ignore";
|
||||
};
|
||||
};
|
||||
})
|
||||
{ modules.sw.enable = true; modules.sw.type = "desktop"; }
|
||||
]
|
||||
40
hosts/types/nix-surface.nix
Normal file
40
hosts/types/nix-surface.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ inputs, ... }: [
|
||||
({ config, lib, pkgs, modulesPath, ... }:
|
||||
let
|
||||
refSystem = inputs.nixpkgs-old-kernel.lib.nixosSystem {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
modules = [ inputs.nixos-hardware.nixosModules.microsoft-surface-go ];
|
||||
};
|
||||
refKernelPackages = refSystem.config.boot.kernelPackages;
|
||||
in
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"splash"
|
||||
"boot.shell_on_fail"
|
||||
"udev.log_priority=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
"intel_ipu3_imgu"
|
||||
"intel_ipu3_isys"
|
||||
"fbcon=map:1"
|
||||
"i915.enable_psr=0" # Panel Self Refresh breaks resume on Surface
|
||||
"i915.enable_dc=0"
|
||||
];
|
||||
|
||||
boot.kernelPackages = lib.mkForce refKernelPackages;
|
||||
|
||||
host.filesystem.swapSize = lib.mkDefault "8G";
|
||||
host.filesystem.device = lib.mkDefault "/dev/mmcblk0";
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
})
|
||||
inputs.nixos-hardware.nixosModules.microsoft-surface-go
|
||||
{ modules.sw.enable = true; modules.sw.type = "kiosk"; }
|
||||
]
|
||||
Reference in New Issue
Block a user