From e72fa70faeba23b0c6ba6b38300a3d5f2ff6ef51 Mon Sep 17 00:00:00 2001 From: muon Date: Fri, 29 Nov 2024 11:23:58 +0000 Subject: [PATCH] Add zfs --- hosts/muho/configuration.nix | 3 +- hosts/muho/hardware-configuration.nix | 44 +++++++++++++++++---------- modules/nixos/core/boot.nix | 2 +- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/hosts/muho/configuration.nix b/hosts/muho/configuration.nix index b0179ea..d2580fe 100644 --- a/hosts/muho/configuration.nix +++ b/hosts/muho/configuration.nix @@ -5,14 +5,13 @@ in { # Hardware imports = [ ./hardware-configuration.nix ]; - boot.supportedFilesystems = [ "zfs" "ntfs" ]; - environment.systemPackages = with inputs.nix-alien.packages.${system}; [ nix-alien ]; # System mods.user.name = "muon"; networking.hostName = "muho"; + networking.hostId = "56e55e83"; mods.home.file = ./home.nix; # Modules diff --git a/hosts/muho/hardware-configuration.nix b/hosts/muho/hardware-configuration.nix index ba4b71a..a71a1ed 100644 --- a/hosts/muho/hardware-configuration.nix +++ b/hosts/muho/hardware-configuration.nix @@ -4,29 +4,40 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; + boot.supportedFilesystems = [ "zfs" "ntfs" ]; + services.zfs.autoScrub.enable = true; + services.zfs.autoSnapshot.enable = true; - fileSystems."/" = - { device = "/dev/disk/by-uuid/034b9530-2c01-4108-9dbb-44557eddf6d5"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/034b9530-2c01-4108-9dbb-44557eddf6d5"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/9D45-AA14"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/9D45-AA14"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + # fileSystems."/storage0" = { + # device = "storage0"; + # fsType = "zfs"; + # }; + + # fileSystems."/storage1" = { + # device = "storage1"; + # fsType = "zfs"; + # }; swapDevices = - [ { device = "/dev/disk/by-uuid/f7ce07eb-563c-4c65-b465-b6c1ab88aede"; } - ]; + [{ device = "/dev/disk/by-uuid/f7ce07eb-563c-4c65-b465-b6c1ab88aede"; }]; # 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 @@ -36,5 +47,6 @@ # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/nixos/core/boot.nix b/modules/nixos/core/boot.nix index 10ddb43..ffd0816 100644 --- a/modules/nixos/core/boot.nix +++ b/modules/nixos/core/boot.nix @@ -8,7 +8,7 @@ config = lib.mkIf config.mods.boot.enable { boot.loader = lib.mkIf config.mods.xorg.enable { - timeout = 0; + timeout = 1; efi.canTouchEfiVariables = true; grub = { enable = true;