diff --git a/flake.lock b/flake.lock index c0c2b9c..a9837ac 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index 43f4084..0595b84 100644 --- a/flake.nix +++ b/flake.nix @@ -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 { diff --git a/hosts/virt-nix/default.nix b/hosts/virt-nix/default.nix index 2ccf207..f91b07e 100644 --- a/hosts/virt-nix/default.nix +++ b/hosts/virt-nix/default.nix @@ -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; diff --git a/hosts/virt-nix/hardware-configuration.nix b/hosts/virt-nix/hardware-configuration.nix index 0ff94c9..88328ec 100644 --- a/hosts/virt-nix/hardware-configuration.nix +++ b/hosts/virt-nix/hardware-configuration.nix @@ -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 = [ ]; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..bab0ef9 --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./hardware + ] +} \ No newline at end of file diff --git a/modules/nixos/hardware/boot.nix b/modules/nixos/hardware/boot.nix new file mode 100644 index 0000000..d3a41f0 --- /dev/null +++ b/modules/nixos/hardware/boot.nix @@ -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; +} diff --git a/modules/nixos/hardware/default.nix b/modules/nixos/hardware/default.nix new file mode 100644 index 0000000..983161f --- /dev/null +++ b/modules/nixos/hardware/default.nix @@ -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."; + }; +} \ No newline at end of file