feat: Initial NixOS systems config for laptop
This commit is contained in:
86
hosts/default.nix
Normal file
86
hosts/default.nix
Normal file
@@ -0,0 +1,86 @@
|
||||
{ inputs, hostName, system ? "x86_64-linux" }:
|
||||
|
||||
let
|
||||
nixpkgs = inputs.nixpkgs;
|
||||
home-manager = inputs.home-manager;
|
||||
disko = inputs.disko;
|
||||
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
commonModules = [
|
||||
../boot.nix
|
||||
../net.nix
|
||||
../sw.nix
|
||||
../users
|
||||
home-manager.nixosModules.home-manager
|
||||
disko.nixosModules.disko
|
||||
({ ... }: {
|
||||
disko.enableConfig = true;
|
||||
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
type = "disk";
|
||||
|
||||
device = lib.mkDefault "/dev/nvme0n1";
|
||||
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
name = "ESP";
|
||||
label = "BOOT";
|
||||
size = "1G";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
extraArgs = [ "-n" "BOOT" ];
|
||||
};
|
||||
};
|
||||
|
||||
swap = {
|
||||
name = "swap";
|
||||
label = "swap";
|
||||
size = "34G";
|
||||
content = {
|
||||
type = "swap";
|
||||
};
|
||||
};
|
||||
|
||||
root = {
|
||||
name = "root";
|
||||
label = "root";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
extraArgs = [ "-L" "ROOT" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
# Map hostnames to their per-host module
|
||||
hostModules = {
|
||||
nix-laptop1 = ./nix-laptop1.nix;
|
||||
};
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
specialArgs = { inherit inputs; };
|
||||
|
||||
modules =
|
||||
commonModules
|
||||
++ [ (hostModules.${hostName} or (throw "Unknown host '${hostName}' in hosts/default.nix")) ]
|
||||
++ [
|
||||
{ networking.hostName = hostName; }
|
||||
];
|
||||
}
|
||||
15
hosts/nix-laptop1.nix
Normal file
15
hosts/nix-laptop1.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, 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 = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
Reference in New Issue
Block a user