From 62e2519639faa250f43f9e80e69906a59d07a44e Mon Sep 17 00:00:00 2001 From: Grisha Shipunov Date: Sat, 11 Jan 2025 03:55:19 +0100 Subject: delete legacy stuff and reformat --- hosts/minime/configuration.nix | 17 +++--- hosts/minime/default.nix | 3 +- hosts/minime/hardware-configuration.nix | 105 +++++++++++++++++++------------- hosts/minime/networking.nix | 3 +- hosts/minime/zfs.nix | 48 ++++++++++----- 5 files changed, 108 insertions(+), 68 deletions(-) (limited to 'hosts/minime') diff --git a/hosts/minime/configuration.nix b/hosts/minime/configuration.nix index 0a36ae6..bb77eaf 100644 --- a/hosts/minime/configuration.nix +++ b/hosts/minime/configuration.nix @@ -2,23 +2,26 @@ # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Enable the X11 windowing system. services.xserver.enable = false; system.stateVersion = "24.11"; # Did you read the comment? } - diff --git a/hosts/minime/default.nix b/hosts/minime/default.nix index 90013f7..3b679be 100644 --- a/hosts/minime/default.nix +++ b/hosts/minime/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./configuration.nix ./hardware-configuration.nix diff --git a/hosts/minime/hardware-configuration.nix b/hosts/minime/hardware-configuration.nix index 12c658f..7e17821 100644 --- a/hosts/minime/hardware-configuration.nix +++ b/hosts/minime/hardware-configuration.nix @@ -1,59 +1,76 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "zpool/nixos/root"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/12CE-A600"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - fileSystems."/nix" = - { device = "zpool/nixos/nix"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; - - fileSystems."/home" = - { device = "zpool/data/home"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; - - fileSystems."/var" = - { device = "zpool/data/var"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; - - fileSystems."/var/lib" = - { device = "zpool/data/var/lib"; - fsType = "zfs"; - options = [ "zfsutil" ]; - }; - - swapDevices = - [ { + fileSystems."/" = { + device = "zpool/nixos/root"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/12CE-A600"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + fileSystems."/nix" = { + device = "zpool/nixos/nix"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/home" = { + device = "zpool/data/home"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var" = { + device = "zpool/data/var"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var/lib" = { + device = "zpool/data/var/lib"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + swapDevices = [ + { device = "/dev/disk/by-partuuid/7e7d0e0b-90b7-465c-a022-089b38e0f16d"; randomEncryption = true; - } ]; + } + ]; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/minime/networking.nix b/hosts/minime/networking.nix index cd01a42..9631b2d 100644 --- a/hosts/minime/networking.nix +++ b/hosts/minime/networking.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ networking.hostName = "minime"; # Define your hostname. networking.useNetworkd = true; networking.firewall.enable = true; diff --git a/hosts/minime/zfs.nix b/hosts/minime/zfs.nix index 85ff937..fda824e 100644 --- a/hosts/minime/zfs.nix +++ b/hosts/minime/zfs.nix @@ -1,4 +1,10 @@ -{ pkgs, lib, config, ... }: { +{ + pkgs, + lib, + config, + ... +}: +{ services.fstrim.enable = true; services.zfs = { autoSnapshot.enable = true; @@ -12,19 +18,21 @@ }; networking.hostId = "41ba28ff"; boot = { - kernelPackages = let - zfsCompatibleKernelPackages = lib.filterAttrs ( - name: kernelPackages: - (builtins.match "linux_[0-9]+_[0-9]+" name) != null - && (builtins.tryEval kernelPackages).success - && (!kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}.meta.broken) + kernelPackages = + let + zfsCompatibleKernelPackages = lib.filterAttrs ( + name: kernelPackages: + (builtins.match "linux_[0-9]+_[0-9]+" name) != null + && (builtins.tryEval kernelPackages).success + && (!kernelPackages.${config.boot.zfs.package.kernelModuleAttribute}.meta.broken) ) pkgs.linuxKernel.packages; latestKernelPackage = lib.last ( lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) ( builtins.attrValues zfsCompatibleKernelPackages - ) - ); - in latestKernelPackage; + ) + ); + in + latestKernelPackage; supportedFilesystems = [ "zfs" ]; kernelParams = [ "nohibernate" ]; plymouth.enable = false; @@ -38,14 +46,24 @@ enable = true; port = 2222; hostKeys = [ /etc/secrets/initrd/ssh_host_rsa_key ]; - authorizedKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJl9iYG5oHBq/poBn7Jf1/FGWWbAnbx+NKjs7qtT3uAK 0xa@toaster 2024-12-31" ]; + authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJl9iYG5oHBq/poBn7Jf1/FGWWbAnbx+NKjs7qtT3uAK 0xa@toaster 2024-12-31" + ]; }; postCommands = '' - zpool import -a - echo "zfs load-key -a; killall zfs" >> /root/.profile + zpool import -a + echo "zfs load-key -a; killall zfs" >> /root/.profile ''; }; # support for network - boot.initrd.kernelModules = [ "igc" "i40e" "mt7921e" ]; - boot.kernelModules = [ "igc" "i40e" "mt7921e" ]; + boot.initrd.kernelModules = [ + "igc" + "i40e" + "mt7921e" + ]; + boot.kernelModules = [ + "igc" + "i40e" + "mt7921e" + ]; } -- cgit v1.3.1