Added some of the hardware config stuff

This commit is contained in:
Annika Merris 2024-05-18 12:25:27 -04:00
parent fc3e307d0c
commit bfba6682f6
7 changed files with 78 additions and 22 deletions

24
flake.lock generated
View file

@ -40,11 +40,11 @@
]
},
"locked": {
"lastModified": 1715486357,
"narHash": "sha256-4pRuzsHZOW5W4CsXI9uhKtiJeQSUoe1d2M9mWU98HC4=",
"lastModified": 1715930644,
"narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "44677a1c96810a8e8c4ffaeaad10c842402647c1",
"rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d",
"type": "github"
},
"original": {
@ -82,11 +82,11 @@
]
},
"locked": {
"lastModified": 1715801730,
"narHash": "sha256-7X/FAfjyQxh8mgpbNPsGoh9Dxi1Q0jF4OOJQBntCUJM=",
"lastModified": 1715885250,
"narHash": "sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4=",
"ref": "refs/heads/main",
"rev": "7e8a5498db41de8c67315b4a2a4f82a2072ee73b",
"revCount": 77,
"rev": "53d713eb486f21d653af3ef3528e9a19ecfc45e5",
"revCount": 81,
"type": "git",
"url": "https://git.lix.systems/lix-project/nixos-module"
},
@ -97,10 +97,12 @@
},
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-/vno6oUIZDSLpqS/WOqNTHwVIakrNR7R+UutJVmfohs=",
"path": "/nix/store/hqzz459vrv62vjc470vig5lf5qm7d897-source",
"type": "path"
"lastModified": 1715996989,
"narHash": "sha256-ObD9YSelkwCAylEXJHcNjrn3hLOfIVScB1tPz9zeDN8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63d3e5d82edf5a138e7d0872231cc23ed4e740fd",
"type": "github"
},
"original": {
"id": "nixpkgs",

View file

@ -37,11 +37,11 @@
let
system = "x86_64";
globals = rec {
user = "annika";
fullName = "Annika Merris";
gitName = fullName;
gitEmail = "me@annikamerris.com";
nixfilesRepo = "ssh://git@forgejo.local.merr.is:2222/annika/nixos2.git";
# user = "annika";
# fullName = "Annika Merris";
# gitName = fullName;
# gitEmail = "me@annikamerris.com";
# nixfilesRepo = "ssh://git@forgejo.local.merr.is:2222/annika/nixos2.git";
};
in rec
{

View file

@ -5,18 +5,18 @@
with inputs;
nixpkgs.lib.nixosSystem {
inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
globals
home-manager.nixosModules.home-manager
# ../../modules/common
# ../../modules/nixos
../../modules/nixos
{
# something with overlays, I don't get those yet.
# Hardware
physical = true;
# physical = true;
networking.hostName = "virt-nix";
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
@ -36,7 +36,7 @@ nixpkgs.lib.nixosSystem {
swapDevices = [ ];
networking.useDHCP = lib.mkDefault true;
networking.useDHCP = nixpkgs.lib.mkDefault true;
# TODO: identityFile = "/home/${globals.user}/.ssh/id_ed2519";
# TODO: passwordHash = nixpkgs.lib.fileContents ../../password.sha512;

View file

@ -8,8 +8,16 @@
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" "virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "9p" "9pnet_virtio" ];
boot.initrd.kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
boot.initrd.postDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable)
''
# Set the system time from the hardware clock to work around a
# bug in qemu-kvm > 1.5.2 (where the VM clock is initialised
# to the *boot time* of the host).
hwclock -s
'';
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

View file

@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./hardware
]
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, ... }:
{
boot.loader = lib.mkIf (config.physical && !config.physical) {
grub = {
enable = true;
efiSupport = true;
useOSProber = true;
gfxmodeEfi = "1920x1080";
configurationLimit = 25;
device = "nodev";
# Display menu indefinitely if holding shift key
extraConfig = ''
if keystatus --shift; then
set timeout=-1
else
set timeout=3
fi
'';
};
efi.canTouchEfiVariables = true;
};
boot.supportedFilesystems = lib.mkIf config.physical [ "ntfs" ];
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
}

View file

@ -0,0 +1,12 @@
{ lib, ... }:
{
import = [
./boot.nix
];
options = {
physical = lib.mkEnableOption "Whether this machine is a physical device.";
server = lib.mkEnableOption "Whether this machine is a server.";
};
}