From 8a9335f5ae7840e0c9ac67a38569c6a65a93062b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Barnouin?= Date: Tue, 10 Sep 2024 10:46:49 +0200 Subject: [PATCH] Try to have a working filesystem --- hosts/nixos-hypervisor/configuration.nix | 4 +- .../hardware-configuration.nix | 62 ++++++++++++------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/hosts/nixos-hypervisor/configuration.nix b/hosts/nixos-hypervisor/configuration.nix index 7250db9..c54f9f5 100644 --- a/hosts/nixos-hypervisor/configuration.nix +++ b/hosts/nixos-hypervisor/configuration.nix @@ -2,8 +2,8 @@ { imports = [ # Include the results of the hardware scan. -# ./hardware-configuration.nix - ]; + ./hardware-configuration.nix + ]; nix.settings = { experimental-features = [ "nix-command" "flakes" ]; diff --git a/hosts/nixos-hypervisor/hardware-configuration.nix b/hosts/nixos-hypervisor/hardware-configuration.nix index 4e3f911..ae708dc 100644 --- a/hosts/nixos-hypervisor/hardware-configuration.nix +++ b/hosts/nixos-hypervisor/hardware-configuration.nix @@ -1,33 +1,49 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ lib, system, ... }: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + boot = { + # use latest kernel + # kernelPackages = pkgs.linuxPackages_latest; + supportedFilesystems = [ "ext4" "btrfs" "xfs" "fat" "vfat" "cifs" "nfs" ]; + growPartition = true; + kernelModules = [ "kvm-intel" ]; + kernelParams = lib.mkForce [ ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + loader = { + grub = { + enable = true; + device = "nodev"; + efiSupport = true; + efiInstallAsRemovable = true; + }; + timeout = lib.mkForce 3; + }; - fileSystems."/" = - { device = "/dev/disk/by-uuid/cd191c1d-d2d7-44ae-8a9a-75ad7d8228a4"; + initrd = { + availableKernelModules = [ "9p" "9pnet_virtio" "ata_piix" "uhci_hcd" "virtio_blk" "virtio_mmio" "virtio_net" "virtio_pci" "virtio_scsi" ]; + kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ]; + }; + + tmp.cleanOnBoot = true; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; fsType = "ext4"; }; - swapDevices = - [ { device = "/dev/disk/by-uuid/335e1191-f20f-4afc-bc2b-b156cf8dc2c2"; } - ]; + "/boot" = { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + }; + }; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + services.fstrim = { + enable = true; + interval = "weekly"; + }; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + nixpkgs.hostPlatform = lib.mkDefault system; }