Add initial flake

holy shit nixos is magic :3
This commit is contained in:
NullBite 2023-12-27 02:37:46 -05:00
parent 5feb978849
commit ccb7836983
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
3 changed files with 177 additions and 0 deletions

20
flake.nix Normal file
View File

@ -0,0 +1,20 @@
{
description = "NixOS Configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
# ^^^^^^^^^^^^^ this part is optional
};
outputs = { self, nixpkgs }:
let
lib = nixpkgs.lib;
in {
nixosConfigurations = {
slab = lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./configuration.nix ];
};
};
};
}

View File

@ -0,0 +1,62 @@
# 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 = [ "nvme" "xhci_pci" "usbhid" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" "amdgpu" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/5723dafa-81df-4bb4-a039-7f52b61cbb02";
fsType = "btrfs";
options = [ "subvol=nixos/@root" ];
};
# fileSystems."/boot" =
# { device = "/dev/disk/by-uuid/b9813c1d-5b6c-4026-9ee3-53ba80b90dc4";
# fsType = "ext4";
# };
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/4E1B-8BEE";
fsType = "vfat";
};
fileSystems."/.btrfsroot" =
{ device = "/dev/disk/by-uuid/5723dafa-81df-4bb4-a039-7f52b61cbb02";
fsType = "btrfs";
options = [ "subvol=/" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/5723dafa-81df-4bb4-a039-7f52b61cbb02";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/9360890a-4050-4326-bf5f-8fa2bdc6744a"; }
];
# 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-6b5c424872ae.useDHCP = lib.mkDefault true;
# networking.interfaces.docker0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.tailscale0.useDHCP = lib.mkDefault true;
# networking.interfaces.virbr0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

95
host-configuration.nix Normal file
View File

@ -0,0 +1,95 @@
# vim: set ts=2 sw=2 et:
{ config, lib, pkgs, modulesPath, ... }:
{
networking.hostName = "slab";
# cryptsetup
boot.initrd.luks.devices = {
lvmroot = {
device="/dev/disk/by-uuid/2872c0f0-e544-45f0-9b6c-ea022af7805a";
allowDiscards = true;
fallbackToPassword = true;
preLVM = true;
};
};
# bootloader setup
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
# grub = {
# enable = true;
# efiSupport = true;
# device = "nodev";
# };
systemd-boot = {
enable = true;
netbootxyz.enable = true;
memtest86.enable = true;
};
};
services.supergfxd.enable = true;
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["amdgpu" "nvidia"];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = false;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
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.stable;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
amdgpuBusId = "PCI:07:00:0";
nvidiaBusId = "PCI:01:00:0";
};
};
services.syncthing = {
enable = true;
user = "nullbite";
dataDir = "/home/nullbite/Documents";
configDir = "/home/nullbite/.config/syncthing";
};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
}