From 3d0033b8b219ede95f89167f8d7e6e64b0e57df9 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Sun, 7 Jul 2024 02:50:07 -0500 Subject: [PATCH] separate grub/systemd configs. --- configuration.nix => configuration-grub.nix | 0 configuration-systemd.nix | 51 +++++++++++++++++++++ flake.nix | 13 +++++- 3 files changed, 62 insertions(+), 2 deletions(-) rename configuration.nix => configuration-grub.nix (100%) create mode 100644 configuration-systemd.nix diff --git a/configuration.nix b/configuration-grub.nix similarity index 100% rename from configuration.nix rename to configuration-grub.nix diff --git a/configuration-systemd.nix b/configuration-systemd.nix new file mode 100644 index 0000000..6ed83da --- /dev/null +++ b/configuration-systemd.nix @@ -0,0 +1,51 @@ +# This is a small config that can be used to bootstrap a system with ZFS. +{ config, lib, modulesPath, ... }: +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # Generate a hostId for ZFS + # head -c4 /dev/urandom | od -A none -t x4 + networking.hostId = "f35c6293"; + networking.hostName = "MiniNix"; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + initrd.kernelModules = [ ]; + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + loader = { + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + }; + }; + }; + + fileSystems."/" = { + device = "zroot/root"; + fsType = "zfs"; + }; + + fileSystems."/nix" = { + device = "zroot/nix"; + fsType = "zfs"; + }; + + fileSystems."/var" = { + device = "zroot/var"; + fsType = "zfs"; + }; + + fileSystems."/home" = { + device = "zroot/home"; + fsType = "zfs"; + }; + + swapDevices = [ ]; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + system.stateVersion = "24.05"; +} diff --git a/flake.nix b/flake.nix index 6bf79d8..75bd3bc 100644 --- a/flake.nix +++ b/flake.nix @@ -14,11 +14,20 @@ outputs = { self, nixpkgs, disko, ... }@inputs: { nixosConfigurations = { - "mini-x86" = nixpkgs.lib.nixosSystem { + "mini-x86-grub" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; modules = [ - ./configuration.nix + ./configuration-grub.nix + disko.nixosModules.disko + (import ./disko-nixos.nix { disks = [ "/dev/nvme0n1" ]; }) + ]; + }; + "mini-x86-systemd" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./configuration-systemd.nix disko.nixosModules.disko (import ./disko-nixos.nix { disks = [ "/dev/nvme0n1" ]; }) ];