diff options
| author | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-04-05 13:14:31 +0200 |
|---|---|---|
| committer | Jakub Stachurski <j.stachurski@student.utwente.nl> | 2025-04-05 14:29:48 +0200 |
| commit | e185b7f874566c66fd97f158a457c4c64d0628ce (patch) | |
| tree | b242707378575c3aa286b4c3a7f8b198672e4440 | |
| parent | 45ec0396b4d56798f39254e9ef31b9c144e681fd (diff) | |
add the new laptop install
| -rw-r--r-- | nixos/common/default.nix | 1 | ||||
| -rw-r--r-- | nixos/flake.nix | 11 | ||||
| -rw-r--r-- | nixos/hosts/apocalypse/default.nix | 70 | ||||
| -rw-r--r-- | nixos/hosts/apocalypse/hardware-configuration.nix | 59 | ||||
| -rw-r--r-- | nixos/hosts/apocalypse/nvidia.nix | 55 |
5 files changed, 196 insertions, 0 deletions
diff --git a/nixos/common/default.nix b/nixos/common/default.nix index 8e14366..792a831 100644 --- a/nixos/common/default.nix +++ b/nixos/common/default.nix @@ -39,6 +39,7 @@ extraGroups = [ "wheel" "networkmanager" "input" "docker" "adbusers" "libvirtd" ]; # Enable ‘sudo’ for the user. packages = with pkgs; [ tree + home-manager ]; }; diff --git a/nixos/flake.nix b/nixos/flake.nix index f5e1620..c596032 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -32,5 +32,16 @@ } ]; }; + nixosConfigurations.apocalypse = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/apocalypse + ./desktop + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; }; } diff --git a/nixos/hosts/apocalypse/default.nix b/nixos/hosts/apocalypse/default.nix new file mode 100644 index 0000000..8ad76ef --- /dev/null +++ b/nixos/hosts/apocalypse/default.nix @@ -0,0 +1,70 @@ + {pkgs, config, lib, ...}: + { + imports = [ + ./hardware-configuration.nix + ../../common + ./nvidia.nix + ]; + boot.loader.grub = { + useOSProber = true; + device = "nodev"; + + + efiSupport = true; + default = "saved"; + memtest86.enable = true; + # splashImage = ./GrubBG.png; + }; + boot.loader.efi.canTouchEfiVariables = true; + boot.crashDump.enable = false; + boot.plymouth = { + enable = true; + theme = "bgrt"; + }; + + boot.kernelParams = [ + "quiet" + "splash" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.logpriority=3" + ]; + boot.consoleLogLevel = 0; + + networking.hostName = "apocalypse"; # Define your hostname. + networking.firewall.enable = false; + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + hardware.bluetooth.enable = true; + hardware.bluetooth.settings = { + General = {Enable = "Source,Sink,Media,Socket";}; + }; + + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; + + programs.nix-ld.enable = true; + services.printing.enable = true; + nixpkgs.config.allowUnfree = true; + + + services.resolved = { + enable = true; + dnssec = "false"; + domains = [ "~." ]; + fallbackDns = [ ]; + dnsovertls = "opportunistic"; + }; + + + networking.useDHCP = lib.mkDefault true; + networking.firewall.checkReversePath = false; + + + # Thunderbolt + services.hardware.bolt.enable = true; + powerManagement.enable = true; +} + + diff --git a/nixos/hosts/apocalypse/hardware-configuration.nix b/nixos/hosts/apocalypse/hardware-configuration.nix new file mode 100644 index 0000000..998c386 --- /dev/null +++ b/nixos/hosts/apocalypse/hardware-configuration.nix @@ -0,0 +1,59 @@ +# 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, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ "cryptd" "aesni_intel" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.supportedFilesystems = [ "ntfs" "btrfs" "vfat" ]; + boot.loader.grub.extraEntries = + '' +menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' { + fwsetup +} + ''; + + boot.initrd.luks.devices = { + "cryptroot".device = "/dev/disk/by-uuid/d2c3c197-3d75-4da2-a098-207030a91b62"; + "cryptswap".device = "/dev/disk/by-uuid/fd6a5644-a33c-40af-ae48-42db1a5997ac"; + }; + + fileSystems."/" = + { device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ "subvol=@root" ]; + }; + + + fileSystems."/snapshots" = + { device = "/dev/mapper/cryptroot"; + fsType = "btrfs"; + options = [ "subvol=@snapshots" ]; + }; + + + swapDevices = + [ { device = "/dev/mapper/cryptswap"; } + ]; + + # 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.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.br-7bda29607d31.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.virbr0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/hosts/apocalypse/nvidia.nix b/nixos/hosts/apocalypse/nvidia.nix new file mode 100644 index 0000000..ef95b43 --- /dev/null +++ b/nixos/hosts/apocalypse/nvidia.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, modulesPath, ...}: +{ + # Enable OpenGL + hardware.graphics = { + enable = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.production; + + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + + sync.enable = false; + + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; + +} |
