From e2ca6546815363f82cc9b39a8387435850ff887d Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Sun, 4 Jun 2023 14:11:38 -0400 Subject: [PATCH] Rework in progress --- machines/desktop/hardware-configuration.nix | 20 +-- {sysConfig => machines/desktop}/me.nix | 0 sysConfig/locale.nix => modules/nvim/nvim.nix | 0 modules/system/configuration.nix | 145 +++++++++++++++++- sysConfig/audio.nix | 19 --- sysConfig/boot.nix | 19 --- sysConfig/default.nix | 25 --- sysConfig/disks.nix | 1 - sysConfig/gui.nix | 76 --------- sysConfig/network.nix | 17 -- sysConfig/virt.nix | 24 --- 11 files changed, 153 insertions(+), 193 deletions(-) rename {sysConfig => machines/desktop}/me.nix (100%) rename sysConfig/locale.nix => modules/nvim/nvim.nix (100%) delete mode 100644 sysConfig/audio.nix delete mode 100644 sysConfig/boot.nix delete mode 100644 sysConfig/default.nix delete mode 100644 sysConfig/disks.nix delete mode 100644 sysConfig/gui.nix delete mode 100644 sysConfig/network.nix delete mode 100644 sysConfig/virt.nix diff --git a/machines/desktop/hardware-configuration.nix b/machines/desktop/hardware-configuration.nix index 92f4f5b..985e26a 100644 --- a/machines/desktop/hardware-configuration.nix +++ b/machines/desktop/hardware-configuration.nix @@ -5,9 +5,9 @@ boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "coretemp" ]; boot.extraModulePackages = [ ]; - + boot.kernelParams = [ "intel_iommu=on" ]; + boot.kernelModules = [ "kvm-intel" "virtio" "vfio-pci" "coretemp" ]; boot.kernelPackages = pkgs.linuxPackages_latest; fileSystems."/" = @@ -25,14 +25,14 @@ fsType = "vfat"; }; - services.xserver.videoDrivers = [ "nvidia" ]; # Uncomment - hardware = { # this - opengl.enable = true; # codeblock - nvidia = { # for - package = config.boot.kernelPackages.nvidiaPackages.stable; # NVIDIA - modesetting.enable = true; # proprietary - }; # driver - }; # support + services.xserver.videoDrivers = [ "nvidia" ]; + hardware = { + opengl.enable = true; + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; + modesetting.enable = true; + }; + }; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/sysConfig/me.nix b/machines/desktop/me.nix similarity index 100% rename from sysConfig/me.nix rename to machines/desktop/me.nix diff --git a/sysConfig/locale.nix b/modules/nvim/nvim.nix similarity index 100% rename from sysConfig/locale.nix rename to modules/nvim/nvim.nix diff --git a/modules/system/configuration.nix b/modules/system/configuration.nix index b8cf9bd..86d7523 100644 --- a/modules/system/configuration.nix +++ b/modules/system/configuration.nix @@ -1,4 +1,129 @@ +{ config, pkgs, lib, ... }: { + system.stateVersion = "23.05"; + environment.defaultPackages = [ ]; + + nix = { + extraOptions = "experimental-features = nix-command flakes"; + settings = { + allowed-users = "bryan"; + auto-optimise-store = true; + system-features = [ + "kvm" + ]; + }; + gc = { + automatics = true; + options = "weekly"; + }; + }; + + boot = { + loader = { + grub = { + enable = true; + useOSProber = true; + devices = [ "nodev" ]; + efiSupport = true; + configurationLimit = 5; + }; + + efi = { + canTouchEfiVariables = true; + }; + }; +# extraModprobeConfig = '' +# options vfio-pci ids=10de:1f82,10de:10fa +# ''; + }; + + programs = { + sway = { + enable = true; + extraPackages = with pkgs; [ + rofi-wayland + grim + slurp + wl-clipboard + + xdg-utils + + fontconfig + qogir-icon-theme + emote + + virt-manager + pavucontrol + ]; + }; + + bash = { + enable = true; + enableCompletion = true; + enableLsColors = true; + blesh.enable = true; + + shellInit = '' + + ''; + }; + + gnupg = { + agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + xwayland = { + enable = true; + }; + + git.enable = true; + }; + + fonts = { + fonts = with pkgs; [ + terminus_font + nerdfonts + + noto-fonts + noto-fonts-cjk + + emojione + ]; + }; + + xdg.portal.wlr.enable = true; + + services.pipewire = { + enable = true; + audio.enable = true; + + wireplumber.enable = true; + + pulse.enable = true; + jack.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + }; + + services = { + trezord.enable = true; + + cron = { + enable = true; + systemCronJobs = [ + "0 0 * * * bryan /home/bryan/Documents/scripts/lnbackup_script.sh" + ]; + }; + }; + + console = { + font = "Lat2-Terminus16"; + useXkbConfig = true; + }; + time = { timeZone = "America/New_York"; }; @@ -13,6 +138,22 @@ ]; }; - i18n.defaultLocale = "en_US.UTF-8"; # Change locale -} + i18n.defaultLocale = "en_US.UTF-8"; + # Networking + networking = { + hostName = "socrates"; + useDHCP = lib.mkDefault true; + networkmanager.enable = true; + firewall.enable = true; + }; + + virtualisation.libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + ovmf.enable = true; + }; + }; +} diff --git a/sysConfig/audio.nix b/sysConfig/audio.nix deleted file mode 100644 index 63cde13..0000000 --- a/sysConfig/audio.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - services.pipewire = { - enable = true; - audio.enable = true; - - wireplumber.enable = true; - - pulse.enable = true; - jack.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - }; - - environment.systemPackages = with pkgs; [ - pavucontrol - ]; -} diff --git a/sysConfig/boot.nix b/sysConfig/boot.nix deleted file mode 100644 index 05f8aab..0000000 --- a/sysConfig/boot.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - boot = { - loader = { - grub = { - enable = true; - useOSProber = true; - devices = [ "nodev" ]; - efiSupport = true; - configurationLimit = 5; - }; - - efi = { - canTouchEfiVariables = true; - }; - }; - }; -} diff --git a/sysConfig/default.nix b/sysConfig/default.nix deleted file mode 100644 index 4440866..0000000 --- a/sysConfig/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ pkgs, ... }: - -{ - # Nix requires default.nix to build the system properly. - - # Add or remove imports based on the modules in sysConfig/. - imports = [ - ./audio.nix - ./boot.nix - ./gui.nix - ./hardware.nix - ./locale.nix - ./network.nix - ./users.nix - ./virt.nix - ]; - - # Enable nix commands and flakes - nix = { - package = pkgs.nixFlakes; - extraOptions = "experimental-features = nix-command flakes"; - }; - - system.stateVersion = "22.11"; # Do not edit this variable. -} diff --git a/sysConfig/disks.nix b/sysConfig/disks.nix deleted file mode 100644 index 77fc024..0000000 --- a/sysConfig/disks.nix +++ /dev/null @@ -1 +0,0 @@ -#TBD diff --git a/sysConfig/gui.nix b/sysConfig/gui.nix deleted file mode 100644 index b4f2ac6..0000000 --- a/sysConfig/gui.nix +++ /dev/null @@ -1,76 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - -# DESKTOP - - programs.sway.enable = true; - - environment.systemPackages = with pkgs; [ - rofi-wayland - grim - jq - slurp - wl-clipboard - - xdg-desktop-portal - xdg-desktop-portal-wlr - xdg-utils - - fontconfig - qogir-icon-theme - emote - - xwayland - ]; - - services = { - trezord = { - enable = true; - }; - - cron = { - enable = true; - systemCronJobs = [ - "0 0 * * * bryan /home/bryan/Documents/scripts/lnbackup_script.sh" - ]; - }; - }; - -# CONSOLE - - console = { - font = "Lat2-Terminus16"; - useXkbConfig = true; - }; - -# FONTS - - fonts = { - fonts = with pkgs; [ - terminus_font - nerdfonts - - noto-fonts - noto-fonts-cjk - - emojione - ]; - }; - - -# GPU DRIVERS - -# boot.initrd.kernelModules = [ "amdgpu" ]; #Uncomment for AMD - - hardware.nvidia.open = true; # Uncomment for nvidia open-source nouveau drivers - -# services.xserver.videoDrivers = [ "nvidia" ]; # Uncomment -# hardware = { # this -# opengl.enable = true; # codeblock -# nvidia = { # for -# package = config.boot.kernelPackages.nvidiaPackages.stable; # NVIDIA -# modesetting.enable = true; # proprietary -# }; # driver -# }; # support -} diff --git a/sysConfig/network.nix b/sysConfig/network.nix deleted file mode 100644 index 432e424..0000000 --- a/sysConfig/network.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - - networking = { - hostName = "socrates"; - useDHCP = lib.mkDefault true; - networkmanager.enable = true; - }; - - programs.gnupg = { - agent = { - enable = true; - enableSSHSupport = true; - }; - }; -} diff --git a/sysConfig/virt.nix b/sysConfig/virt.nix deleted file mode 100644 index 33aaf11..0000000 --- a/sysConfig/virt.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - boot = { - kernelParams = [ "intel_iommu=on" ]; - kernelModules = [ "kvm-intel" "virtio" "vfio-pci" ]; - -# TODO: (bryan) - Fix GPU passthrough -# extraModprobeConfig = '' -# options vfio-pci ids=10de:1f82,10de:10fa -# ''; - }; - - virtualisation.libvirtd.enable = true; - - environment.systemPackages = with pkgs; [ - qemu_kvm - libvirt - virt-manager - OVMF - ]; -} - -